Flash Read/Write in RL78/G15

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!!!!!

Parents
  • 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/CX
    r01an1363  FDL-T04-G12 CA/CX

    r01an3024  FDL-T04-G12 CC

    r01an6458  FDL-T04-L12 CC

    r01an2827  FDL-T04-G13 CC

Reply
  • 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/CX
    r01an1363  FDL-T04-G12 CA/CX

    r01an3024  FDL-T04-G12 CC

    r01an6458  FDL-T04-L12 CC

    r01an2827  FDL-T04-G13 CC

Children