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

sd_softdevice_enable() blocks on a custom board with nrf51822

Hi,

I have developed an application on an nrf51dk, with SDK12.3 (as it was the latest that I could make it work with). It is running fine on the DK, but when moving to the custom pcb i ran into a few problems, one of them being the ble_stack_init() doesn't return because it makes a call to sd_softdevice_enable(), which blocks.

While searching for solutions, I found many other people with similar problems, and this one was actually providing with a working configuration:

devzone.nordicsemi.com/.../ble-examples-halt-at-sd_softdevice_enable-on-the-custom-board

As per this post, I ended up using:

    nrf_clock_lf_cfg_t clock_lf_cfg =
    {
        .source       = 0,                                  // => 0 (initial value=1)
        .rc_ctiv      = 16,           // => 16 (initial value=0)
        .rc_temp_ctiv = 2,      // => 0 (initial value=0)
        .xtal_accuracy     = NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM  // => 7 (initial value=7)
    };

This solution works.

Now the question is: what would be the best configuration for the crystal on our board (EPSON X1E0000210120 TSX-3225 16MHZ)?

Best regards,

Ricardo

Parents
  • Hi again

    There are two crystals that can be connected to the nRF51 series devices. It is the High-frequency crystal (HFCLK), which is the EPSON X1E0000210120 TSX-3225 16MHZ that you presumably have mounted on XC1 and XC2. There is also the optional low-frequency crystal (LFCLK), which would be a 32kHz crystal mounted on the XL1 and XL2 pins. This is the crystal configured by the nrf_clock_lf_cfg parameter, and setting the .source to 0 will cause the device to use an internal RC oscillator instead of this optional 32kHz crystal. See the reference circuitry below.

    The best configuration for your custom board which it seems does not have any external 32kHz crystal would be the configuration you posted in the ticket above.

    Best regards,

    Simon

Reply
  • Hi again

    There are two crystals that can be connected to the nRF51 series devices. It is the High-frequency crystal (HFCLK), which is the EPSON X1E0000210120 TSX-3225 16MHZ that you presumably have mounted on XC1 and XC2. There is also the optional low-frequency crystal (LFCLK), which would be a 32kHz crystal mounted on the XL1 and XL2 pins. This is the crystal configured by the nrf_clock_lf_cfg parameter, and setting the .source to 0 will cause the device to use an internal RC oscillator instead of this optional 32kHz crystal. See the reference circuitry below.

    The best configuration for your custom board which it seems does not have any external 32kHz crystal would be the configuration you posted in the ticket above.

    Best regards,

    Simon

Children
  • Simon,

    Thanks for taking the time to review my settings.

    You are right, my PCB actually doesn't have the optional low frequency crystal.

    BLE was already working with my settings. I was just wondering if there would be any tweaking of any of these fields necessary.

    I would be much more confident in using them if they actually had defines for them, namely the .rc_ctiv and .rc_temp_ctiv fields, but I'll just leave at that, since it is working.

    Best regards,

    Ricardo

Related