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: Unable to erase Flash on TMS570LC4357

Part Number: TMS570LC4357

I am modifying the bootloader example for the TMS570LS31 to work on the TMS570LC4357 using ethernet communication. At the beginning Fapi functions are copied from Flash to RAM (LR register value is 0x8015637) but it get stuck to

while( FAPI_GET_FSM_STATUS != Fapi_Status_Success );

in Fapi_BlockErase. The FMSTAT register reads 0x0990.

I changed some constants values in Constants.h as below:

/* Specifies the bit mask for determining all address bits exclusive of the offest
imposed by the memory map register */
#define F021_PROGRAM_ADDRESS_MASK 0x07FFFFFFU

/* Specifies the Offset to the TI OTP */
#define F021_PROGRAM_TIOTP_OFFSET 0xF0080000U

/* FMC memory map defines */
#define F021_FLASH_MAP_BEGIN 0x00000000U
#define F021_FLASH_MAP_END 0x003FFFFFU /
#define F021_OTP_MAP_BEGIN 0xF0000000U 
#define F021_OTP_MAP_END 0xF000FFFFU 
#define F021_OTPECC_MAP_BEGIN 0xF0040000U 
#define F021_OTPECC_MAP_END 0xF0041FFFU
#define F021_EEPROMECC_MAP_BEGIN 0xF0100000U 
#define F021_EEPROMECC_MAP_END 0xF01FFFFFU
#define F021_EEPROM_MAP_BEGIN 0xF0200000U 
#define F021_EEPROM_MAP_END 0xF03FFFFFU 
#define F021_FLASHECC_MAP_BEGIN 0xF0400000U 
#define F021_FLASHECC_MAP_END 0xF05FFFFFU 

#define F021_CPU0_REGISTER_ADDRESS 0xFFF87000U

/* Specific TI OTP Offsets */
#define F021_TIOTP_PER_BANK_SIZE 0x2000U
#define F021_TIOTP_SETTINGS_BASE 0x150U
#define F021_TIOTP_BANK_SECTOR_OFFSET 0x158U

I'm not sure about F021_CPU0_REGISTER_ADDRESS define since I couldn't find this information on the datasheet.

Any help/suggestion is appreciated.

Regards

Valentina

  • Some additional info:

    I'm using the library "F021_API_CortexR4_BE_L2FMC.lib"

    Besides: FBSE value is 0xFFFF.

    In the following code I can see that Fapi_issueAsyncCommandWithAddress returns Fapi_Status_Success but then it get stuck in the second while:

    do{
    Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, eraseStartAddr);
    while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
    while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

    // remaining -= flash_sector[j++].length;
    remaining -= flash_sector[(bk*15)+(j++)].length;
    eraseStartAddr = flash_sector[j].start;

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

    I apologize for the delay in response. Somehow your questions fell through the cracks.

    First, can you check to see what the FAPI_GET_FSM_STATUS is returning? I am curious if it is returning anything related to invalid data or some other clue that might help us figure out what is happening.

    Second, one of the big differences between the TMS570LC4357 and the LS3137 is that the LC4357 has cache memory. This might be playing some games with code placement and execution. Can you try turning off the cache for execution within your boot code? This can be done with the MPU settings by setting as Write though, I believe.

    Finally, double check to make sure all of the necessary routines are being copied to RAM since if you are executing out of the same bank you are trying to program, it can be problematic.
  • Hello Chuck,
    first of all thanks for your reply. I'm really sorry for the late response.
    I ran some tests as you suggested and:
    - while stuck in the while, FAPI_GET_FSM_STATUS = 0x90
    - disabling the cache has no effect

    Do you have any suggestion about how to test if all the necessary routines have been copied to RAM?
    Thanks in advance.

    Regards,

    Valentina
  • Hello Valentina,

    At which sector your got stuck (start address)? Did you erase any sector successfully before the code got stuck?
    When you initialize the bank, the system clock frequency should be used. And the sector needs to be activated before erasing and programming.
  • Hello Mr Wang,

    thanks for your reply.

    I gor stuck at the first sector, so I don't get any sector erased successfully. My start address is 0x0008 0000

    The sector is activated before erasing and the system clock frequency is used I guess. I have:

       Freq_In_MHz = SYS_CLK_FREQ;

    Fapi_initializeFlashBanks(Freq_In_MHz);
    
    for (bk = ucStartBank; bk < ucEndBank+1; bk++){
    
        	Fapi_setActiveFlashBank((Fapi_FlashBankType)bk);
    
            Fapi_enableMainBankSectors(0xFFFF); 
    
            while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
    
            do{
    
            while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
    
            while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
    
    ...
    }

    Isn't it the function that activates the sectors?

    Thanks for your interest.

    Regards,

    Valentina

  • I'm sorry for my misuse of "Insert code" function.
  • Hello Valentina,

    The SYS_CLK_FREQ is defined in bl_config.h, please make sure it is the same value from your PLL setting (might be 300MHz).
  • Hello Mr Wang,

    SYS_CLK_FREQ is set to 150. I'm using the LaunchPad Development Kit LUANCHXL2-570LC43. Is that a wrong setting?

    Thanks for your help.

    Regards

    Valentina