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

doesn't return from sd_softdevice_enable

We have a custom board built around the nrf52840 chipset. We developed code against the dk kit of the same now we are trying to get this working on the custom board. 

1) we call nrf_sdh_enable_request

2) it calls sd_softdevice_enable

3) it calls SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler))

code then never returns. It doesn't show any errors, it doesn't enter the error handler.

Troubleshooting

- I have built, downloaded and then verified with no errors.

- Avoiding using the bluetooth stack appears to work fine - however the bt stack is required for it to do much.

- I have disabled the init of the softdevice and the code enters the handler and says that the softdevice is not enabled.

Environment

SDK is 15.0.0

SES is 4.12  Build 2018112601.37855

J-Link is DLL version V6.40, compiled Oct 26 2018 15:08:28

Host OS is Mint 18.3

I am not sure where to go to debug this. 

Many thanks in advance

Paul

  • Hi Paul.

    code then never returns. It doesn't show any errors, it doesn't enter the error handler.

    Have you tried stepping through the code by debugging? Surely it must end up somewhere. I would suggest that you add some breakpoints along the way to sd_softdevice_enable and see where you end up.

    Best regards,

    Andreas

  • Hi Andreas,

                       I used the debugger to outline the path above. Once it makes the service call into the softdevice is traces in assembler which I don't understand. Eventually it all stops and is unresponsive to the debugger until I restart. I of course don't know whether this is a timing window issue at that point - the softdevice has some tight timing windows that when missed everything stops - due to debugging or the issue itself.

    Cheers Paul

  • In the sdk_config.h which we all know and love, you can configure the softdevice clock source. 

    // </h> 
    //==========================================================
    
    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 2
    #endif

    As you can see there are three settings. We had it set to the external crystal and that was failing - probably because there was no external crystal on our custom board. Setting it to synth appears to fix the problem. Setting it to RC produces another problem. So if you have soft device problems I would suggest that you have a close look at the clock source and possibly even try each and see if it fixes it.

    Cheers Paul

Related