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

detect brownout on reset

I would like to detect if a reset happened due to a brownout or an actual power off.

I tired so far using the GPREGRET and RESETREAS registers. They are useful to detect soft resets and distinguish between their causes, but since they are cleared on hard reset and brownout, they are not useful for this case. I tried using the POFCON together with the POWER FAILURE WARNING, which, even on the 2.7V threshold, only gives me about 40 ms to act. But in this time I can't write to pstorage, which takes much longer than that for a write cycle. So I can't store the impending brownout in persistent memory either.

So is there any other way in which I could detect a brownout after a reset?

I am using an NRF51822 with Softdevice s130 v1, and SDK 8.1

Any idea would be appreciated, thanks in advance Dominik

Parents Reply
  • Thanks for your input. Unfortunately using ADC to monitor the power doesn't work out, our device is connected to the 230V power line, not to a battery. But I think I found a nice solution. I use the power fail comparator, and in case of a warning, I set a brownout flag on the gpregret and force a softdevice reset, before the device actually brownsout. like this I also don't lose the gpregret register and can use the info after the reset.

Children
Related