Application getting stuck after longer system_off times

Hello, I have a wierd bug on my board using an nrf54l10. I am using the sys_poweroff(), function to put my device to sleep. Everything is working fine. However, sometimes my application gets stuck when returning from system off. This happens only sometimes, and more often when the device was longer in system_off. I have a watchdog imlemented, that I tested and also works fine usually, but in this specific case the watchdog does not trigger a reset. 

The main thing I do different on my current board in comparison to previous projects is that I use an external low frequency 32 kHz quartz. Are there any misconfiguration one can do that could trigger such a behavior. 

The main problem is that this bug happens rarely (most often after more than 12 h of system_off time. But sometimes also after 1-2 hours) that it is difficult to reproduce. But as it is a battery powered device it is critical as only a power cycle helps to return to normal operation. 

I am using nrfconnect sdk 3.0.2. I clear the reset cause using "hwinfo_clear_reset_cause();" after each startup.

Thank you and regards,

Vito

  • Some more information: I found out that the application gets "stuck" here:

    while (1){

          if (T[1] == 0){ 

    .......(some code)

         }

            wdt_feed(wdt, wdt_channel_id);
    }
    So, T[1] is a timer I always count down so that the "some code" should execute repeatedly. However, when the application is stuck. It does not get to that. It basically just feeds the watchdog. This also explains why I do not get a reset from the watchdog.
    I was able to retain the state where the application get stuck without counting the timer down, and basically could reflash it while it kept getting stuck there. When I deactivated the watchdog and the watchdog feed the timer counted down again correctly and the application worked as expected. After adding the watchdog again, the application did no longer get stuck, and I probably now have to wait for another random event to anaylze this further. 
    This is how I implement the watchdog: 
        static const struct device *wdt = DEVICE_DT_GET(DT_NODELABEL(wdt31));
        struct wdt_timeout_cfg wdt_config = {.flags = WDT_FLAG_RESET_SOC, .window.min = 0U, .window.max = 1000}; // watchdog mit 1 Sekunde
        if (!device_is_ready(wdt) || wdt == NULL)
            LOG_INF("Watchdog not ready!\n");
        int16_t wdt_channel_id = wdt_install_timeout(wdt, &wdt_config);
        wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
    And this is how I count down my timer: 
    void my_work_handler(struct k_work *work)                                                       
    {
        for (uint8_t lCnt = 0; lCnt < 11; lCnt++) { if (T[lCnt] > 0) T[lCnt]--; }                  
    }
    K_WORK_DEFINE(my_work, my_work_handler);                                                       

    void my_tick_timer_handler(struct k_timer *dummy)                                               
    {
        k_work_submit(&my_work);                                                                   
    }
    K_TIMER_DEFINE(my_tick_timer, my_tick_timer_handler, NULL);                                     

    void InitializeSysTick(void)
    {
        k_timer_start(&my_tick_timer, K_MSEC(BASE_TIMER), K_MSEC(BASE_TIMER));                   
    }
  • Hi Vito,

    The main thing I do different on my current board in comparison to previous projects is that I use an external low frequency 32 kHz quartz. Are there any misconfiguration one can do that could trigger such a behavior. 

    When using external sources, you need to ensure that the LFCLK.SRC register of the CLOCK is set to LFXO. This is stated in this part of the nRF54L10 datasheet

    Regarding your issue with a stuck application, please let us know if/when the issue appears again and provide a similar amount of detail as you did in your main ticket and follow up.

    If you can find out if the timer work task is started and stops before counting down to zero, or if it is never started, that will be of help to diagnose this. 

    And a last small request: Next time you share code (or logs), please use the Insert->Code feature.

    Best regards,

    Maria

Related