AnsweredAssumed Answered

KM34Z256 flash erase sector problem

Question asked by wulin weng on Sep 8, 2016
Latest reply on Sep 14, 2016 by Martin Mienkina

Dear support:

 

as I used the function below to erase sector 2K for KM34Z256VLQ7 in TWR-KM34Z75M development board, from the memory watch I can't find the flash is erased sucessfully. Can you provide some information for me?

thank you.

#if defined (__ICCARM__)
  __ramfunc void _FTFA_EraseSector (const void *pDst)
#elif defined(__GNUC__) || defined(__CC_ARM)
            void _FTFA_EraseSector (const void *pDst)
#endif
{
  if ((FTFA_FSTAT & FTFA_FSTAT_FPVIOL_MASK) ||
      (FTFA_FSTAT & FTFA_FSTAT_ACCERR_MASK)) { FTFA_FSTAT |= 0x30; }
  FTFA_FCCOB0 = 0x09;
  FTFA_FCCOB1 = (uint8)((uint32)pDst>> 16);
  FTFA_FCCOB2 = (uint8)((uint32)pDst>>  8);
  FTFA_FCCOB3 = (uint8)((uint32)pDst>>  0);
  FTFA_FSTAT |= FTFA_FSTAT_CCIF_MASK;
  while (!(FTFA_FSTAT & FTFA_FSTAT_CCIF_MASK));
}

Outcomes