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.

TMS320F28388D: Flash Erase

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hi, 

I using F28388D controller, i am facing a strange behaviour.

I am running a individual scheduler of  500 micro sec, i am able to copy the data into the FLASH Sector 7,8,9 . but when i try to erase the sector 13 for CPU1 it does not happen i have a watchdog refresh at 10ms, but the same functionality works fine in CPU2 i can erase the sector 13. not understanding the difference in behaviour in 2 different CPUs

steps followed to erase the sector:

Flash_claimPumpSemaphore(FLASH_CPU1_WRAPPER);

Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS,CPU_FREQUENCY_MHZ);

Fapi_setActiveFlashBank(Fapi_FlashBank0);

Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,0xBE000);

while (FdFlashOperationStatus() != Fapi_Status_FsmReady){}

FdFlashEraseVerify(0xBE000);

gstrCpu1IpcRegs.PUMPREQUEST.all = FLASH_PUMP_KEY (0x5A5A0000UL)

The macros used is provided below

typedef enum
{
FLASH_CPU1_WRAPPER = 0x2, //!< CPU1 Wrapper
FLASH_CPU2_WRAPPER = 0x1 //!< CPU2 Wrapper
}Flash_PumpOwnership;

//Define to map the direct access to the FMC registers
#define F021_CPU0_REGISTER_ADDRESS 0x0005F800

//Define to map the direct access to the FMC registers.
#define F021_CPU0_BASE_ADDRESS ((Fapi_FmcRegistersType *)F021_CPU0_REGISTER_ADDRESS)

#define CPU_FREQUENCY_MHZ 200

the same is followed every time erase is called . What could be the problem for this any pointers to check

Thanks,

Nagesh

  • Nagesh,

    What do you mean by watchdog refresh?  Does it mean to service watchdog every 10ms?  That is not an issue as long as you are not executing that watchdog refresh code from the flash bank on which the current erase operation is in progress.

    As mentioned in the datasheet, the erase time of a sector is more than 10ms - hence you should not disturb (no access is allowed) the bank during the erase operation.  The erase time can vary from sector to sector (or bank to bank) and hence is the difference you see between the two.  

    A general comment: Hope you are checking for the return values from the flash API functions.  I don't see that in the snapshot that you copied above.  Also, I don't see you checking for the FMSTAT value after the erase - you should check it.

    Thanks and regards,
    Vamsi

  • Hi Vamsi, 

    This same set of code works fine when i disable the external watchdog of 10ms also when connected to CCS. will check the FMSTAT register value in connected mode which works file but will get the register value.

    The sector which is being erased does not have any code placed in it.

    thanks,

    Nagesh

  • Hi Vamsi, 

    I did a quick check on the FMSTAT register in connected mode it is holding zero.

    can i poll to erase for the flash sector 13 till the FMSTAT register is zero ?

    because in unconnected mode i will not be able to check the FMSTAT register.

    thanks,

    Nagesh

  • Nagesh,

    As mentioned in the flash API guide, flash API wiki and as shown in the flash API usage example in C2000Ware:

    1) After you issue an erase command, you have to wait until the command is completed.  See below highlighted - you can poll for the flash operation to complete by using Fapi_checkFsmForReady().

    2) Also, After the flash operation is over, you should check for the FMSTAT value using Fapi_getFsmStatus().  See above.  If that is not zero, then you should consider the erase operation as failure.

    If you access the flash bank when the erase is in progress or if you generate a reset (via external watchdog) to stop the ongoing erase, then the erase operation will fail.  It does not matter whether there is any code or data in the sector in which you are erasing - there should not be any access to the flash bank when erase or program is in progress.  Also, there should not be a power loss or reset scenario.

    Thanks and regards,
    Vamsi

  • Nagesh,

    Do you have any update on this?  Can I consider this as closed?

    Thanks and regards,
    Vamsi