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

Issue with nrf_sdh_enable_request() after adding DEBUG_NRF to project configuration

Hi

I've been working on a project over the past few months, and per a new requirement I was asked to add a debug configuration, as thus far I have worked with only a release configuration

I have a few asserts in code that I wanted to check, so alongside DEBUG I've also added DEBUG_NRF to my project, and this causes an issue where my project stops working by reaching the error while loop inside app_error_save_and_stop()

following the code in debug mode, I found what appears to be the function call that causes the error

while initializing the BLE module, I call ble_stack_init() which begins by calling nrf_sdh_enable_request()

at the end of this function is the following call: sdh_state_observer_notify(NRF_SDH_EVT_STATE_ENABLED);

for some reason I can't explain, it seems that the third iteration inside the loop fails when calling handler(evt, p_observer->p_context) inside this function, but only in this case

and as sdh_state_observer_notify() is called 3 times within nrf_sdh_enable_request() and there previous two seem to work correctly, I really have no idea what could cause this issue

The project works fine without DEBUG_NRF, it is a FreeRTOS project based on the ble_app_hrs_freertos example, though it has changed significantly

Please let me know what further information I can provide that might help determine the source of the problem, and I'll provide it as soon as I can

Thanks

Aviv

  • Aviv Okon said:
    could this be because the USB CDC is based on the app_usbd module, and for some reason if it is enabled in sdk_config.h it is required to be initialized in debug mode?

     It very seems to be the case. Enabling it in sdk_config.h might make the driver think that this module is in use and possibly initialized few basic states of the driver even though the application hasn't explicitly initialized it. This smells like bug, but it seems like you have a workaround for this. Thanks for letting us know. 

Related