Part Number: TMS570LS3137
Hi there,
I have used F021 API to program both main bank (bank1) and emulated EEPROM (bank7).
When I write to EEPROM at sector 0, I got a 0x30 error from FAPI_GET_FSM_STATUS which suggest attempt to write to bits already set to 0. But this is not true as I can see from my debugging info as well as memory view. This is the scenario:
1. write 4 bytes to offset 0, can't write to the next 4 byte space, but can write to offset 8
2. write 6 bytes to offset 0, can write to offset 8
I don't have any problem writing to main bank even though the write logic is exactly the same.
Please advise. Thanks.
This is the code
#define FLASH_BANK_WIDTH 16
static void write(uint32_t address, uint8_t* data, int size)
{
Fapi_StatusType status;
while (size) {
// can't cross the bank width boundary, spnu501h s.4.3.1
uint8_t byteToProgram = FLASH_BANK_WIDTH - (address % FLASH_BANK_WIDTH);
if (size < byteToProgram)
byteToProgram = size;
status = Fapi_issueProgrammingCommand((uint32_t*) address, data, byteToProgram, NULL, 0, Fapi_AutoEccGeneration);
assert(status == Fapi_Status_Success);
address += byteToProgram;
data += byteToProgram;
size -= byteToProgram;
while (FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy)
vTaskDelay(100);
status = (Fapi_StatusType) FAPI_GET_FSM_STATUS;
assert(status == Fapi_Status_Success);
}
}