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

NRF52832 External LF clock

Hi,

I am trying to configure the nRF52832 on my custom board to work on the 32.768KHz clock signal from the host controller. I have configured the LFCLKSRC register to use the external source and I start the LFCLK. But the clock does not seem to start.

Here is the code that I used to configure my register.

NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos)|(CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos ) |
(CLOCK_LFCLKSRC_EXTERNAL_Enabled << CLOCK_LFCLKSRC_EXTERNAL_Pos);

NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
{//do nothing
}

The code hangs in the while loop forever. If I comment the while loop out, the code hangs in softdevice setup.

#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};

This is the clock configuration I use for the softdevice setup. If I use the RC oscillator or the SYNTH source, everything works error free.
Also my host controller works on its own without any problems. The clock line is connected to XL1 and XL2 is grounded.

What could be the cause of this error? I suspect that the SNR of the clock is poor causing this problem. Is that possible?

Parents Reply
  • I don't think it have been supported before. When the SoftDevice is enabled the BYPASS and EXTERNAL bit is set to 0 by the SoftDevice, and this cannot be changed after the SoftDevice is enabled. We might add support for this in the api in a future SoftDevice version.

    EDIT: BYPASS and EXTERNAL bit is set to 0 only if the LFCLK is not already running before enabling the SoftDevice. I.e. workaround is to configure and enable LFCLK before the SoftDevice is enabled.

Children
Related