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

PCA20020 Internal Oscillator

I'm using a custom board based on the Thingy52 board and firmware that uses the BMD-350 module containing the nRF52832..  I'd like to use the internal RC oscillator for the low frequency clock for BLE instead of the external crystal on the board.  There are two places where this can be changed from what I've read.

1. pca20020.h

I've tried changing the NRF_CLOCK_LFCLKSRC definition to the following:

// Low frequency clock source to be used by the SoftDevice
#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
                                 .rc_ctiv       = 16,                                \
                                 .rc_temp_ctiv  = 2,                                \
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM}

2. sdk_config.h

There's a section of code dealing with the clock that I've changed to the following as well:

// <e> CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver
//==========================================================
#ifndef CLOCK_ENABLED
#define CLOCK_ENABLED 1
#endif
#if  CLOCK_ENABLED
// <o> CLOCK_CONFIG_XTAL_FREQ  - HF XTAL Frequency
 
// <0=> Default (64 MHz) 

#ifndef CLOCK_CONFIG_XTAL_FREQ
#define CLOCK_CONFIG_XTAL_FREQ 0
#endif

// <o> CLOCK_CONFIG_LF_SRC  - LF Clock Source
 
// <0=> RC 
// <1=> XTAL 
// <2=> Synth 

#ifndef CLOCK_CONFIG_LF_SRC
#define CLOCK_CONFIG_LF_SRC 0
#endif

Are any further definitions or settings needed to use the internal RC oscillator?

Thanks!

Parents
  • Hi,

     

    The selection of the clock for the BLE part is done in the "old method", where it is passed as a struct to the softdevice init function.

    This is done, as you mention, with the pca20020.h, macro "NRF_CLOCK_LFCLKSRC", which is then applied in m_ble.c::ble_stack_init(). By changing this macro to the RC oscillator, the bluetooth part shall now run on RC oscillator.

    However; since the CLOCK_ENABLED is set to '1', it will also allow the softdevice_init to initialize the nrf_drv_clock driver. Could you try setting both of them to RC oscillator, ie: the NRF_CLOCK_LFCLKSRC macro + the CLOCK_CONFIG_LF_SRC macro?

    Kind regards,

    Håkon

Reply
  • Hi,

     

    The selection of the clock for the BLE part is done in the "old method", where it is passed as a struct to the softdevice init function.

    This is done, as you mention, with the pca20020.h, macro "NRF_CLOCK_LFCLKSRC", which is then applied in m_ble.c::ble_stack_init(). By changing this macro to the RC oscillator, the bluetooth part shall now run on RC oscillator.

    However; since the CLOCK_ENABLED is set to '1', it will also allow the softdevice_init to initialize the nrf_drv_clock driver. Could you try setting both of them to RC oscillator, ie: the NRF_CLOCK_LFCLKSRC macro + the CLOCK_CONFIG_LF_SRC macro?

    Kind regards,

    Håkon

Children
Related