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.

TMS570LS3137: TMS570 f021_flash_api 02.01.01 Fapi_setActiveFlashBank problem

Part Number: TMS570LS3137

Hi I'm Fatih,

I'm writing a bootloader library with the TMS570LS3137 Mcu, but it gets stuck in the Fapi_setActiveFlashBank function, what could I be doing wrong? I am attaching images related to my code. I would be very happy if you help.

Best regards, good work...

#define BOOTLOADER_SYS_CLK_FREQ           180             //MHz

  • Hi Fatih,

    From the your code in main(),  you are trying to write data to sectors of bank 0. 

    All of the Flash APIs that program, erase, blank check or margin verify must be called from a bank other than the one in which code is being executed. If programming or erasing bank 0 of the device which has only one flash bank, these routines must be executed in RAM.

    I recommend that the you disable the interrupts before calling flash API.

    Please refer to my bootloader example in which the flash APIs are copied to RAM and executed from SRAM.

  • Hello again, the solution you suggested worked, thanks.

    I have one more concern, We wait for the flag states to change with loops. Is there a chance that the flag state will not change and stay in the loop? I have not come across an instance of timeout in any document. Does it make sense to timeout

    Best regards, good work..

  • Is there a chance that the flag state will not change and stay in the loop?

    It is possible. The flash bank will keep busy state if the bank is not implemented or if the bank is not configured properly. 

    Yes, you can use timeout. The maximum sector or bank erase time is 4 seconds.