This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Watchdog timer unexpected Reset in nrf52810

Hello,

      I have enabled the watchdog timer in nrf52810 with below code

       NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos);
      NRF_WDT->CRV = 1*32768; // 1 sec. timout
      NRF_WDT->TASKS_START = 1;

    And i am feeding the timer with  NRF_WDT->RR[0] = WDT_RR_RR_Reload; //Reload watchdog register 0.

    The behavior of the WDT is as expected in the following cases.

1. There is no call for "sd_app_evt_wait(); " in the function.

2. There is call for "sd_app_evt_wait();" but there are no activities related to BLE (i.e ADV, connected peer... etc)

    The behavior of WDT is NOT as expected in the following cases

1. There is call for "sd_app_evt_wait();" and ADV is on going . In this case there is a software reset after around 3.5 minutes of ADV (no peer connection).

2. There is call for "sd_app_evt_wait();" and a peer is connected. In this case there is a software reset after around 2.5 minutes after no activity from NRF or Peer. Or in other words is a peer is connected and idle for around 2.5 seconds the software resets.

Additional Info

-->On disabling WDT and verifying the same there is no software in any of the cases and it behaves as expected.

--> If WDT reload value is changed from 1s to 2s the corresponding reset time increases from 3.5 minutes to 7 minutes and 2.5 to 5 minutes.

Parents
  • Hi,

    There has to be something with the flow of your application that prevents you from feeding/reloading the WDT often enough.

    Observations:

    • You pause the WDT when in sleep.
    • Reset after 3.5 min when timeout is set to 1 second, and double to 7 minutes when timeout is set to 2 seconds.

    I suspect that the WDT is never reloaded. If this is the case, you should see it reset after 1 or 2 seconds respectively if you replace WDT_CONFIG_SLEEP_Pause with WDT_CONFIG_SLEEP_Run. So to fix this, make sure you feed the watchdog regularly.

  • Hello,

    I am feeding the watchdog in main loop  

    main()

    {

        NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Pause << WDT_CONFIG_SLEEP_Pos);
          NRF_WDT->CRV = 1*32768; // 1 sec. timeout
          NRF_WDT->TASKS_START = 1

        while(1)
      {


        NRF_WDT->RR[0] = WDT_RR_RR_Reload; //Reload watchdog register 0.
        ble_functions();

        Uarte_functions();
        sd_app_evt_wait();
      }

    }

    Unless there are any interrupts from BLE or UART the device stays in sleep mode and also there in no unexpected reset from watchdog as the watchdog is configured to pause in sleep mode.

    Suppose there is an idle connection then there is a reset due to watchdog after 3.5 minutes.

    Is there a difference in "sleep mode" for ble active and ble inactive? does watchdog run if there is a idle BLE connection?

  • Hi,

    I suspect your main loop never runs after the first to sd_app_evt_wait(). This is because SoftDevice will check if the interrupt was for itself or for the application, and only forward it to the application if it appropriate. So my theory from yesterday still holds based on this code (though I do not see your whole application). You can easily verify this by setting a breakpoint in the main loop. The watchdog itself behaves as it should (in the way you have configured it).

Reply
  • Hi,

    I suspect your main loop never runs after the first to sd_app_evt_wait(). This is because SoftDevice will check if the interrupt was for itself or for the application, and only forward it to the application if it appropriate. So my theory from yesterday still holds based on this code (though I do not see your whole application). You can easily verify this by setting a breakpoint in the main loop. The watchdog itself behaves as it should (in the way you have configured it).

Children
No Data
Related