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

Call to nrf_sdh_enable_request fails in SDK v16.0.0 (works in SDK v15.3.0)

I am porting our firmware from SDK v15.3.0 to 16.0.0. I believe I have most of the changes in place
as I am able to build the boot loader and get it to execute without any catastrophic errors.

However, when I try to port a basic advertisement project to this newer SDK, the call to 'nrf_sdh_enable_request()'
triggers a fault. The issue is triggered by this call inside that function:

    sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLED);

It appears that handler eventually in the file 'nrf_drv_power.c' checks to see if the local module
(i.e. m_initialized) is set to TRUE/1.

For reasons that I cannot currently triage, the combination of using SDK v16.0.0 and the preprocessor symbol DEBUG_NRF
triggers this failure. This issue disappears if I DO NOT define DEBUG_NRF in the build.

RMV

Parents
  • Hi RMV, 

    If you don't define DEBUG_NRF the ASSERT check with be masked and it may explain why it run fine without. 

    Could you add some breakpoint and check what exactly throwing the error ? 

    I'm a bit confused what exactly causing the issue, nrf_sdh_enable_request or a function inside nrf_drv_power.c

    Did you add any modification into nrf_drv_power.c ? Could you give some more info on how you use the library in your application ? 


     

  • Hi Hung,

    No, I did not plan to use the nrf_power_drv at all.

    The only reason I did so was because the call to nrf_sdh_enable_request() ended up (via one of its registered handlers) making a call to 'nrf_drv_power_on_sd_enable()' which, as I indicated before, fails because the variable 'm_initialized' is FALSE.

    And this variable is only ever set to TRUE if the nrf_drv_power module is initialized....

    And our firmware does NOT intend to use the nrf_drv_power or the USBD.

    This firmware design was working well for the past year or so but that was without defining the symbol DEBUG_NRF. This problem only occurs when I define DEBUG_NRF in the build.

    The only reason I chose to set this definition was because it was set in one of the examples I was reviewing when trying to bring up the bootloader and buttonless DFU application.

    I think I will revert back to not having this symbol defined and get on with my development plans for now.

    Cheers

    RMV

Reply
  • Hi Hung,

    No, I did not plan to use the nrf_power_drv at all.

    The only reason I did so was because the call to nrf_sdh_enable_request() ended up (via one of its registered handlers) making a call to 'nrf_drv_power_on_sd_enable()' which, as I indicated before, fails because the variable 'm_initialized' is FALSE.

    And this variable is only ever set to TRUE if the nrf_drv_power module is initialized....

    And our firmware does NOT intend to use the nrf_drv_power or the USBD.

    This firmware design was working well for the past year or so but that was without defining the symbol DEBUG_NRF. This problem only occurs when I define DEBUG_NRF in the build.

    The only reason I chose to set this definition was because it was set in one of the examples I was reviewing when trying to bring up the bootloader and buttonless DFU application.

    I think I will revert back to not having this symbol defined and get on with my development plans for now.

    Cheers

    RMV

Children
  • Hi RMV, 

    Please be aware that most of our BLE examples don't use the nrf_drv_power library. You can find that in all of our example inside ble_peripheral folder, we don't use such library at all. 

    The reason you see a call to nrf_drv_power_on_sd_enable() was because you included the nrf_drv_power.c in your project. Inside the code this macro will be compiled: 

    NRF_SDH_STATE_OBSERVER(m_sd_observer, POWER_CONFIG_STATE_OBSERVER_PRIO) =
    {
    .handler = nrf_drv_power_sdh_state_evt_handler,
    .p_context = NULL
    };

    And because of that nrf_drv_power_sdh_state_evt_handler() will be called when the softdevice is enabled. 

    So if you remove nrf_drv_power.c from your code, it should work fine. 

Related