RTC resetting whenever power to the MCU is lost on R7FA6E10F2CFP

I am having an issue with the RTC. When I lose power the RTC resets every time. I use the 'g_rtc0.p_api->open(g_rtc0.p_ctrl, g_rtc0.p_cfg);' API, but I am still not able to retain the correct date and time. 

Parents
  • Hello,

    Thanks for reaching out Renesas Engineering Community!

    After reset occurs you should initialize RTC with open() function as you do but you should also call  this API:

    fsp_err_t 	R_RTC_CalendarTimeSet (rtc_ctrl_t *const p_ctrl, rtc_time_t *const p_time)

    In order to set parameters like year, day month. Also something else that you could do is to save the current date in a block of data flash in order to read the memory addresses  and keep the last date that reset occurred.

    Find here attached an example of how to do that. In this example I have configured RTC timer ,initialized it , set CallendarTime and also have a timer which is configured to get the current date and save it to data flash every second.

    Please notice that this example is for RA6M3 since I did not have available RA6E1. So you should also check the memory map for the data flash of RAE1.

    Hope it helps!

    Best Regards,

    IK

    rtc_keep_date.zip 

Reply
  • Hello,

    Thanks for reaching out Renesas Engineering Community!

    After reset occurs you should initialize RTC with open() function as you do but you should also call  this API:

    fsp_err_t 	R_RTC_CalendarTimeSet (rtc_ctrl_t *const p_ctrl, rtc_time_t *const p_time)

    In order to set parameters like year, day month. Also something else that you could do is to save the current date in a block of data flash in order to read the memory addresses  and keep the last date that reset occurred.

    Find here attached an example of how to do that. In this example I have configured RTC timer ,initialized it , set CallendarTime and also have a timer which is configured to get the current date and save it to data flash every second.

    Please notice that this example is for RA6M3 since I did not have available RA6E1. So you should also check the memory map for the data flash of RAE1.

    Hope it helps!

    Best Regards,

    IK

    rtc_keep_date.zip 

Children