RAK4631 Watchdog

  • What product do you wish to discuss? — RAK4631
  • What firmware are you using? ---------- Arduino BSP
    @beegee
    I want know does RAK4631 has an option for watchdog? If yes kindly help me out to implement or give example code.

I am not aware of a watchdog function in the nRF52840/RAK4631

Hello @RaviKM

RAK4631 is based on nrf52840, so basically you can use all its resources, including a hardware WDT. I don’t know if Arduino BPS includes an easy way to set WDT up, but here is an example of how to do it using MCU registers:

#include <nrf52840.h>

//Call this when you are configuring your device (like in setup())
void setupWDT(void) {
    //Configure Hardware WDT.
    NRF_WDT->CONFIG         = 0x01;     // Configure WDT to run when CPU is asleep
    NRF_WDT->CRV            = 3932159;  // Timeout set to 120 seconds, timeout[s] = (CRV-1)/32768
    NRF_WDT->RREN           = 0x01;     // Enable the RR[0] reload register
    NRF_WDT->TASKS_START    = 1;        // Start WDT   
}

//Feed WDT frencuently enough to avoid WDT trigger
void feedWDT(void) {
    NRF_WDT->RR[0] = WDT_RR_RR_Reload;
}

Cheers