My device is battery powered and I found in my testing that a reset also causes the system time to be reset, is there any solution to keep the system time on reset?
Solved! Go to Solution.
I do not have test code, I just tested it using a debugger. All I did - I selected SIRC clock (I do not have a board with XOSC here right now) and I enabled the RTC by CNTEN. Then I can see that the counter is running in RTCCNT:
Then I generated SW functional reset - also by debugger. I set FUNC_RST in MODE_CONF register, then I set MODE_UPD bit in MODE_UPD register and finally I wrote keys to CTL_KEY register. The MCU was reset, I reconnected debugger (hot attach without reset) and I saw that the RTC is still configured and running.
Regards,
Lukas
Hi Lukas,
Thank you for your reply, we use SXOSC crystal.
Regards,
liangyouchao
Please give me more time, I can see that on my side too, I need to clarify this with AE team.I will let you know later.
Regards,
Lukas
Well, my problem was that I used external reset for test. But external reset is destructive reset. RTC keeps running only during functional resets. If I used software functional reset, for example, it's working as expected.
Which reset did you use?
Regards,
Lukas
We will use both functional reset and external reset, the reset reset is an external watchdog chip, if the external reset is not holdable, we can also accept this case, can you share the test code with me?
Regards,
liangyouchao
I do not have test code, I just tested it using a debugger. All I did - I selected SIRC clock (I do not have a board with XOSC here right now) and I enabled the RTC by CNTEN. Then I can see that the counter is running in RTCCNT:
Then I generated SW functional reset - also by debugger. I set FUNC_RST in MODE_CONF register, then I set MODE_UPD bit in MODE_UPD register and finally I wrote keys to CTL_KEY register. The MCU was reset, I reconnected debugger (hot attach without reset) and I saw that the RTC is still configured and running.
Regards,
Lukas
Thank you very much, Lukas. I have used the RTD driver to implement that the clock will not be lost when the RTC function is reset.
Regards,
liangyouchao
Okay, I'll try it.