AnsweredAssumed Answered

Processor Expert and erasing flash

Question asked by Philip Smit on Aug 26, 2014
Latest reply on Sep 9, 2014 by ZhangJennie

Hi all,


I'm using Processor Expert with  CW 10.4 on a MCF51QU32VFM (coldfire+).  I'm trying to write data to the internal flash. I've inserted a flash component using Processor Expert and defined a 1KB flash space at 0x200000 (where the DFlash starts). I copied the functions from the demo projects packaged with CW to erase, read and write to the flash. The following events methods have been defined in Events.c:

void FLASH1_OnOperationComplete(LDD_TUserData *UserDataPtr)


  uint8_t *OpStatus = (LDD_TUserData*) UserDataPtr;

  *OpStatus = TRUE;



void FLASH1_OnError(LDD_TUserData *UserDataPtr)




In my main function I first try to erase the 1KB of flash by calling the following function:

bool EraseFlash(LDD_TDeviceData *DeviceData, LDD_FLASH_TAddress FromAddress, LDD_FLASH_TDataSize Size, uint8_t* OpStatus)


  LDD_TError Error;

  int i = 0;

  *OpStatus = FALSE;

  Error = FLASH1_Erase(DeviceData, FromAddress, Size);

  if (Error) {

    return FALSE;


  while(*OpStatus != TRUE);  

  return TRUE;



When FLASH1_Erase(..) is called in the above function, the FLASH1_OnError(..) event is triggered although  FLASH1_Erase(..) returns with no error. FLASH1_OnOperationComplete(.. ) is never triggered, so EraseFlash(..) is stuck in an infinite loop at while(*OpStatus != TRUE).


Any help will be appreciated.