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

POFWARN

Hi,

I'm working on the nrf52832 development board and SDK 16.0. I want to use the Power supply supervisory functionality to detect any type of power failure.

I'm using ble Blinky example with softdevice s132 to test this.

I just want to know, How can I register my event with the soft device.

I have seen many examples regarding the POFWARN at this forum but unable to implement it in code. 

    err_code = sd_power_pof_enable(POWER_POFCON_POF_Enabled);
    APP_ERROR_CHECK(err_code);

    err_code = sd_power_pof_threshold_set(POWER_POFCON_THRESHOLD_V28);
    APP_ERROR_CHECK(err_code);

but I don't know where how to get the warning NRF_EVT_POWER_FAILURE_WARNING  by incorporating with the softdevice. If there is any example stating the procedure or any help will be grateful.

Thanks

Regards,

Parents
  • Hi, 

    Please refer to the example in this post. Please be aware that POF example with softdevice is for nRF51 SDK 8.1.0. 

    -Amanda H.

  • Hi

    I have gone through the link you are suggesting, I need the exact steps to perform the POF in nrf52 and SDK 16,

    As in SDK 8.1.0 the functions referred to in the post are not available in SDK 16.

    So please guide me regarding the SDK 16 and Softdevice S132.

  • Hi, 

     I am not aware of any example other than that example.

    The suggested usage should be:

    Enable and initialize power fail warning after softdevice enabled by calling sd_power_pof_enable() and sd_power_pof_threshold_set(), the configurable thresholds are found in NRF_POWER_THRESHOLDS. The softdevice will then provide an NRF_EVT_POWER_FAILURE_WARNING when the supply fall under the threshold. 

    I don't expect you will be able to catch a true power fail warning in any case, as the voltage falls so very quickly and will terminate any CPU operation within ~100us in any case. Then once the voltage fall below brown out reset all pins will be floating and the chip will stop all operation in any case. Personally, I think is better to periodically read the battery voltage and monitor over time using the comparator.

    You should also be aware that the power fail warning will prevent all flash write and erase operations, however, there will be no error from the hardware, the instructions are simply ignored by hardware, this can cause some strange results if you try to use the power failure warning as a battery monitor. The fstorage and fds do not handle this situation, so using LPCOMP may be a better idea.

    -Amanda H.

Reply
  • Hi, 

     I am not aware of any example other than that example.

    The suggested usage should be:

    Enable and initialize power fail warning after softdevice enabled by calling sd_power_pof_enable() and sd_power_pof_threshold_set(), the configurable thresholds are found in NRF_POWER_THRESHOLDS. The softdevice will then provide an NRF_EVT_POWER_FAILURE_WARNING when the supply fall under the threshold. 

    I don't expect you will be able to catch a true power fail warning in any case, as the voltage falls so very quickly and will terminate any CPU operation within ~100us in any case. Then once the voltage fall below brown out reset all pins will be floating and the chip will stop all operation in any case. Personally, I think is better to periodically read the battery voltage and monitor over time using the comparator.

    You should also be aware that the power fail warning will prevent all flash write and erase operations, however, there will be no error from the hardware, the instructions are simply ignored by hardware, this can cause some strange results if you try to use the power failure warning as a battery monitor. The fstorage and fds do not handle this situation, so using LPCOMP may be a better idea.

    -Amanda H.

Children
Related