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: SafetyMCU_Bootloader - Fapi_BlockErase() hangs

Part Number: TMS570LS3137

Hi,

I am working with TMDS570LS31USB. Code Composer Studio 8.0

F021 Flash API version is 02.01.01.

I downloaded the Hercules_MCU_Bootloader.zip  from http://processors.wiki.ti.com/index.php/TMS570_Hercules_MCU_Bootloader

I am running the UART bootloader located in SafetyMCU_Bootloader\TMS570LS31x\boot_uart inside this zip file.

The bootloader builds and runs. I want to test downloading a small sample application, around 235KB. I press "1", and choose the .out file and send it through YModem on Teraterm.

I verify that Ymodem transferred the whole content since number of bytes macthes the file size. All good so far.

The  problem is at Fapi_BlockErase(), execution hangs in this function forever, at line: while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

I already implemented the suggested first and second fixes proposed in the following post:

https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/680543?RM48L950-erasing-flash-sector-0-results-in-a-hang-in-Fapi-BlockErase-

However the execution is still stuck at while(FAPI_GET_FSM_STATUS != Fapi_Status_Success); line inside Fapi_BlockErase().

Basically, (1) I replaced Fapi_enableMainBankSectors(0xFFFE) with of 0xFFFF. (2)  in bl_link.cmd, I added section bl_flash.obj (.const) into the flashAPI section.

what is missing?

Do we need add more sections into the flashAPI via bl_link.cmd file? what other sections?

thank you in advance,

  • I think replacing Fapi_enableMainBankSectors(0xFFFE) with 0xFFFF is not applicable on my case since I don't care about erasing sector 0.
    below is the single line I added:

    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    ..\Release\Fapi_UserDefinedFunctions.obj (.text)
    ..\Release\bl_flash.obj (.text)

    //!!! added by me start !!!
    ..\Release\bl_flash.obj (.const)
    //!!! added by me end !!!

    --library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj
    FlashStateMachine.SetActiveBank.obj
    FlashStateMachine.InitializeFlashBanks.obj
    FlashStateMachine.EnableMainSectors.obj
    FlashStateMachine.IssueFsmCommand.obj
    FlashStateMachine.ScaleFclk.obj
    Init.obj
    Utilities.CalculateEcc.obj
    Utilities.WaitDelay.obj
    Utilities.CalculateFletcher.obj
    Read.MarginByByte.obj
    Read.Common.obj
    Read.FlushPipeline.obj
    Read.WdService.obj
    Async.WithAddress.obj
    Program.obj > (.text)
    } load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)
  • Hello,

    Can you replace:

    --library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj

    FlashStateMachine.SetActiveBank.obj

    FlashStateMachine.InitializeFlashBanks.obj

    FlashStateMachine.EnableMainSectors.obj

    FlashStateMachine.IssueFsmCommand.obj

    FlashStateMachine.ScaleFclk.obj

    Init.obj

    Utilities.CalculateEcc.obj

    Utilities.WaitDelay.obj

    Utilities.CalculateFletcher.obj

    Read.MarginByByte.obj

    Read.Common.obj

    Read.FlushPipeline.obj

    Read.WdService.obj

    Async.WithAddress.obj

    Program.obj > (.text)

    with:

    --library= F021_API_CortexR4_BE.lib (.text)

    in flashAPI section in linker.cmd file

    Did you copy flashSPI section into the SRAM? You are correct, you don't have to change 0xFFFE to 0xFFFF since you want to protect the 1st sector for bootloader.

  • Thank you.
    1- I have not modified the original bootloader project at all. So, _copyAPI2RAM_(); is called inside _c_int00() as designed. I viewed the memory and saw Flash API related function names in RAM starting at address 0x08002000

    2- I tried the replacement in the linker file as you suggested. Basically --library= F021_API_CortexR4_BE.lib (.text) instead of that long list.
    Unfortunately still same behavior. stuck at Fapi_BlockErase().

    I am trying to put s/w breakpoints inside Fapi_BlockErase(). however debugging is odd, it jumps to odd lines. not sure why? is it because Fapi_BlockErase is running in RAM?

    Are you able to exercise the download feature of this sample bootloader?

    Not sure what to try or focus on?

    Were anyone able to make this sample bootloader erase and write to the FLASH?

    Or is there any sample application erasing/writing Flash? (for TMS570LS3137 family)

    thank you for your help and guidance,
  • I saw this one at www.ti.com/.../spnu501h.pdf
    ===================================
    Memory Regions Required to be Readable
    NOTE: The F021 Flash API library must be able to read from addresses 0x000, 0x100, 0x200,
    0x300, and the TI OTP region, 0xF008_0000 - 0xF00B_0000, for the API to operate
    correctly.
    ===================================
    after reading this I added R option for the VECTORS section in linker file, as shown below:

    MEMORY
    {
    // original line : VECTORS (X) : origin=0x00000000 length=0x00000020
    VECTORS (RX) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x002FEB00 //LS31x Flash size is 0x300000
    SRAM (RW) : origin=0x08002000 length=0x0002D000
    STACK (RW) : origin=0x08000000 length=0x00002000
    }

    this didn't make any change.
    Not sure about this 0xF008_0000 - 0xF00B_0000 region though.
  • Hi QJ,

    Are you guys at TI Support able to run this Hercules_MCU_Bootloader.zip from processors.wiki.ti.com/.../TMS570_Hercules_MCU_Bootloader on a TMDS570LS31USB dev board?

    The last thing I tried was to add "X" permission to SRAM since FLashAPI runs at SRAM. However this didn't make a difference either.
    I also added the line for OTP region based on the above comment. This didn't make a difference either.

    MEMORY
    {
    // original line : VECTORS (X) : origin=0x00000000 length=0x00000020
    VECTORS (RX) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x002FEB00 //LS31x Flash size is 0x300000
    // original line : SRAM (RW) : origin=0x08002000 length=0x0002D000
    SRAM (RWX) : origin=0x08002000 length=0x0002D000
    STACK (RW) : origin=0x08000000 length=0x00002000
    // added by me
    OTP (RW) : origin=0xF0080000 length=0x00030000
    }

    I hope you guys at TI could test this Hercules_MCU_Bootloader.zip on a TMDS570LS31USB.
    thank you in advance,
  • Hello,

    What is the starting address for the application image?

  • I noticed that the frequency was wrong. I had to halve the frequency, from 160 to 80 Mhz when calling Fapi_initializeFlashBanks().
    I don't know why 80Mhz works but not 160.
    Any documentation or explanation about the frequency required for each flash operation, like erase or program?

    thanks,
  • Hi,

    The frequency in Fapi_initializeFlashBanks() should be the system clock. If you use USB stick, we don't recommend to run the device over 100MHz otherwise the board becomes very hot.