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: FLash Programming using FO21 API

Part Number: TMS570LS3137
Other Parts Discussed in Thread: UNIFLASH

Hi,

I am trying to program TMS570LS3137 on-chip flash memory using F021 API library. i have different types of images, one image is to be loaded onto Sector0 (od size 32KB) of Bank0 and other image to be reside on Sector14 (of Size 128KB) of bank0. i am able to program Sector0 of Bank0 without any issues, but when using same code for programming Sector14, data is not programming. I tried to program Sector4, Sector10 (size 128KB) same issue was observed and finally not able to program the sector with size 128KB.

Below are the API commands i am using to program. Is there anything additional API's to be used for programming sector of size 128 KB of Bank0?.

Example API commands used:

Fapi_initializeFlashBanks(180)

Fapi_setActiveFlashBank(Fapi_FlashBank0);

Fapi_enableMainBankSectors(0xFFFF);
Fapi_enableEepromBankSectors(0xFFFFFFFF, 0xFFFFFFFF);

Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,0x160000);

Fapi_issueProgrammingCommand(0x160000, char_array,8,0,0,Fapi_AutoEccGeneration);

Can you please help me to find out the issue?

Thanks,

Kalyan

 

  • Hello Kalyan,

    1. After MainBankSectors are enabled, you need to wait until the FSM is ready to use (not BUSY)
    Fapi_enableMainBankSectors(0xFFFF);
    while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );
    2. After issuing the erase and program command, please check FSM status, for example
    Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, 0x160000);
    while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
    while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

    You can not execute flash API in bank0 to erase/program the sectors in bank0.
  • Hi Wang,

    Appreciate your quick response.

    I have those while loops in my code which checks flash state machine status. Still can't erase/program Sectors 4,5,6,7,8,9,10,11,12,13 and 14 of BANK#0.

    My application is executing from RAM and i am trying to program Flash BANK#0 using Flash API's.

    Thanks,
    Kalyan
  • Hello Kalyan,

    How did you program the first image to sector 0? Is it programmed by CCS/uniflash, or by your code executing in SRAM?

    Can you share your code with me?
  • Hi Wang,

    We are using CCS to program first image to sector0 of Bank0. And we followed F021 API document for programming Flash sectors.

    Will there be any difference programming Sectors with size 32KB and 128KB size?

    can you share a sample code for programming, so that it will easy for us to test?

    Thanks,
    Kalyan

  • Hello Kalyan,

    There is no different to erase/program 32-KB sector and 128-KB sector. Enclosed is the functions used for flash operation and used in bootloaders.

    5165.bl_flash.h

    2705.bl_flash.c