software: ncs 2.5.0, zephyr\samples\drivers\counter\alarm
hardware: nRF52840dk
Step1: main.c is not be revised!!!
Step2: prj.conf like this:
CONFIG_PRINTK=y CONFIG_COUNTER=y CONFIG_RTC=y CONFIG_RTC_UPDATE=y CONFIG_RTC_ALARM=n CONFIG_SHELL=y CONFIG_SHELL_BACKEND_SERIAL=y CONFIG_RTC_SHELL=y
Step3: overlay file like this:
&rtc0 { status = "okay"; label = "rtc0"; };
Step4: Connect USB into xshell , then build and reboot, output info like this:
*** Booting nRF Connect SDK v2.5.0 *** Counter alarm sample Set alarm in 2 sec (65536 ticks) uart:~$ !!! Alarm !!! Now: 2 Set alarm in 4 sec (131072 ticks) !!! Alarm !!! Now: 6 Set alarm in 8 sec (262144 ticks) !!! Alarm !!! Now: 14 Set alarm in 16 sec (524288 ticks) rtc set rtc0 20!!! Alarm !!! Now: 30 Set alarm in 32 sec (1048576 ticks) 12!!! Alarm !!! Now: 62 Set alarm in 64 sec (2097152 ticks) Error in argument format uart:~$ uart:~$ uart:~$ uart:~$ rtc set rtc0 2012-10-15T22:15:15 uart:~$ uart:~$ rtc get rtc0 in RTC Shell Get 1900-47632-47627T536878248:31959:42760:000000 uart:~$ uart:~$ uart:~$ rtc get rtc0 in RTC Shell Get 1900-47632-47627T536878248:31959:42760:000000 uart:~$
Question:
1. in other project B(with ble adv), I can not "device_get_binding("rtc0")" , device can't fond. overlay rtc0 label is "rtc0", how every this projcet(project A) is ok.
2. use shell to set time "rtc set rtc0 2012-10-15T22:15:15", there is no errors, but "rtc get rtc0", it is error like "1900-47632-47627T536878248:31959:42760:000000", it is a joke for me.
3. after a while, i shell "rtc get rtc0", it is still like "1900-47632-47627T536878248:31959:42760:000000", RTC is not runing? it is a joke for me again.
4. how to use rtc for calendar in my project A and B.