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

nRF52 SDK12.2 fails SOFTDEVICE_HANDLER_INIT when debugging

Trying to get the debugger working with Eclipse on SDK 12.2 using the nrf52832. Using the ble_app_hrs example, I can flash the application and the "Nordic HRM" device shows up on my phone. However if I try to debug the application, I end up in the app_error_handler because SOFTDEVICE_HANDLER_INIT supposedly returned an error code 8.

Note to make sure the debug action was loading the correct code, I erased the device then used the debug to program it. It failed with usual error code 8, I stopped the debugger, reset the board and the "Nordic HRM" device appeared and worked as usual.

How can this program work when run without debugger but continuously fail here when debugging?

Parents
  • Error code 8 is NRF_ERROR_INVALID_STATE Can you step into softdevice_handler_init in softdevice_handler.c and place a breakpoint after

    err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler);
    

    e.g. at if (err_code != NRF_SUCCESS), and check the error code to verify that this is the function that returns NRF_ERROR_INVALID_STATE.

    Keep in mind that you cannot step through a sd_-call or after you have enabled the Softedevice as this vil halt the CPU and cause the SoftDevice to assert since this breaks its real-time requirements.

Reply
  • Error code 8 is NRF_ERROR_INVALID_STATE Can you step into softdevice_handler_init in softdevice_handler.c and place a breakpoint after

    err_code = sd_softdevice_enable(p_clock_lf_cfg, softdevice_fault_handler);
    

    e.g. at if (err_code != NRF_SUCCESS), and check the error code to verify that this is the function that returns NRF_ERROR_INVALID_STATE.

    Keep in mind that you cannot step through a sd_-call or after you have enabled the Softedevice as this vil halt the CPU and cause the SoftDevice to assert since this breaks its real-time requirements.

Children
No Data
Related