How to make rtc_get_time workable for nRF52832 EVK

Hello,

By using nRF Connect SDK v2.6.1,  I want to have RTC (Date Time, Calender, etc) functions, so I modified the code based on one of Nordic Academy examples, which can run with nRF82832 EVK board.  After  calling  rtc_set_time in main, and then rtc_get_time, it seems to have correct RTC, but when press button1 to call rtc_get_time again, it doesn't work as expected. The following is the related log:

*** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
[00:00:00.382,110] <dbg> Lesson2_Exercise3: main: get time: 0

[00:00:00.382,110] <dbg> Lesson2_Exercise3: main: 2024/09/00 15:25:00

[00:00:00.382,202] <inf> Lesson2_Exercise3: Press button 1
[00:00:04.068,786] <dbg> Lesson2_Exercise3: button_handler: get time: 0

[00:00:04.068,817] <dbg> Lesson2_Exercise3: button_handler: 29403/536872912/536872776 -1:20353:536872776

[00:00:04.068,817] <inf> Lesson2_Exercise3: Button 1 pressed
[00:00:04.330,688] <dbg> Lesson2_Exercise3: button_handler: get time: 0

[00:00:04.330,688] <dbg> Lesson2_Exercise3: button_handler: 29403/536872912/536872776 -1:20353:536872776

Could you please help check the code, and show me how to modify the code to make RTC workable?

Thanks,

Jerry

 inter_less2_exer3.zip

Related