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

Configuring BLE/Soft Device on Adafruit Feather nRF52840 Sense

I'm trying to get the ble_app_blinky example from the NRF5 Thread SDK working on the Adafruit Feather nRF52840 Sense using the S140 soft device v. 7.0.1  I'm compiling the example successfully on an Ubuntu computer and flashing it to the board successfully, but it doesn't work.  I have debugging working over a serial port through a CP2104 board, but get no error or warning messages (logging is turned on for all modules at the error and warning levels in the SDK).  Using my own log messages, I've determined that ble_stack_init() doesn't return.  Tracing the problem down, ble_stack_init() calls nrf_sdh_ble_enable(&ram_start), which calls sd_ble_enable(p_app_ram_start), which doesn't return.  Does anyone have experience with a problem like this or any idea as to what might be causing the function to not return with no error message?

  • Did you flash the SoftDevice in addition to the firmware?

  • Thanks for your reply - I did flash the SoftDevice.

  • I suspect that the Adafruit Feather doesn't have an external LFXTAL. This is the most common pitfall when users tries to use "custom" PCBs. 

    Open sdk_config.h in your project and look for the following definitions, and set them accordingly:

    #define NRF_SDH_CLOCK_LF_SRC 0
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #define NRF_SDH_CLOCK_LF_ACCURACY 1

    I believe that this should solve your issue.

    Some background:

    The nRF has two options for the LFCLK. Either it can use an external LFXTAL, or the internal RC Oscillator. The nRF52840 DK has an external LFXTAL, so it is used by default in most examples. If the custom PCB doesn't have this external LFXTAL, and the project sets the LFCLK source to an external XTAL, the softdevice will try to start this XTAL, and wait for it to respond. If it doesn't respond, the softdevice will just stop in this wait state, which is probably what you are seeing.

    Regarding the specific numbers that you should set in the sdk_config.h (pasted above), please see the description of the struct nrf_clock_lf_cfg_t in nrf_sdm.h.

    Best regards,

    Edvin

Related