SDK: 6.0.16.1144
Kit: DA14531MOD-00DEVKT-P
Module: Custom board even with DA14531MOD
Keil uVision: v5.38.0.0
I am using default example "prox_reporter". I have added few debug messages to know when the interrupt is triggering. I have left the example code as it is and as per the configure_rtc_wakeup() method RTC interrupt should trigger for every 10 seconds:
static void configure_rtc_wakeup(void) { arch_printf("::%s(START)\n", __FUNCTION__); rtc_time_t alarm_time; // Init RTC rtc_reset(); // Configure the RTC clock; RCX is the RTC clock source (14420 Hz) rtc_clk_config(RTC_DIV_DENOM_1000, 14420); rtc_clock_enable(); rtc_config_t cfg = {.hour_clk_mode = RTC_HOUR_MODE_24H, .keep_rtc = 0}; rtc_time_t time = {.hour_mode = RTC_HOUR_MODE_24H, .pm_flag = 0, .hour = 11, .minute = 55, .sec = 30, .hsec = 00}; // Alarm interrupt in ten seconds alarm_time = time; alarm_time.sec += 10; // Initialize RTC, set time and data, register interrupt handler callback function and enable seconds interrupt rtc_init(&cfg); // Start RTC rtc_set_time_clndr(&time, NULL); rtc_set_alarm(&alarm_time, NULL, RTC_ALARM_EN_SEC); // Clear pending interrupts rtc_get_event_flags(); rtc_register_intr(rtc_interrupt_hdlr, RTC_INTR_ALRM); #if defined (CFG_EXT_SLEEP_WAKEUP_RTC) app_easy_wakeup_set(app_wakeup_cb); #endif arch_printf("::%s(STOP)\n", __FUNCTION__); }
However the rtc_interrupt_hdlr() is called for every one minute instead of 10 seconds. Surprisingly, even if I change
alarm_time.sec += 10;
to
alarm_time.sec += 1;
it is still triggering with the same time. I erased the code and did burn again to make sure that old code is not running. What could be the wrong.
Captured log messages. The time stamp indicates that the rtc_interrupt_hdlr() is triggered almost for each minute.
18:05:01.017 -> ::configure_rtc_wakeup(START) 18:05:01.017 -> ::configure_rtc_wakeup(STOP) 18:05:10.737 -> ::rtc_interrupt_hdlr(START) 18:05:10.737 -> ::app_wakeup_cb(START) 18:06:09.596 -> ::rtc_interrupt_hdlr(START) 18:07:07.756 -> ::rtc_interrupt_hdlr(START) 18:08:05.943 -> ::rtc_interrupt_hdlr(START) 18:08:10.718 -> ::configure_rtc_wakeup(START) 18:08:10.750 -> ::configure_rtc_wakeup(STOP) 18:08:20.455 -> ::rtc_interrupt_hdlr(START) 18:08:20.455 -> ::app_wakeup_cb(START) 18:09:19.327 -> ::rtc_interrupt_hdlr(START) 18:10:17.469 -> ::rtc_interrupt_hdlr(START) 18:11:15.666 -> ::rtc_interrupt_hdlr(START) 18:11:20.459 -> ::configure_rtc_wakeup(START) 18:11:20.459 -> ::configure_rtc_wakeup(STOP) 18:11:30.176 -> ::rtc_interrupt_hdlr(START) 18:11:30.176 -> ::app_wakeup_cb(START) 18:12:29.039 -> ::rtc_interrupt_hdlr(START) 18:13:27.225 -> ::rtc_interrupt_hdlr(START) 18:14:25.392 -> ::rtc_interrupt_hdlr(START) 18:14:30.167 -> ::configure_rtc_wakeup(START) 18:14:30.167 -> ::configure_rtc_wakeup(STOP) 18:14:39.888 -> ::rtc_interrupt_hdlr(START) 18:14:39.888 -> ::app_wakeup_cb(START) 18:15:38.767 -> ::rtc_interrupt_hdlr(START) 18:16:36.926 -> ::rtc_interrupt_hdlr(START)
1) Why the timing is wrong?
2) Why triggering time is not changing?
And the same configure_rtc_wakeup() method I copied to my own application and there its taking even more time. For
rtc_time_t alarm_time; // Init RTC rtc_reset(); // Configure the RTC clock; RCX is the RTC clock source (14420 Hz) rtc_clk_config(RTC_DIV_DENOM_1000, 14420); rtc_clock_enable(); rtc_config_t cfg = {.hour_clk_mode = RTC_HOUR_MODE_24H, .keep_rtc = 0}; rtc_time_t time = {.hour_mode = RTC_HOUR_MODE_24H, .pm_flag = 0, .hour = 11, .minute = 55, .sec = 30, .hsec = 00}; // Alarm interrupt in ten seconds alarm_time = time; alarm_time.sec += 10; // Initialize RTC, set time and data, register interrupt handler callback function and enable seconds interrupt rtc_init(&cfg); // Start RTC rtc_set_time_clndr(&time, NULL); rtc_set_alarm(&alarm_time, NULL, RTC_ALARM_EN_SEC); // Clear pending interrupts rtc_get_event_flags(); rtc_register_intr(rtc_interrupt_hdlr, RTC_INTR_ALRM);
its triggering for every10 minutes.
3) How to debug it to know why its taking that much time?
Thanks,
Harish