FLASH COMPONENT CAN NOT MAKE UPDATES

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FLASH COMPONENT CAN NOT MAKE UPDATES

922 Views
marceli1
Contributor III

Hi,

I am using CW10.7 and trying selected flash memory update in with the new parameters, however it is not allowing me second and another time after first downloading the code. I am using MKL25Z64VHL4 chip.

I am trying to erase or write into user sector FC00 to able erase 1024 bytes but the unit stil staying in ERR_BUSY instead of Flash Idle because DeviceDataPrv->CurrentOperationStatus = 24.

Is this problem to access to memory address?

#define SETTINGS_FLASH_ADDR 0xFC00  /* Reserve memory for settings flash memory location the data will be written to */
#define ERASE_FLASH_SIZE    0X0400 // minimum size section to ERASE
// Save Data
void SaveData(void)
{
Error = FLASH1_Erase(DeviceDataPtr, SETTINGS_FLASH_ADDR, ERASE_FLASH_SIZE);
do // CHECK OPERATION STATUS
 {
     FLASH1_Main(MyFLASH_Ptr);
     OpStatus = FLASH1_GetOperationStatus(MyFLASH_Ptr);
 } while (!((OpStatus == LDD_FLASH_IDLE) | (OpStatus == LDD_FLASH_FAILED)));

  DataWrittenFlg = FALSE;

 if (OpStatus == LDD_FLASH_FAILED)
 { /* Check if the operation has successfully ended */
  /* Error state solution */
     UError = ERR_ERASE_FLASH_FAILED;
 }
 DisplayError();
......
}
Thank you for assistance.
Regards,
Marceli
0 Kudos
Reply
2 Replies

842 Views
marceli1
Contributor III

I have solved myself the problem using Demo FLASH example program. With small necessary changes to routines for checking OpStatus on the end:

bool WriteFlash(LDD_TDeviceData *DeviceData, LDD_TData* DataPtr, LDD_FLASH_TAddress FromAddress, LDD_FLASH_TDataSize Size, uint8_t* OpStatus)
{
  *OpStatus = FALSE;
  Error = FLASH1_Write(DeviceData, DataPtr, FromAddress, Size);
  if (Error) {
    return FALSE;
  }
  *OpStatus = FLASH1_GetOperationStatus(DeviceData);
  while(*OpStatus != LDD_FLASH_IDLE); /* Wait while operation done */
  return TRUE;
}
bool EraseFlash(LDD_TDeviceData *DeviceData, LDD_FLASH_TAddress FromAddress, LDD_FLASH_TDataSize Size, uint8_t* OpStatus)
{
  *OpStatus = FALSE;
  Error = FLASH1_Erase(DeviceData, FromAddress, Size);
  if (Error) {
    return FALSE;
  }
  *OpStatus = FLASH1_GetOperationStatus(DeviceData);
  while(*OpStatus != LDD_FLASH_IDLE); /* Wait while operation done */
  return TRUE;
}
0 Kudos
Reply

842 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Marceli,

Thanks for your sharing .

Have a nice day,

Alice

0 Kudos
Reply