Hello Team,
I am trying to write a data in Flash Memory of RL78/G15 (Memory address 0x9000 to .... ).The correct approach would be to enable the flash memory first and then write. Then will read the location to confirm the written data. And then disable the Flash memory again to avoid any unnecessary writing. Please correct me if I am wrong.
Now the problem I am facing is I am not able to write the data , nor verify it.Please suggest, open to both approaches - using APIs or baremetal coding.I tried this but not getting proper results. I have tried a sample code & APIs available on E2 studio.
#include "r_smc_entry.h"
//#include "sample_control_data_flash.h"
#include "../src/DF_sample/common/include/sample_control_data_flash.h"
int main (void);
extern int sample_dataflash_main(void);
uint8_t t ;
uint8_t tmp[1] = {"B"};
uint8_t read_from_data_flash(uint16_t address)
{
// Access the data flash at the given address
uint8_t data = *(volatile uint8_t*)address; // Dereferencing the memory address directly
return data;
}
int main(void)
EI();
sample_dataflash_main();
Sample_DataFlashControl(0x9000, 1, &tmp[0]);
t = read_from_data_flash(9000);
while(1)
Happy New Year All!!!!!
You should use the "Verify" function after the write to flash to ensure proper programming.
Sample code for the pFDL is available if you search the Renesas web site for the following documents:
r01an1362 FDL-T04-G13 CA/CXr01an1363 FDL-T04-G12 CA/CX
r01an3024 FDL-T04-G12 CC
r01an6458 FDL-T04-L12 CC
r01an2827 FDL-T04-G13 CC
Hello JimThanks for providing the info.I am using the Renesas provided PFDL sample code only.But the code is giving me the same error, made no changes, properly installed the library.And got the error.Since my program is not going in debug mode, I don't think using "verify" instruction will help.How can I make/force my program to locate those pfdl functions?
Hello,
Data Flash Library T04 does not support G15 device.
You need to use the Renesas Flash Sample Program Type 01 which is imported from the Smart Configurator:
Please check the flash library documentation and sample code:
www.renesas.com/.../search
As mentioned, the G15 and G16 devices are not supported by the FDL T04 type, although they are named G1x they are considered 2nd generation (one would logically think they would be named G2x) and requires the RFD which is provided as source.
Apologies for the confusion.
Thanks AZ and Jim I am able to write in flash memory using the sample codes