Hi
I am working on RA2E1. When I am storing any data to flash data memory, that data is getting retained but when I apply power cycle at a very fat rate i.e. within 1 second a power cycle is done then it is observed that the data gets erased.
Any suggestions to overcome this issue?
Regards
Sudhanshu
Hi Sudhanshu. VEE is simply an easy way to maintain data in data flash. You can't treat a data flash "variable" like a RAM variable. If you want to update data, you have to erase the entire data block…
The dataflash on the RA2E1 is disabled at power on, it isn't enabled until this point in the startup code :-
How can this create the issue which I am facing?
After power cycling the RA2E1 device, at which point in the exectuion of the code do you check the data flash? If you look at the data flash content in the debugger before the code has executed to enable the data flash, you will not see the the data you expect.
Within the main function, First I initialize my flash driver thereafter I read the data I stored in my data block.
Also if I add some time between two power cycles let's say 1 power cycle at every 5 seconds then data stays intact.
Without an FSP project and a detailed description of how to recreate the issue you are seeing, it is very difficult to say what is going on.
Okay. I'll attach the relevant files
Flash.zip
I have attached the code snippet for my flash handling.
I maintain two copies of my data, at every power-up, I read the data and when any data needs to be modified I modify my data and write the same into my two data blocks.
When the time between two power cycles is less than 1 second( approx) I lose my data, but with 5 seconds it works fine.
You have provided a single .c file, not an FSP project. If you remove the power before the flash operation has completed (Erase and Write), then the Data flash contents will be not as exepcted. How do you judge the flash operation has completed before removing the power?
FlashRA2E1.zip
This is my FSP project.
If you remove the power before the flash operation has completed (Erase and Write), then the Data flash contents will be not as exepcted. How do you judge the flash operation has completed, and that it is safe to remove the power?