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 everyone,
I am trying to erase one sector after a CAN message has been received on the F28379D micro. However, the Fapi_issueAsyncCommandWithAddress function does not erase anything.
Here is a sample of my code that I use in order to erase the sector (sectorAddr variable is a uint32_t) :
SeizeFlashPump(); // Disable ECC so that error is not generated when reading Flash contents // without ECC Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0; // Wait until the operation is over while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady) {} puSectorAddr = (uint32 *)sectorAddr; //Set the FSM to erase the sector status = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, puSectorAddr); // Wait until the erase operation is over while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady) {} // Read FMSTAT register contents to know the status of FSM // after erase command to see if there are any erase operation // related errors flashStatus = Fapi_getFsmStatus(); if (flashStatus != 0) { //error on erase status = Fapi_Error_Fail; }
After this, I am using the Fapi_doBlankCheck to confirm the erase and nothing happened (it returned that the first 32 bit address which is checked is not at 0xFFFFFFFF)..
I am using the F021 API v1.54, on CCS 8.2.0.00007.
Thank you in advance,
Best regards
Hi,
What is the value of puSectorAddr?
Did you call Fapi_initializeAPI and Fapi_setActiveFlashBank before making the call to Fapi_issueAsyncCommandWithAddress
Could you please refer below example to check if you have missed anything.
\C2000Ware_2_00_00_02\device_support\f2837xd\examples\dual\flash_programming
Thanks,
Katta
Hi,
First of all thank you for your feedback.
I already referred to this project without noticing any differences with mine for the sector erase operation. The write operation is working perfectly fine.
Regards
Alexis,
1) Please check whether you called EALLOW or not before calling the Flash API functions.
2) What is the value of FMSTAT after the erase?
3) Do you have any DCSM settings programmed?
Also, please search for "What are the common debug tips that we can consider when Flash API fails to erase or program?" in the Flash API wiki at http://processors.wiki.ti.com/index.php/C2000_Flash_FAQ#Flash_API_wiki
Thanks and regards,
Vamsi
Vamsi,
1) EALLOW is called just before the SeizeFlashPump() operation presented previously.
2) At the first try, the FMSTAT is 0, so nothing is indicating me that an error occurs except the doBlankCheck call. I decided to retry the erase by re-sending the CAN command but then I had a 48 value (16 : Command Status || 32 : Invalid Data) but it doesn't explain the first failure.
3) No password are set for this debug session. Here is my registers values :
Alexis,
SeizeFlashPump() executes EDIS before returning.
Hence, you need EALLOW again after that.
Please try including EALLOW.
Thanks and regards,
Vamsi
Vamsi,
it was the EDIS instruction of the SeizeFlashPump function.
Thank you and Katta for your help.
Regards,