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

calling sd_power_pof_enable(), error code = 2

Hi,

I am using nRF51822, S130, SDK 12.3.0 Want to use is low power failure warning. using the following code. However, when break on line err_code = sd_power_pof_enable(), it has error code 2.

Any idea what is wrong?

uint32_t err_code;

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

err_code = sd_power_pof_threshold_set(POWER_POFCON_THRESHOLD_V27);
APP_ERROR_CHECK(err_code);

// Subscribe for Sys events.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);

static void sys_evt_dispatch(uint32_t sys_evt) { if (sys_evt == NRF_EVT_POWER_FAILURE_WARNING) { testData = 0; } }

Thanks a lot!

Martin

Parents
  • Thanks for the reminder.

    After I had enable the softdevice, sd_power_pof_enable() running well.

    err_code = sd_softdevice_enable(NRF_CLOCK_LF_SRC_RC, softdevice_assert_callback); APP_ERROR_CHECK(err_code);

    err_code = sd_power_pof_enable(POWER_POFCON_POF_Enabled << POWER_POFCON_POF_Pos);
    APP_ERROR_CHECK(err_code);
    
    err_code = sd_power_pof_threshold_set(POWER_POFCON_THRESHOLD_V27);
    APP_ERROR_CHECK(err_code);
    
    // Subscribe for Sys events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
    

    However, since my project is using GZLL protocol. after softdevice enabled, following line will just hangup. Is that mean I cannot enable softdevice and run GZLL?

    bool result_value = nrf_gzll_init(NRF_GZLL_MODE_DEVICE);
    

    Thanks!

Reply
  • Thanks for the reminder.

    After I had enable the softdevice, sd_power_pof_enable() running well.

    err_code = sd_softdevice_enable(NRF_CLOCK_LF_SRC_RC, softdevice_assert_callback); APP_ERROR_CHECK(err_code);

    err_code = sd_power_pof_enable(POWER_POFCON_POF_Enabled << POWER_POFCON_POF_Pos);
    APP_ERROR_CHECK(err_code);
    
    err_code = sd_power_pof_threshold_set(POWER_POFCON_THRESHOLD_V27);
    APP_ERROR_CHECK(err_code);
    
    // Subscribe for Sys events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
    

    However, since my project is using GZLL protocol. after softdevice enabled, following line will just hangup. Is that mean I cannot enable softdevice and run GZLL?

    bool result_value = nrf_gzll_init(NRF_GZLL_MODE_DEVICE);
    

    Thanks!

Children
Related