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

Is NRF_CLOCK_LFCLKSRC broken by SDK 14 BLE Init changes?

In the Infocenter, there is a section about adding support for custom boards. It advises the creation of custom_board.h modeled after pca10040.h. However, the configuration of the clock source used for the softdevice found in these files doesn't seem to do anything.

#define CUSTOM_CLOCK_SRC    NRF_CLOCK_LF_SRC_RC
#define CUSTOM_RC_TEMP_CTIV 2
#define CUSTOM_CLOCK_LF_ACC NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM

#if defined (S212)
// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC      {.source        = CUSTOM_CLOCK_SRC,            \
                                 .rc_ctiv       = CUSTOM_RC_CTIV,                                \
                                 .rc_temp_ctiv  = CUSTOM_RC_TEMP_CTIV,                                \
                                 .xtal_accuracy = CUSTOM_CLOCK_LF_ACC}
#else

#define NRF_CLOCK_LFCLKSRC      {.source       = CUSTOM_CLOCK_SRC,      \
                                 .rc_ctiv      = CUSTOM_RC_CTIV,                          \
                                 .rc_temp_ctiv = CUSTOM_RC_TEMP_CTIV,                          \
                                 .accuracy     = CUSTOM_CLOCK_LF_ACC}
#endif

This config section seems to get ignored by the new ble_init process. Instead, there are now configuration variables in the sdk_config.h that set the same options.

#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_XTAL_ACCURACY 0 

We are using the new softdevice init option

nrf_sdh_ble_default_cfg_set(conn_cfg_tag, &ram_start);  /* Configure the BLE stack with the settings specified in sdk_config. */

Does this new option override the old config struct in the custom_board header? If so, I would suggest a change to remove the NRF_CLOCK_LFCLKSRC structs from the board config files.

Related