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.

F021 on TMS570LS0432

I am trying to get the bootloader (spna193) operational. I debugged and I think that the problem is with the F021 API.

During erase (or write) operation API loops forever at while(FAPI_GET_FSM_STATUS != Fapi_Status_Success); 

Using  F021 Flash API. Version: v2.00.01 Build(000824); I tried 'erase code flow' given in SPNU501E , but again code loops  at while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);  

Below is the code block I try to check if API is OK, however it loops while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

May you please advise ? Thank you.

-------------------------------------------------

Fapi_initializeFlashBanks(80);

Fapi_setActiveFlashBank(0);

Fapi_enableMainBankSectors(0xFF); 

while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );

Fapi_issueAsyncCommandWithAddress(0,0x20000);

while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy);

while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

---------------------------------------------------------------------------

 

  • I am trying to solve the issue desperately. I now suspect that it is the .cmd file I use is the issue hence API functions behave very weird. For example, for the above source code I place debug points to lines before " while(FAPI_GET_FSM_STATUS != Fapi_Status_Success); " but debug points do not get hit and when I suspend th execution it is always at  the last line.

    attached you may find the cmd file.it is the command file for TMS570Ls04 from spna193-the bootloader.  1033.bl_link.zip

  • Hakan,

    You cannot do erase/program operation to a flash bank when the code is also being executed from the same bank, In this case, You need to execute Flash API from RAM.

    Thanks and regards,

    Zhaohong

  • Hello Zhaohong;

    Does the below cmd file  with the assembler code carry the API to RAM?

    cmd file:

    flashAPI :
    {
    ..\Debug\Fapi_UserDefinedFunctions.obj (.text)
    ..\Debug\bl_flash.obj (.text)

    --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)

    asm code:

    _copyAPI2RAM_

    .ref api_load
    flash_load .word api_load
    .ref api_run
    flash_run .word api_run
    .ref api_size
    flash_size .word api_size

    ldr r0, flash_load
    ldr r1, flash_run
    ldr r2, flash_size
    add r2, r1, r2
    copy_loop1:
    ldr r3, [r0], #4
    str r3, [r1], #4
    cmp r1, r2
    blt copy_loop1
    bx lr

    .endasmfunc

     Thank you.