Part Number: TMS570LS3137
Hi team,
Issue: Erasing and burning flash BANK0 BANK1 BANK7 is failed with the driver code generated by HAL code and F021 library F021_API_CortexR4_be_L2FMC_V3D16.lib. But according to routines written in official documentation, the program shows that the erase and burn-out was successful, the customer would like to know what's the reason for that? (Note : Chip OSC16M, HCLK:180M)

The code is as follows:
/* @brief Erase the block
* @param[in] oNewFlashBank:Block number
*
* return:
*/
enum e_flash_status Flash_EraseBanks(Fapi_FlashBankType oNewFlashBank)
{
int num = 0;
Fapi_StatusType oReturnCheck = Fapi_Status_Success;
num = find_sector(oNewFlashBank, 0);
oReturnCheck = Fapi_initializeFlashBanks(180); //Initialize Flash Bank for API operations
if((oReturnCheck == Fapi_Status_Success) && (FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY != Fapi_Status_FsmBusy))
{
oReturnCheck = Fapi_setActiveFlashBank(oNewFlashBank); //Set up the active Flash Bank
if( (oNewFlashBank == Fapi_FlashBank0) || (oNewFlashBank == Fapi_FlashBank1) )
oReturnCheck = Fapi_enableMainBankSectors( 0xffffffff ); //Sets the available sectors in the EEPROM memory for erase and programming
else if( oNewFlashBank == Fapi_FlashBank7 )
oReturnCheck = Fapi_enableEepromBankSectors(0xffffffff, 0xffffffff); //Sets the available sectors in the EEPROM memory for erase and programming
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
Fapi_issueAsyncCommandWithAddress(Fapi_EraseBank, gSector_List[num].low_addr); //Issue a command to the Flash state machine
/* Place specific example code here */
/* Wait for FSM to finish */
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
/* Check the FSM Status to see if there were no errors */
if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
{
/* Put Error handling code here */
return flash_failure;
}
}
return flash_succeed;
}
/* @brief Writes sector data
* @param[in] oNewFlashBank:Block number
* @param[in] sector:Sector number
* @param[in] offset:Sector offset address
* @param[in] buff:Data
* @param[in] len:Data length
*
* return:
*/
enum e_flash_status Flash_WriteData(Fapi_FlashBankType oNewFlashBank, uint32_t sector, uint32_t offset, uint8_t * buff, uint32_t len)
{
int num = 0;
Fapi_StatusType oReturnCheck = Fapi_Status_Success;
num = find_sector(oNewFlashBank, sector);
//If the case size is larger than the sector size
if( (offset+len) > gSector_List[num].size )
{
return flash_failure;
}
oReturnCheck = Fapi_initializeFlashBanks(180); //Initialize Flash Bank for API operations
if((oReturnCheck == Fapi_Status_Success) && (FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY != Fapi_Status_FsmBusy))
{
oReturnCheck = Fapi_setActiveFlashBank(oNewFlashBank); //Set up the active Flash Bank
if( (oNewFlashBank == Fapi_FlashBank0) || (oNewFlashBank == Fapi_FlashBank1) )
oReturnCheck = Fapi_enableMainBankSectors( 0xffffffff ); //Sets the available sectors in the EEPROM memory for erase and programming
else if( oNewFlashBank == Fapi_FlashBank7 )
oReturnCheck = Fapi_enableEepromBankSectors(0xffffffff ,0xffffffff); //Sets the available sectors in the EEPROM memory for erase and programming
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
Fapi_issueProgrammingCommand(gSector_List[num].low_addr+offset, buff, len, 0, 0, Fapi_DataOnly); //Sets data and sends program commands to a valid flash address
/* Place specific example code here */
/* Wait for FSM to finish */
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.BUSY == Fapi_Status_FsmBusy);
/* Check the FSM Status to see if there were no errors */
if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
{
/* Put Error handling code here */
return flash_failure;
}
}
return flash_succeed;
}
Could you help check this case? Thanks.
Best Regards,
Cherry