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, 

    Please check the NRF_SDH_SOC_ENABLED is set to 1 in the sdk_config.h and Include header files for  nRF5_SDK\components\softdevice\common\nrf_sdh_soc.h

    // <e> NRF_SDH_SOC_ENABLED - nrf_sdh_soc - SoftDevice SoC event handler
    //==========================================================
    #ifndef NRF_SDH_SOC_ENABLED
    #define NRF_SDH_SOC_ENABLED 1
    #endif
    // <h> SoC Observers - Observers and priority levels
    
    //==========================================================
    // <o> NRF_SDH_SOC_OBSERVER_PRIO_LEVELS - Total number of priority levels for SoC observers. 
    // <i> This setting configures the number of priority levels available for the SoC event handlers.
    // <i> The priority level of a handler determines the order in which it receives events, with respect to other handlers.
    
    #ifndef NRF_SDH_SOC_OBSERVER_PRIO_LEVELS
    #define NRF_SDH_SOC_OBSERVER_PRIO_LEVELS 2
    #endif
    
    // <h> SoC Observers priorities - Invididual priorities
    
    //==========================================================
    // <o> BLE_DFU_SOC_OBSERVER_PRIO  
    // <i> Priority with which BLE events are dispatched to the DFU Service.
    
    #ifndef BLE_DFU_SOC_OBSERVER_PRIO
    #define BLE_DFU_SOC_OBSERVER_PRIO 1
    #endif
    
    // <o> CLOCK_CONFIG_SOC_OBSERVER_PRIO  
    // <i> Priority with which SoC events are dispatched to the Clock driver.
    
    #ifndef CLOCK_CONFIG_SOC_OBSERVER_PRIO
    #define CLOCK_CONFIG_SOC_OBSERVER_PRIO 0
    #endif
    
    // <o> POWER_CONFIG_SOC_OBSERVER_PRIO  
    // <i> Priority with which SoC events are dispatched to the Power driver.
    
    #ifndef POWER_CONFIG_SOC_OBSERVER_PRIO
    #define POWER_CONFIG_SOC_OBSERVER_PRIO 0
    #endif

    And that these files (under nRF5_SDK\components\softdevice\common\) are included in your project:

    -Amanda H.

  • Actually got my code working after performing the above steps. Now just there's one warning that is kept coming on the compilation. Can you suggest about it?

  • Hi, 

    Please add "void * p_context" to the input argument of sys_evt_dispatch declaration.

    static void sys_evt_dispatch(uint32_t evt_id, void * p_context)

    Please kindly let me know this can help or not. Thanks. 

    -Amanda H.

  • Hi

    This worked!

    Thanks for your kind feedback it really helped a lot.

    I just wanted to know that if there is any register in NVM where any warning stores so that we can check whether there is any undesirable reset happened or not?

    As NRF_EVT_POWER_FAILURE_WARNING is the only event I know that is happening while on low power and reset. but how we will identify after reset that it was due to low voltage?

  • Hi, 

    Muhammad said:

    This worked!

    Thanks for your kind feedback it really helped a lot.

    Happy to hear that can help. Please kindly verify the question to benefit other users. Thanks. 

    Muhammad said:
    I just wanted to know that if there is any register in NVM where any warning stores so that we can check whether there is any undesirable reset happened or not?

    You could check the NRF_POWER->RESETREAS register by the sd_power_reset_reason_get() in order to detect what caused your reset. This post and this might help you. 

    Muhammad said:
    As NRF_EVT_POWER_FAILURE_WARNING is the only event I know that is happening while on low power and reset. but how we will identify after reset that it was due to low voltage?

    This post and this might help you. 

    If you have further questions, please create a new support case. The new question now is far away from the original issue.

    -Amanda H. 

Reply
  • Hi, 

    Muhammad said:

    This worked!

    Thanks for your kind feedback it really helped a lot.

    Happy to hear that can help. Please kindly verify the question to benefit other users. Thanks. 

    Muhammad said:
    I just wanted to know that if there is any register in NVM where any warning stores so that we can check whether there is any undesirable reset happened or not?

    You could check the NRF_POWER->RESETREAS register by the sd_power_reset_reason_get() in order to detect what caused your reset. This post and this might help you. 

    Muhammad said:
    As NRF_EVT_POWER_FAILURE_WARNING is the only event I know that is happening while on low power and reset. but how we will identify after reset that it was due to low voltage?

    This post and this might help you. 

    If you have further questions, please create a new support case. The new question now is far away from the original issue.

    -Amanda H. 

Children
No Data
Related