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

Retain Some Peripherals status after a watchdog reset over nRF52

I write an application on nRF52 where the Watchdog Timeout event should automatically clear a GPIO and start a PWM signal on another GPIO using PPI.

The issue is that Watchdog timer will always reset the chip and hence reset the peripherals including PPI, GPIOTE, and PWM.

Is there any possible way to retain the configuration of some peripherals (i.e. PPI, GPIOTE, PWM) after a watchdog reset is performed on nRF52?

  • There are a lot of ways.
    You can write periodically to flash.
    You can write to the UICR registers. You can also use the GPREGRET registers.

    If you want a super simple approach, the ram is not initialized on boot. So people have also just left data in static variables that they don't init (ie, set to zero). Or, they selectively init when they know they didn't just come out of a WDT reset. As long as you don't power down or brownout your static variable will be there.

    With all these methods you will still need to write back the state of the various peripherals you mentioned after the reset event. But it will give you a way to recover to roughly the last state of the device.

    Though I should point out that people will ask why you are expecting so many WDT events?

Related