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

nrf_pwr_mgmt_init 0x0008 Error

Hi, 

I'm developing now at nRF52832.

I add DFU service belong these reference

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fservice_dfu.html

https://rigado.zendesk.com/hc/en-us/articles/360025376053-Add-Nordic-DFU-to-a-SDK-Example

I build the project and debug, 

My software breaks at nrf_pwr_mgmt_init(); err code 0x4001.

and err code of app_error_handler_bare function is 0x0008.

I added static bool app_shutdown_handler(nrf_pwr_mgmt_evt_t event) and NRF_PWR_MGMT_HANDLER_REGISTER(app_shutdown_handler, 0).

I thought the cause is that priority of NRF_PWR_MGMT library and priority for NRF_PWR_MGMT_HANDLER_REGISTER are difference.

So, I change priority of  NRF_PWR_MGMT_HANDLER_REGISTER to 3.

NRF_PWR_MGMT_HANDLER_REGISTER(app_shutdown_handler, 3).

but now, the project building is failed by these errors.

2> ../../../../../../components/libraries/util/app_util.h:206:41: error: static assertion failed: "unspecified message"
2> ../../../../../../components/libraries/util/app_util.h:228:62: note: in definition of macro '_SELECT_ASSERT_FUNC'
2> ../../../../../../components/libraries/util/app_util.h:245:25: note: in expansion of macro 'STATIC_ASSERT_SIMPLE'
2> ../../../../../../components/libraries/pwr_mgmt/nrf_pwr_mgmt.h:115:5: note: in expansion of macro 'STATIC_ASSERT'
2> note: in expansion of macro 'NRF_PWR_MGMT_HANDLER_REGISTER'
Build failed

What should I do?

Best Regard.

Parents
  • Hi,

    nrf_pwr_mgmt_init() may return NRF_ERROR_INVALID_STATE (0x8) if you haven't initalized the app_timer module first (i.e. app_timer_init()). Please make sure you're doing that in your code. 

    So, I change priority of  NRF_PWR_MGMT_HANDLER_REGISTER to 3.

    The priority must be between 0-2 because NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT is set to 3 by default. That's why you get the static assertion when you set it to '3'. 

Reply
  • Hi,

    nrf_pwr_mgmt_init() may return NRF_ERROR_INVALID_STATE (0x8) if you haven't initalized the app_timer module first (i.e. app_timer_init()). Please make sure you're doing that in your code. 

    So, I change priority of  NRF_PWR_MGMT_HANDLER_REGISTER to 3.

    The priority must be between 0-2 because NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT is set to 3 by default. That's why you get the static assertion when you set it to '3'. 

Children
Related