Hi Lukas,
Thank your answer.
I still have some ambiguities:
If a program operation at address X is terminated by unexpected reset/power down, at the next power on I will get an exception if the address X is accessed (R or W access).
In that case what shall I do to resume a normal operating :
- May I still able to read form the sector that contains the corrupted address or the whole sector is condemned ?
- I have to erase that sector or I have just to repeat the interrupted program operation (as it is written in the MPC560xB Manual).
- Once I have the exception is there a way to know if it is caused by a program or erase operation unexpected termination ?
In the Manual it is written the following :
"If during a Modify Operation a reset occurs, the operation is suddenly terminated and the Macrocell is reset
to Read Mode. The data integrity of the flash memory section where the Modify Operation has been
terminated is not guaranteed: the interrupted flash memory Modify Operation must be repeated."
I have another question please :
If I have the following scenario :
An erase operation is terminated by unexpected reset/power down --> At the next power on, I want to perform a write operation at the corrupted sector --> An exception will be generated.
When I want to perform an erase sector to correct this error, the operation fails and returns BUSY because MCR_PGM flag is still set.
In order to avoid that, I am hesitating between two solutions :
- Read access to all my flash memory at the start-up and perform erase operation if an exception is generated.
- Reset MCR flags at the exception callback to be able to perform an erase operation.
Is there any other way to avoid that ?
Regards,
Malek.