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

Clearing EVENTS_POFWARN

Dear Colleagues

SoftDevice API has event NRF_EVT_POWER_FAILURE_WARNING  but is missing something like NRF_EVT_POWER_RESTORED

My application needs to quickly check  if power has been restored before exiting from the power saving mode (not the SYSTEM OFF, though)

I planned to clear EVENTS_POFWARN and see if it is set again.

However, EVENTS_POFWARN is restricted when SoftDevice enabled and disabling SoftDevice for some reason increases supply current

Or perhaps, there are other ways of doing this without turning on SAADC?

nRF52832-QFAA-0E, S132

Parents Reply Children
  • Hi ,

    As I understood, neither LCOMP nor COMP are capable to compare VDD and internal REF. Both need an analog pin as VIN+ and LCOMP has no internal REF, so LCOMP and COMP would need analog input.

    Unluckily, my design already ran out of pins. Thus, power-fail comparator seems to be the only option I can use.

    Spec chapter 18.4.1 states:

    If the POF is enabled and the supply voltage falls below VPOF, the POFWARN event will be generated. This event will also be generated if the supply voltage is already below VPOF at the time the POF is enabled, or if VPOF is reconfigured to a level above the supply voltage.

    So, if sd_power_pof_threshold_set simply sets NRF_POWER->POFCON, its call should trigger POFWARN. Although it is not clear if NRF_POWER->POFCON should be written different value or the same would be sufficient. And last but not least, how to prevent SoftDevice from stealing this event.

  • It could work to call sd_power_pof_threshold_set() with a higher threshold, but it will only generate an event if the supply voltage is below the threshold. If supply voltage is above, you will not get any events, and will have to set a timeout to when you should stop waiting for the event. I think that using the SAADC to measure the voltage would be a simpler and cleaner solution.

  • That is the idea - if no events occur the supply voltage must be above the threshold

Related