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
  • Hi,

    The Power Failure Comparator does not give any events when voltage goes above threshold, only when it falls below. If you want to generate event on both ways, you should use the LPCOMP/COMP peripheral. You can find LPCOMP example in the SDK.

    Best regards,
    Jørgen

  • 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.

Reply
  • 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.

Children
No Data
Related