Skip to content

Commit

Permalink
Fixing read voltage timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
henols committed Jan 21, 2025
1 parent 2c754ff commit d23fb2f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 23 deletions.
9 changes: 1 addition & 8 deletions src/flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,10 @@ void flash_write_execute(firestarter_handle_t* handle) {
return;
}
}
handle->response_code = RESPONSE_CODE_OK;
}

void flash_erase_execute(firestarter_handle_t* handle) {
if (is_flag_set(FLAG_CAN_ERASE)) {
flash_internal_erase(handle);
}
else {
copy_to_buffer(handle->response_msg, "Erase not supported");
handle->response_code = RESPONSE_CODE_ERROR;
}
flash_internal_erase(handle);
}

void flash_blank_check_execute(firestarter_handle_t* handle) {
Expand Down
1 change: 1 addition & 0 deletions src/hw_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ bool read_voltage(firestarter_handle_t* handle) {
dtostrf(rurp_read_vcc(), 2, 2, vcc);
log_data_format("%s: %sv, Internal VCC: %sv", type, vStr, vcc);
delay(200);
reset_timeout();
return false;
}

Expand Down
19 changes: 7 additions & 12 deletions src/ic_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool read(firestarter_handle_t* handle) {
return true;
}

log_data_format( "Read data from address 0x%lx to 0x%lx", handle->address, handle->address + handle->data_size);
log_data_format("Read data from address 0x%lx to 0x%lx", handle->address, handle->address + handle->data_size);
rurp_communication_write(handle->data_buffer, handle->data_size);
// debug_format("Read buffer: %.10s...", handle->data_buffer);

Expand Down Expand Up @@ -59,11 +59,11 @@ bool write(firestarter_handle_t* handle) {
return true;
}

log_ok_format( "Reciving %d bytes", handle->data_size);
log_ok_format("Reciving %d bytes", handle->data_size);
int len = rurp_communication_read_bytes(handle->data_buffer, handle->data_size);

if ((uint32_t)len != handle->data_size) {
log_error_format( "Not enough data, expected %d, got %d", (int)handle->data_size, len);
log_error_format("Not enough data, expected %d, got %d", (int)handle->data_size, len);
return true;
}

Expand All @@ -83,7 +83,7 @@ bool write(firestarter_handle_t* handle) {
return true;
}

log_ok_format( "Data written to address %lx - %lx", handle->address, handle->address + handle->data_size);
log_ok_format("Data written to address %lx - %lx", handle->address, handle->address + handle->data_size);

handle->address += handle->data_size;
if (handle->address >= handle->mem_size) {
Expand All @@ -110,7 +110,7 @@ bool verify(firestarter_handle_t* handle) {
return true;
}

log_ok_format( "Reciving %d bytes", handle->data_size);
log_ok_format("Reciving %d bytes", handle->data_size);
int len = rurp_communication_read_bytes(handle->data_buffer, handle->data_size);

if ((uint32_t)len != handle->data_size) {
Expand All @@ -133,7 +133,7 @@ bool verify(firestarter_handle_t* handle) {
return true;
}

log_ok_format( "Data verified address %lx - %lx", handle->address, handle->address + handle->data_size);
log_ok_format("Data verified address %lx - %lx", handle->address, handle->address + handle->data_size);

handle->address += handle->data_size;
if (handle->address >= handle->mem_size) {
Expand All @@ -152,9 +152,7 @@ bool erase(firestarter_handle_t* handle) {
}

debug("Erase PROM");

if (excecute_operation(handle) && is_flag_set(FLAG_CAN_ERASE)) {

if (is_flag_set(FLAG_CAN_ERASE) and excecute_operation(handle)) {
if (handle->response_code == RESPONSE_CODE_OK) {
log_ok_const("Chip is erased");
}
Expand Down Expand Up @@ -216,12 +214,9 @@ bool excecute_operation(firestarter_handle_t* handle) {
return true;
}
execute_function(handle->firestarter_operation_end, handle);

return true;
}

return false;

}


1 change: 0 additions & 1 deletion src/json_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ int json_parse(char* json, jsmntok_t* tokens, int token_count, firestarter_handl
handle->bus_config.rw_line = 0xFF;
handle->bus_config.vpp_line = 0;
handle->bus_config.address_lines[0] = 0xFF;
handle->response_code = RESPONSE_CODE_OK;
handle->chip_id = 0;

for (int i = 1; i < token_count; i++) {
Expand Down
2 changes: 0 additions & 2 deletions src/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ void memory_write_execute(firestarter_handle_t* handle) {
for (uint32_t i = 0; i < handle->data_size; i++) {
handle->firestarter_set_data(handle, handle->address + i, handle->data_buffer[i]);
}
handle->response_code = RESPONSE_CODE_OK;
}

void memory_set_data(firestarter_handle_t* handle, uint32_t address, uint8_t data) {
Expand All @@ -194,5 +193,4 @@ void memory_verify_execute(firestarter_handle_t* handle) {
return;
}
}
handle->response_code = RESPONSE_CODE_OK;
}

0 comments on commit d23fb2f

Please sign in to comment.