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

Soft device_enable returns err code 2 .

I have taken ble_app_ancs_c_s130_pca10028 example and modified the application to run on our custom board. The custom board uses NRF51822 (NRF51 IC revision 3). The following two changes were made to the example.

1.change the target to nrf51822. 2.Changed the clock source to RC clock source as follows.

nrf_clock_lf_cfg_t rc_cfg = {

.source = NRF_CLOCK_LF_SRC_RC,
.rc_ctiv = 0, //
.rc_temp_ctiv = 0,
.xtal_accuracy =NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, };

The softdevice_enable function returns err_code 2. I also tried running the example available in nrf51822 example available in github link:

github.com/.../nRF51_SDK_v11
Tools: SDK11
version:2.0.0
softdevice: s130
Kiel version: 5.17
Please let me know what could be the possible reason for the error and how to resolve it.

Parents
  • Are you absolutely sure that the error number is is correct? If you are sure then it means NRF_ERROR_SOFTDEVICE_NOT_ENABLED.

    If you see nrf_soc.h, you see that in enum NRF_SOC_SVCS -> SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE. This means that from SVC number 0x2B you need to have softdevice enabled for sd_xxx calls to work.

    SD_SOFTDEVICE_ENABLE is a SVC call with number 0x10. And it cannot return that error as you cannot have softdevice enabled before calling sd_softdevice_enable. If you have really ended up here then most likely the stack is corrupted in your application. After making sd_softdevice_enable call, the value of svc number somehow got changed (which can happen in stack corruption). First thing that you should check is if you have a stack overflow and/or stack corruption. You can do this by stepping in your assembly code.

Reply
  • Are you absolutely sure that the error number is is correct? If you are sure then it means NRF_ERROR_SOFTDEVICE_NOT_ENABLED.

    If you see nrf_soc.h, you see that in enum NRF_SOC_SVCS -> SD_MUTEX_NEW = SOC_SVC_BASE_NOT_AVAILABLE. This means that from SVC number 0x2B you need to have softdevice enabled for sd_xxx calls to work.

    SD_SOFTDEVICE_ENABLE is a SVC call with number 0x10. And it cannot return that error as you cannot have softdevice enabled before calling sd_softdevice_enable. If you have really ended up here then most likely the stack is corrupted in your application. After making sd_softdevice_enable call, the value of svc number somehow got changed (which can happen in stack corruption). First thing that you should check is if you have a stack overflow and/or stack corruption. You can do this by stepping in your assembly code.

Children
No Data
Related