Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions source/board/steami/steami32.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,19 @@ void process_task()

case TASK_READ_SECTOR:{

if( task_rx_len == 1 && steami_flash_read_sector(task_rx[0], buffer_sector) ){
steami_i2c_set_tx_data(buffer_sector, 256);
if( task_rx_len == 2 ){
uint16_t sector = ((uint16_t)task_rx[0] << 8) | task_rx[1];
if( steami_flash_read_sector(sector, buffer_sector) ){
steami_i2c_set_tx_data(buffer_sector, 256);
Comment thread
nedseb marked this conversation as resolved.
Outdated
}
else{
error_status_set_last_command_fail(&status_error);
steami_uart_write_string("ERROR Unable to read sector (bad sector parameter ?)\n");
}
}
else{
error_status_set_last_command_fail(&status_error);
steami_uart_write_string("ERROR Unable to read sector (bad sector parameter ?)\n");
error_status_bad_parameter(&status_error);
steami_uart_write_string("ERROR READ_SECTOR expects 2 bytes (sector number)\n");
}

current_task = TASK_WAIT_FLASH_BUSY;
Expand Down
2 changes: 1 addition & 1 deletion source/board/steami/steami_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ bool steami_flash_read_sector(uint32_t sector_number, uint8_t* data){
return false;
}

return w25q64_read_data(data, 0, 256);
return w25q64_read_data(data, sector_number * STEAMI_FLASH_SECTOR, STEAMI_FLASH_SECTOR);
Comment thread
nedseb marked this conversation as resolved.
Outdated
}

uint16_t steami_flash_read_file(uint8_t* data, uint16_t data_len, uint32_t offset){
Expand Down
Loading