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.

TMS320F28035: Flash Erase Failing through API for F2803x

Part Number: TMS320F28035
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Hi,

We are facing the issue with Flash API for 2803x taken from control suite example. While giving the command erase Flash, flash does not get erased 1st time. After running the same code from starting only it gets erased. 

For eg: Case1: If there is hex file X(program consisting of flash erase, write,verify and application level code): we try to run it 1st time, flash does not get erased. Same file we try to 2nd time only flash get erased.

Case 2: If we change something in application level code, let's say hex file now is y: we try to run it 1st time, flash does not get erased. Same file we try to 2nd time only flash get erased.

We are suspecting issues in initialization, hence i am putting initialization function below:

void InitFlash(void)
{
EALLOW;

FlashRegs.FOPT.bit.ENPIPE = 1; //Enable Flash Pipeline mode to improve performance of code executed from Flash.

/***********************************************************************************************************************************************************************************
CAUTION : Minimum wait states required for the flash operating at a given CPU rate must be characterized by TI. Refer to the datasheet for the latest information.
************************************************************************************************************************************************************************************/

FlashRegs.FBANKWAIT.bit.PAGEWAIT = 2; //Set the Paged Wait state for the Flash
FlashRegs.FBANKWAIT.bit.RANDWAIT = 2; //Set the Random Wait state for the Flash
FlashRegs.FOTPWAIT.bit.OTPWAIT = 3; //Set the Wait state for the OTP
FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF; //CAUTION: ONLY THE DEFAULT VALUE FOR THESE 2 REGISTERS SHOULD BE USED
FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF; //Force a pipeline flush to ensure that the write to the last register configured occurs before returning.
EDIS;

__asm(" RPT #7 || NOP");
}

Function calls are as below:

 Status = Flash_Erase((block_ID_u8),&FlashStatus);

 Status_E = Flash_Program(Flash_ptr,(Uint16 *)Buffer,2,&FlashStatus);

 Status_C = Flash_Verify(Flash_ptr,(Uint16 *)Buffer,2,&FlashStatus);

Requesting to support for the same