Hello Santiago
Thanks for your answer,
I am reading 158 bytes from location 0x7000 (Flash memory beyond the end of the code) and putting the data in RAM at 0x1ffff39c.
The project is a CW10.6 with Processor Expert and use the Component FLASH_LDD .
The operating temperature is around 20 degree Celsius, the power supply is stable and the environment is "electrically quiet" , as the boards are placed in the basement of private houses
An Extract of the code follows. the code regarding the FLASH_EEPROM is taken from the example in the documentation of Component FLASH_LDD - CW 10.6
Please let me know which other details are needed to figure out better the problem and consider that I can see the problem on some of the boards but not able until now to replicate in debug mode
Regards, Mauro
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
... from main, every ten minutes those functions are called in order to store information that persist in case the power goes off
EEPromError = EEPromWrite();
EEPromError = EEPromRead();
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// interrupt
void FLASH_EEPROM_OnOperationComplete(LDD_TUserData *UserDataPtr)
{
EEPromDataWrittenFlg = TRUE;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LDD_TError EEPromWrite()
{
EEPromDataWrittenFlg = FALSE;
EEPromError = FLASH_EEPROM_Write(MyFLASH_Ptr, (LDD_TData *)EEPromDataToStore.arrByte, MY_FLASH_LOCATION, sizeof(EEPromDataToStore)); /* Start writing to the flash memory */
if(EEPromError != ERR_OK)
return EEPromError;
while (!EEPromDataWrittenFlg) // the flag is set by the FLASH_EEPROM_OnOperationComplete interrupt
{
Bit_night_SetVal(NULL);
/* Wait until the data are written */
nTestAttesaWrite++;
Bit_night_ClrVal(NULL);
}
EEPromDataWrittenFlg = FALSE;
if (FLASH_EEPROM_GetOperationStatus(MyFLASH_Ptr) == LDD_FLASH_FAILED)
{ /* Check if the operation has successfully ended */
/* Error state solution */
return ERR_FAILED; /* Return ERR_FAILED */
}
Bit_night_ClrVal(NULL);
return ERR_OK; /* Return with no error */
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LDD_TError EEPromRead()
{
EEPromError = FLASH_EEPROM_Read(MyFLASH_Ptr, MY_FLASH_LOCATION, (LDD_TData *)EEPromDataRead.arrByte, sizeof(EEPromDataRead)); /* Start reading from the flash memory */
if(EEPromError != ERR_OK)
return EEPromError;
do
{
FLASH_EEPROM_Main(MyFLASH_Ptr);
EEPromOpStatus = FLASH_EEPROM_GetOperationStatus(MyFLASH_Ptr);
} while (!((EEPromOpStatus == LDD_FLASH_IDLE) | (EEPromOpStatus == LDD_FLASH_FAILED)));
if (EEPromOpStatus == LDD_FLASH_FAILED)
{ /* Check if the operation has successfully ended */
return ERR_FAILED; /* Return ERR_FAILED */
}
return ERR_OK; /* Return with no error */
}