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.

Can't consecutive erase Flash sector in F28M35

Other Parts Discussed in Thread: CONTROLSUITE


I add the following section of code in the Example_CallFlashAPI(), file location: C:\ti\controlSUITE\device_support\f28m35x\v207\F28M35x_examples_Dual\flash_prog\m3\flash_programming_m3.c , found that can not be continuous erase sector, sometimes can consecutive erase two or three sectors, sometimes not, always in the Fapi_doBlankCheck fail, reference to the two replies on the e2e link:
e2e.ti.com/.../1233117

e2e.ti.com/.../1204541

Add *(int *)0x400FA160 = 0xC12F59A0 and Fapi_setupBankSectorEnable() in code:

*(int *)0x400FA160 = 0xC12F59A0;
FlashInit();

oLibInfo = Fapi_getLibraryInfo();
Fapi_setupBankSectorEnable();

but, and do not add the same, can not do continuous erase sector, add the code as follows:

uint32 sectorstart,num;

uint32 sectorlength;
sectorstart=0x00208000;
sectorlength=0;
for(num=2;num<oFlashBankSectors.u32NumberOfSectors;num++)
{
if(num>0)
{
sectorstart=sectorstart+sectorlength;
}
else
{sectorstart=oFlashBankSectors.u32BankStartAddress;}
sectorlength=((uint32)oFlashBankSectors.au8SectorSizes[num])*2048;
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
(uint32 *)sectorstart);
// Wait until FSM is done with erase sector operation
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}

oReturnCheck = Fapi_doBlankCheck((uint32 *)sectorstart,
sectorlength,
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
//Example_Error(oReturnCheck);
}
}

Please help me to solve this problem, why not  continuous erase sector?

  • Devin,

    When you call Fapi_doBlankCheck() function, the length of the sector should be passed in 32bit words and not in bytes.  

    Divide the 'sectorlength' by 4 as shown below:

    oReturnCheck = Fapi_doBlankCheck((uint32 *)sectorstart, sectorlength/4, &oFlashStatusWord);

    Regarding the Fapi_setupBankSectorEnable():  You don't have to add this function after Fapi_getLibraryInfo() in your code.  It should already be there in the Fapi_UserDefinedFunctions.c file that we provided with the example.  You should not edit the contents of this function.

    Regarding the *(int *)0x400FA160 = 0xC12F59A0 that you saw in the other forum post:  This is to initialize the SECZONEREQUEST register.  The SECZONEREQUEST semaphore register (mapped at address 0x400FA160) is provided to control the access of the flash registers by the two M3 security zones with out compromising on security.  You don't need it unless you locked your ZoneX (either Zone1 or Zone2) and would like to perform ZoneX Flash erase/program operations in the locked state with the code running from ZoneX RAM.  You would write a value of 01b or 10b in the SEM field of this register (along with the key) depending on the Zone from which you want to do Flash operations.  See SECZONEREQUEST Register description in TRM at www.ti.com/.../spruh22g.pdf for more details.      

    Thanks and regards,
    Vamsi