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.

TMS570LC4357: TMS570 bootloader failure spna192

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software:

I have a CCS project built based on application note spna192.  I get a file-erase error when attempting to run the application.  Oddly, the application loads and runs peroperly, but it is unable to erase flash. I tried erasing the flash using "all sectors" in the project properties but see non-FFFFFFFF addresses throughout the remaining  flash address space.  This behaves in a similar fashion on a known good Launchpad and a production board.  I suspect that I have a configuration error that is causing this problem.  I tried invalidating the icashe and calling Fapi_flushPipeline() with no success.

e.g. FFFF    FFFF    FF7F    FFFF    FFFF    FFFF    FFFF    FFFF    FFCB    FEFF    FFFF    FFFF    FFFF
FFFF    FFBF    FFFF    FFBE    FBFF    FFFF    FFFF    FFFF    FFFF    FFDF    FFFF    FFFF    FFFF
FFFE    FFFF    FF5F    7FFF    FFFF    FFFF    FF7B    EFFF    FFFF    FFFF    FFFF    FFFF    FFF7
FFFF    FFFF    FFFF    FFFB    FFFF    FFB7    DFFF    FFFF    FFFF    BFFF    FFEF    FFB6    D9FF
FFFF    FFFF    FFFF    FFFF    FFF6    FDFF    FFFF    FFEF    FFFF    FFFF    FF7F    FFFF    FFB7
DFFF

Any help is appreciated.

uint32_t Fapi_BlockErase( uint32_t ulAddr, uint32_t Size)
{
   uint8_t i=0U;
   uint8_t ucStartBank;
   uint8_t ucEndBank;
   uint8_t ucStartSector;
   uint8_t ucEndSector;
   uint32_t EndAddr;
   uint32_t status;

#if 1
   EndAddr = ulAddr + Size;
   for(i = 0; i < NUMBEROFSECTORS; i++)
   {
      if((ulAddr >= (uint32_t)(flash_sector[i].start)) && (ulAddr < ((uint32_t)flash_sector[i].start + flash_sector[i].length)))
      {
       ucStartBank = flash_sector[i].bankNumber;
         ucStartSector = i;
         break;
      }
   }
   for(i = ucStartSector; i < NUMBEROFSECTORS; i++)
   {
      if(EndAddr <= (((uint32_t)flash_sector[i].start) + flash_sector[i].length))
      {
       ucEndBank = flash_sector[i].bankNumber;
         ucEndSector = i;
         break;
      }
   }

   //API Rev2.01
   status = Fapi_initializeFlashBanks((uint32_t)SYS_CLK_FREQ);
   if(status == Fapi_Status_Success)
   {
      status = Fapi_enableAutoEccCalculation();

      for(i = ucStartBank; i < (ucEndBank + 1); i++)
      {
         if(status != Fapi_Status_Success)
         {
            break;
         }
         status = Fapi_setActiveFlashBank((Fapi_FlashBankType)i);
         if(status != Fapi_Status_Success)
         {
            break;
         }
         //API Rev2.01
         status = Fapi_enableMainBankSectors(0xFFFF);
         if(status != Fapi_Status_Success)
         {
            break;
         }
         while(FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady);
      }

      for(i=ucStartSector; i<(ucEndSector+1); i++)
      {
         Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, flash_sector[i].start);
         if(status != Fapi_Status_Success)
         {
            break;
         }
         while(FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy);
         while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
      }

   }
   status |= Flash_Erase_Check( ulAddr, Size);
   return (status);
}


uint32_t Flash_Erase_Check(uint32_t Start_Address, uint32_t Bytes)
{
   uint32_t error = ERASE_NO_ERR;
   register uint32_t *dst1 = (uint32_t *) Start_Address;
   register uint32_t bytes = Bytes;

   _iCacheInvalidate_();
   Fapi_flushPipeline(); /* flush cache */

   while(bytes > 0U)
   {
      if(*dst1++ != 0xFFFFFFFFU)
      {
         error = ERASE_ERR;
         break;
      }
      bytes -= 0x4U;
   }
   return error;
}