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.
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
Hi Neetigya,
How are you testing this process and seeing that the flash_erase function is failing on the first attempt? Are you running this application standalone (from Flash) or from RAM and debugging? Are you checking the status register that the function returns?
Make sure you are copying the Flash_API functions used from Flash/ROM to RAM.
I'd suggest referencing the 'Flash2803x_API_Quickstart' in ControlSuite at the below directory for steps to debug this issue:
C:\ti\controlSUITE\libs\utilities\flash_api\2803x\v100a\doc
Best,
KEvin
Hi, we have segregated the sectors completely , we are trying to run the program from sector A,B,C,D and we are trying to erase Sectors E,F,G,H.
Hi Neetigya,
The Flash API cannot be run from flash. It needs to be copied to RAM first to successfully execute the functions.
The below is the guide in C2000ware if you're using that instead of ControlSUITE.
C:\ti\c2000\C2000Ware_2_00_00_02\libraries\flash_api\f2803x\docs\Flash2803x_API_Quickstart.pdf
Best,
Kevin
Hi Neetigya,
This illegal ISR is entered when the flash_erase function is run? Can you provide the section of your code for copying the functions into RAM? Also the respective section in your linker command file.
See below FAQ response for converting to a flash-based project:
https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/758797
What is the block_ID_u8 definition you have in your code? What does the 'Status' value from the Flash_erase function return below, if anything?
Status = Flash_Erase((block_ID_u8),&FlashStatus);
Best,
Kevin