Hi Renesas team,
I am using rl78 r5f102aa microcontroller and its data flash to store some settings in it.
In my product I am using 3.7v battery backup (2400mah), when power interruption happens, the mcu should run with battery backup.
Now, the problem is, the stored settings in data flash is erasing sometimes. I thought the issue is because of the writing/reading happens during battery powered. So I stopped memory operations during power interruption (battery time). Still the same issue observed.
Now, I started writing the settings in two different banks in data flash as extra data backup. I am not sure whether it will resolve the issue.
I want to know the reason for erasing and if the erase happens, will it erase complete data flash (second block) too, which I am using as extra second back up.
In reply to Sai:
In reply to manju:
The data-flash cannot be erased without initiating a self-programming operation on the block. Are you using the Tiny / T02 EEL or just FDL in your code? EEL is designed to be reset resistant and implement wear-leveling. If using only FDL you must implement your own strategy for both concepts to maintain data integrity.
Do you have the documentation for the Renesas FDL and the EEL?
The users manual for the FDL shows examples of how to use the FDL, I don't understand why you would be executing fixed timing delays, when the library can notify you of the completion of the operation. For some reason, I don't see the RL78/G12 flash programming times specified in the documentation. But for other devices which use the same flash process, a block erase operation takes 5ms while a write operation takes 10us.
Example code for the T02/Tiny FDL can be found in section 4.7 of the FDL U/M R01US0061ED. The library can be polled for busy status, calling the handler while busy.
Note that the RL78 data-flash is not like byte-erasable EEPROM. The erase block size is 1KB while a write unit is 1-byte. The EEPROM Emulation Library (EEL) uses an approach to implement wear-leveling by performing multiple write operations in a single block, before an erase operation is required. Reset resistance means that a specific flow is used to ensure the data integrity (e.g. a start marker is first written, followed by the data, followed by an end marker). Reset resistance also ensures that data is not lost during a block erase operation by duplicating the data in another block before the erase operation is done (Renesas EEL refers to this concept as a "refresh" operation).
Please refer to the T02/Tiny EEL U/M for more information on the wear-leveling techniques and reset resistant features of the Renesas EEL.
I would not generally recommend that a user implement their own EEPROM emulation unless they are a very experienced programmer. If your application has the memory resources available to use the Renesas EEL I would highly recommend that you consider using this off the shelf library.
Can you please elaborate on the statement, "But in FDL library, there is no abort API."? If you are using the "Tiny" / T02 FDL this command exists. Or are you using the "Pico" / T04 FDL type? The Pico FDL does not support the abort command.
Please refer to the Data Flash Access LibraryType T04 (Pico), European Release for the Pico / T04 FDL U/M.
Perhaps your battery is not able to sustain the power required to perform the erase operation? If the abort needs to be supported you would have to use the Tiny / T02 FDL.