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.

TMS570LC4357 Flash API hang due to illegal address

Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

I wrote a bootloader (since there is no word on a TMS570LC4357 TI example) and everything was working fine until our code grew into bank 0 block 1 sector 9.  Then, during a block erase operation I got a hang.  I'm using F021_API_CortexR4_BE_L2FMC_V3D16.lib.  I traced it to the following code:

status= Fapi_enableMainBankSectors(0xFFFE); /* used for API 2.01*/
while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );

do{
status= Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, eraseStartAddr);
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);                                                  // <- HANG HERE with 0x00004010 in FMSTAT

remaining -= flash_sector[j++].length;
eraseStartAddr = flash_sector[j].start;

}while((remaining > 0) && ( j < flash_bank[bk].numOfSectors));

I checked my sector struct matched the data sheet:

(mine)

(void *)0x00018000, 0x08000, 0, 6, 0xfff87000,
(void *)0x00020000, 0x20000, 0, 7, 0xfff87000,
(void *)0x00040000, 0x20000, 1, 8, 0xfff87000,
(void *)0x00060000, 0x20000, 1, 9, 0xfff87000,
(void *)0x00080000, 0x40000, 2, 10, 0xfff87000,
(void *)0x000C0000, 0x40000, 3, 11, 0xfff87000,
(void *)0x00100000, 0x40000, 4, 12, 0xfff87000,

(data sheet)

Everything checks out.  I don't know what the deal is.

Am I doing something wrong?

Thanks,

Dan

  • Hi Dan,

    I have forwarded your question to our Flash API owner. They should get back with you soon.
  • Hi Dan,

    Can you provide me with the following information?

    1. What is the system frequency and wait state configuration (RWAIT and EWAIT)?

    2. Is the Bank0 set to Active before you enable the sectors ?

    3. Do you see this error consistently for Bank 0, Sector 9?

    I will try to reproduce the issue on my bench and get back to you.

    Best Regards

    Siddharth

  • 1.  Not sure what you mean by system frequency because there are so many clocks, but the Osc Freq is 16MHz, PLL set for 300MHz (GCLK).  HCLK = 150MHz, VCLKs and everything else on the GCM Halcogen pate at 75MHz.  On the Flash page of Halcogen, Mode: Pipeline, Data wait states = 3, all 3 banks active.  I'm assuming the wait state of 3 is RWAIT, this is the only value available to change in Halcogen.  Also, EWAIT is not relevant at this point since we're not in bank 7 (yet).

    2. Isn't this part of the API code?  I found this in the Block Erase API code:

    status=Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */

    for (bk = ucStartBank; bk < (ucEndBank + 1); bk++){
    status=Fapi_setActiveFlashBank((Fapi_FlashBankType)bk);

    if (bk == 0){
    j = ucStartSector;
    remaining = Size_In_Bytes;
    }else{
    j = 0;
    }

    status= Fapi_enableMainBankSectors(0xFFFE); /* used for API 2.01*/
    while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );

    so, yes.  I think so.

    3.  Yes.  I see the error consistently for Bank 0, Sector 9.  Also see the error when attempting to erase Bank 1, Sector 0.  The only success I've seen is from Bank 0, Sector 0 - 8.  But I haven't tried any of the other sectors, yet.

    The CCS debugger can erase/program all the memory mapped so far - Is it possible to describe how the debugger does it?  If I could compare the two, it might be easier to get a reliable code based solution.

    Thanks,

    Dan

  • Hi Dan,

    Fapi_initializeFlashBanks initializes Bank7 also, so EWAIT has to be configured.
    I am unable to reproduce the error which you are observing.
    I see this error (0x00004010 in FMSTAT) if I do not call Fapi_setActiveFlashBank function after initialization of the Flash banks. Can you check which Flash bank is active when you observe this error?

    Best Regards,
    Siddharth
  • Hi Siddharth,

    I think one of the primary issues I'm having is due to the lack of appropriate boot loader example code. I started out with the F021 API and poked around for what I thought was a similar boot loader (can't remember exactly which one I used now, might have been the a 520LS3x series). Since you have something that you are testing with that works, can you provide some code that uses the F021 calls to:

    1: erase sectors based on a begin/end address
    2: blank check (with ECC)
    3: program sectors based on a begin/end address (with ECC)
    4: and verify?

    Lacking that, can you identify a processor using F021 flash (as close as possible to the TMS520LC4357) that has a boot loader available I can start with to have better success?

    Thanks,
    Dan
  • Update: I found my problem - bad structure definition in the port. It works now as it did before. Sorry for the false alarm. I'm happy for the time being but I'd still be interested in getting an example boot loader for the TMS570LC4357 - I'm still not able to blank check or properly do ECC verification...

    Thanks,
    Dan