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

Watchdog reset after exactly 8000s while advertising with whitelist after previous successful connection

Hi

On my device, after a successful (bonded) connection to a central, if I then turn off BLE on that central, my device moves through fast advertising and slow advertising (with whitelist) as expected. I can reconnect at will, however if I leave EXACTLY 8000 seconds (about 2 hrs, 13 mins) WITHOUT turning BLE back on on said central, then the NRF52832 WD resets.

At the moment I am detecting and handling this situation over the wire (SPI), but it would be rather better if it did not occur. The 8000 seconds is FULLY deterministic, and its too round a number to be some fluke, it must be deterministically driven by something!

SDK is 15.2, Soft Device is S132 (s132_nrf52_6.1.0_softdevice.hex)

Wondered if someone had an idea why this might be happening?

I have read about whitelisting and identify keys and a bug that exists in the Nordic SDK around the use of these? Maybe someone can tell me how I can turn off the use of Identity Keys, while retaining whitelisting?

Kind Regards

Karen

Parents
  • Hi

    For anyone else suffering this issue, the answer from @Håkon Alseth was the solution. Starting a timer with an empty handler will force the main loop to wake, and service the watchdog. This keeps the WDT functionality true to form eg if will still force a restart on a hang.

    Thanks!

    Karen

    #include "app_timer.h"
    
    // Local functions
    static void Power_KickWdt(void *p_context);
    
    // Periodic timer for allowing wakeup to ensure the watchdog timer is serviced. Required when BLE events are being serviced by the softdevice and there are no other application level events
    #define WD_TIMEOUT_MS 60000
    static app_timer_t m_WdtKickTimer_data __attribute__((aligned(4))) = {{0}};
    static const app_timer_id_t m_WdtKickTimer = &m_WdtKickTimer_data;
    
    /*
    * Initialize power management
    */
    void Power_Init(void)
    {
    // Initialise Nordic power management
    APP_ERROR_CHECK(nrf_pwr_mgmt_init());
    
    // Create and start our periodic wakeup timer
    APP_ERROR_CHECK(app_timer_create(&m_WdtKickTimer, APP_TIMER_MODE_REPEATED, Power_KickWdt));
    APP_ERROR_CHECK(app_timer_start(m_WdtKickTimer, APP_TIMER_TICKS(WD_TIMEOUT_MS), NULL));
    }
    
    
    /*
    * Timer event handler for waking up to service the watchdog timer
    * This routine does not kick the watchdog directly but allows the main loop to wake up and service it
    */
    static void Power_KickWdt(void *p_context)
    {
    UNUSED_PARAMETER(p_context);
    }

Reply
  • Hi

    For anyone else suffering this issue, the answer from @Håkon Alseth was the solution. Starting a timer with an empty handler will force the main loop to wake, and service the watchdog. This keeps the WDT functionality true to form eg if will still force a restart on a hang.

    Thanks!

    Karen

    #include "app_timer.h"
    
    // Local functions
    static void Power_KickWdt(void *p_context);
    
    // Periodic timer for allowing wakeup to ensure the watchdog timer is serviced. Required when BLE events are being serviced by the softdevice and there are no other application level events
    #define WD_TIMEOUT_MS 60000
    static app_timer_t m_WdtKickTimer_data __attribute__((aligned(4))) = {{0}};
    static const app_timer_id_t m_WdtKickTimer = &m_WdtKickTimer_data;
    
    /*
    * Initialize power management
    */
    void Power_Init(void)
    {
    // Initialise Nordic power management
    APP_ERROR_CHECK(nrf_pwr_mgmt_init());
    
    // Create and start our periodic wakeup timer
    APP_ERROR_CHECK(app_timer_create(&m_WdtKickTimer, APP_TIMER_MODE_REPEATED, Power_KickWdt));
    APP_ERROR_CHECK(app_timer_start(m_WdtKickTimer, APP_TIMER_TICKS(WD_TIMEOUT_MS), NULL));
    }
    
    
    /*
    * Timer event handler for waking up to service the watchdog timer
    * This routine does not kick the watchdog directly but allows the main loop to wake up and service it
    */
    static void Power_KickWdt(void *p_context)
    {
    UNUSED_PARAMETER(p_context);
    }

Children
Related