zephyr software timer cannot trigger periodically.

I am using the NRF54L05.When I was using the timer function of the Zephyr software, I created a timer with a 10ms cycle. After my system had been running for a long time (for example, 12 hours), after executing sys_reboot(SYS_REBOOT_COLD);, there was a probability of encountering a timer anomaly. It did not trigger as I expected; it only triggered once, and the next trigger time was much later;
相关代码使用:   
FRAME_INTVAL_UINT 10  // 毫秒

  k_timer_init (& delay_timer ,delay_timer_handler ,NULL );

  k_timer_start (& delay_timer ,K_MSEC ((uint32_t )FRAME_INTVAL_UINT ),

                K_MSEC ((uint32_t )FRAME_INTVAL_UINT ));

I obtained the trigger count and the next time from the delay_timer through k_timer_status_get(&delay_timer) and k_timer_remaining_get(&delay_timer) respectively.The results I got were 1 and 11814496;

I can confirm that my clocks are all functioning properly, and my delay_work and threads are also running normally. I have no idea how to proceed to identify the problem;

Thank you very much for your help;
Parents
  • Thanks. Do you have to wait exactly 12 hours? Try doing the soft reset sooner to see if it changes anything. Also, a soft reset doesn’t clear the GRTC register, but a watchdog timer reset does. Can you check if the issue still occurs after a watchdog timer reset? It would also be helpful if you print the timer values right before and after the resets.

  • HI,

    This duration might not be exactly 12 hours; it could be shorter. However, I haven't attempted it yet.

    Thaks for the heads up,I tried to clear the GRTC register before the soft reset, and this problem no longer occurred.

    So, can you roughly figure out what caused this problem of mine?

    Is there any other better way to solve the problem during the program initialization?

    bool app_device_researt(void) {
      nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_STOP);
      nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_CLEAR);
      NVIC_SystemReset();
      return true;
    }
Reply
  • HI,

    This duration might not be exactly 12 hours; it could be shorter. However, I haven't attempted it yet.

    Thaks for the heads up,I tried to clear the GRTC register before the soft reset, and this problem no longer occurred.

    So, can you roughly figure out what caused this problem of mine?

    Is there any other better way to solve the problem during the program initialization?

    bool app_device_researt(void) {
      nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_STOP);
      nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_CLEAR);
      NVIC_SystemReset();
      return true;
    }
Children
Related