This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HERCULES-F021FLASHAPI: Flash FSM does not return to success state

Other Parts Discussed in Thread: TMS570LS0714


I am developing a bootloader for TMS570LS0714 and found Hercules Examples provided by TI. I am experiencing a strange issue where the F021 wrapper bl_flash.c gets stuck in an infinite loop because the F021 library does not complete with success initialisation of the flash bank or writing of the new data to memory. Function that experience this issue is

uint32_t Fapi_BlockProgram( uint32_t Bank, uint32_t Flash_Start_Address, uint32_t Data_Start_Address, uint32_t Size_In_Bytes)

The default implementation has while loops that wait for Flash to exit Busy state and then for the FSM state to complete with Success.

if(( Flash_Start_Address == APP_START_ADDRESS ) || ( ucBank == 1 )){
    timout_cntr = 1000000U;
	Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */


	Fapi_enableMainBankSectors(0xFFFFU);        /* used for API 2.01*/

	while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
	while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

When a CAN message is received the data is supposed to be written to the flash using the Fapi_BlockProgram(..) function, but after a period of time, the execution gets stuck in the last while(...) loop. I have added a counter that allows the execution to continue and the bootloader requests for the last message to be retransmitted again, but subsequent writes also fail.

I have noticed this issue appearing when trying to write to different parts of the Flash.

Other probably relevant notes. When this flash issue happens, the current draw from my bench power supply drops by 20mA. I have quickly probed the 1V2 rail that goes into the MCU and noticed a strange ripple, not been able to catch it yet though to provide a screenshot.