Hi,
I would like to seek a guidance with proper usage of DS3231 as LFXO with nRF5340.
HW:
Custom board, DS3231 32kHz output connected to nRF's X1 with pull-up resistor. X2 floating. INT/SQW floating (we don't need sub-seconds accuracy). Both SOC and IC powered on the same 3.3 rail.
Software:
nRF Connect SDK 3.1.1.
Active-low input gpio-hog on DS3231 reset/nonitor pin.
Default devicetree settings for builtin LFXO in SOC:
&lfxo {
load-capacitors = "internal";
load-capacitance-picofarad = <7>;
};
ds3231@68 {
compatible = "maxim,ds3231-mfd";
reg = <0x68>;
status = "okay";
temp_sensor: temp_sensor {
compatible = "maxim,ds3231-sensor";
status = "okay";
};
rtc: rtc {
compatible = "maxim,ds3231-rtc";
status = "okay";
isw-gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; // DUMMY
freq-32khz-gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; // DUMMY
};
};App's config:CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y CONFIG_CLOCK_CONTROL_NRF_K32SRC_20PPM=y
The 32.768 kHz crystal oscillator (LFXO) is designed to work with external sources.
The following external sources are supported:
- A low swing clock. The signal should be applied to the XL1 pin with the XL2 pin grounded. Set OSCILLATORS.XOSC32KI.BYPASS=Disabled.
- A rail-to-rail clock. The signal should be applied to the XL1 pin with the XL2 pin left unconnected. Set OSCILLATORS.XOSC32KI.BYPASS=Enabled.
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
&lfxo {
load-capacitors = "external";
};CLOCK_CONTROL_NRF_K32SRC_XTAL=y