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

How to output 32768Hz external crystal LFCLK at a GPIO pin?

For synchronizing an external sensor i need to output a 32768Hz clock at a GPIO pin. For this case i want to use LFCLK from the external cyrstal.

My setup: I use RTC0 to generate a tick event with prescaler set to "0". The tick event is connected to PPI Event End Point EEP, the PPI Task End Point TEP is connected to a GPIOTE Task Out which toggles the GPIO pin polarity.

This setup works for me except in one point. The output clock is 16384Hz and not 32768Hz as desired.

Due to the tick event occurs only on the rising edge on LFLCLK and so the pin toggles only at one edge and not at both edges of LFCLK the clock out is only half of LFCLK. (as seen in the attached picture)

My question: Is there a way to get LFCLK as clock output at a GPIO pin with 32768Hz? Preferred is a hardware only solution. I want to use the 32768Hz crystal due to better accuracy and lower power.

2014-01-10_172045.png

  • XL2 which is pin 45 of the QFN48 package is designated as an analog output which is one of the connections to a low frequency crystal.

    I do not know how much loading you can place on this pin (I assume very little) but perhaps a buffer could be attached to that pin. Alternatively, build the feedback circuit yourself and feed the nrf chip via its XL1 pin as an external reference.

    Of course prototype before committing since with too much loading, the xtal might not start up.

  • XL1 and XL2 pins are designed to connect an external crystal which is the case in my hardware (nRF51822 EK atm). I think this pins should not be touched when there is a external crystal connected to not affect the internal oscillator loop.

    Otherwise my sensor needs a square wave clock signal.

    This is the first time i'm using an ARM, but i know from other MCU they could easily output the CPU system clock and/or RTC clock signal at a pin, which is very useful.

  • So no more reply on this means it is not possible?

    Further question: Could i feed in a 32768Hz square wave clock signal (from an oscillator) and use this as clock source for LFCLK (bypassing the nrf internal oscillator). The square wave clock signal from the external oscillator and drive both the nrf and sensor in sync.

  • Hi Buergervrm,

    As Syntroniks already suggested, you can tap the XL2 and get the crystal signal from there. If your sensor need a crystal clock signal, you should be fine. If your sensor expect to have full swing clock signal then you may need to buffer the signal.

    The other solution is good also. You can feed the XL1 with external 32768kHz from external oscillator and leave XL2 open. This has been described at section 12.1.1 in the nRF51 Series Reference.

  • Yes,

    You may connect an External 32khz Osc to the device.

    Pin #46 XL1 Connection for 32.768 kHz crystal or external 32.768 kHz

Related