LFCLK External Xtal and Soft Device

I am attempting to enable the external LFCLK. I want the clock to swing rail to rail.  I have the following code in place.

    /* Start low frequency crystal oscillator for app_timer(used by bsp)*/
    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_EXTERNAL_Enabled  << CLOCK_LFCLKSRC_EXTERNAL_Pos);
    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART    = 1;

    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;


I am using the s140 v 7.2 soft device and the nRF5_SDK_17.0.2_d674dde version of the sdk.

Is there some additional configuration step I'm missing?


Parents Reply Children
  • Sigurd, I am seeing a 32kHz 200mV peak to peak signal on the crystal.  200mV is smaller than we expected, but I do see that the electrical characteristics for the LFXO lists a peak to peak amplitude between 200mV and 1V. 

    Is there a way increase that amplitude to the 1V end of the range?  Our application is monitoring the 32kHz clock signal, buffered by an op-amp, and were expecting that signal to be in the 1V peak to peak range.

    Also, I've read in other discussion threads that if the 32kHz signal is not configured correctly that the soft device will not advertise.  I am seeing the device advertising when scanning; does that suggest that the clock actually is enabled correctly?

  • Also, the code snippet I posted in the original is wrong, but I can't seem to edit.  Here is what I'm actually running:

        /* Start low frequency crystal oscillator for app_timer(used by bsp)*/
        NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    
        NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    
        while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
        {
            // Do nothing.
        }

  • Hi

    Connecting a OpAmp to the LFXO is a bit unusual, and I will have to look some more this.

    I will get back with more information tomorrow.

    Regards,
    Sigurd Hellesvik

  • stevebedford said:
    Also, I've read in other discussion threads that if the 32kHz signal is not configured correctly that the soft device will not advertise.  I am seeing the device advertising when scanning; does that suggest that the clock actually is enabled correctly?

    This is correct if the Softdevice is configured to use the LFCLK. Have you configured a clock source for the Softdevice in your application?

    Regards,
    Sigurd Hellesvik

Related