Part Number: TMS320F280034
Other Parts Discussed in Thread: UNIFLASH
Tool/software:
Hi expert,
My customer use the bootloader to upgrade some application software, then reset MCU to erase sector. There is a sector checking error after erasing. Please see the figure below, The problem caused the field equipment 1-2% failure rate.

He also did some test:
1. Read out part of the APP program, turn off ECC function in UniFlash. He can write to the corresponding sector by UniFlash, In this case, using bootloader emulation, there was an error when erasing the APP sector;
Error function location: Fapi_doBlankCheck ();
2. Turn on ECC function in UniFlash, write some APP program to the appropriate sector through UniFlash, restart the chip, then he can erase normally.
3. Write APP in bootloader using Fapi_AutoEccGeneration mode.
Both erase and write functions are handled using TI recommended functions; function prototypes are as follows. Please help check the root cause, thank you.
#pragma CODE_SECTION(Flash_EraseSector, ".TI.ramfunc");
static bool Flash_EraseSector(uint32_t SectorAddr)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,(uint32 *)SectorAddr);
while( Fapi_checkFsmForReady() != Fapi_Status_FsmReady );
if( oReturnCheck != Fapi_Status_Success )
{
return FALSE;
}
oFlashStatus = Fapi_getFsmStatus();
if( oFlashStatus != 0 )
{
return FALSE;
}
oReturnCheck = Fapi_doBlankCheck((uint32 *)SectorAddr,PAGE_SIZE,&oFlashStatusWord);
if( oReturnCheck != Fapi_Status_Success )
{
return FALSE;
}
return TRUE;
}
#pragma CODE_SECTION(Flash_ProgramU64, ".TI.ramfunc");
static bool Flash_ProgramU64(uint32 Address, uint64 Data)
{
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)Address,(uint16*)&Data,4,0,0,Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
if(oReturnCheck != Fapi_Status_Success)
{
return FALSE;
}
oFlashStatus = Fapi_getFsmStatus();
if(oFlashStatus != 0)
{
return FALSE;
}
oReturnCheck = Fapi_doVerify((uint32 *)Address, 2, (uint32 *)&Data, &oFlashStatusWord);
if( oReturnCheck != Fapi_Status_Success )
{
return FALSE;
}
return TRUE;
}
