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?
已解决! 转到解答。
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
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