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

NRF51 DK - X2 Oscillator

Hello, I'm using NRF51-DK (PCA10028) and I want to be sure if I'm using the external 32KHz oscillator (X2).

I'm using SDK12.3.0. I'm running the beacon example.

In example, I'm looking at decleration

nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

in ble_stack_init() function.

When going to NRF_CLOCK_LFCLKSRC definition, it says,

// Low frequency clock source to be used by the SoftDevice
#ifdef S210
#define NRF_CLOCK_LFCLKSRC      NRF_CLOCK_LFCLKSRC_XTAL_20_PPM
#else
#define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_XTAL,            \
                                 .rc_ctiv       = 0,                                \
                                 .rc_temp_ctiv  = 0,                                \
                                 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
#endif

I think, it is using the X2 osciallator default. Is it right?

When I check the HFCLKSTAT with nrfjprog --memrd 0x4000040C -n 4, it returns

0x4000040C: 00010000 |....|

So, it says its using the internal 16MHz HFCLK.

There is a confliction here that I cant undertand. Can you help please?

Thanks

  • Yes that configuration is right to start the LF clock. If you want to confirm which LF clock is running why are you reading the HF clock register? That's not going to tell you anything (well it will, it will tell you what HF clock is running which is usually the internal RC until the crystal is needed). Read 0x40000418 and see what that says.

Related