View or comment on this project log on Hackaday.io
At the very last minute before ordering my PCBs, I realized I probably wanted a real-time clock on the board somewhere. I searched on Digi-Key, found the RV-8263-C7, which was:
- in stock (not anymore, lol)
- cheap
- tiny
- requires minimal external components (just a decoupling cap and a pull-up resistor on an output enable pin)
- has a Linux kernel driver (this chip has the same protocol as the PCF85063)
I found an empty spot on my board with I2C and VBAT lines nearby, and laid it out in a few minutes.
Tonight, I decided to see if it was working:
Throw together a quick dtoverlay file:
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
rv8263: rtc@51 {
compatible = "microcrystal,rv8263";
reg = <0x51>;
// quartz-load-femtofarads = <12500>;
};
};
};
};
(This is basically just device tree overlay boilerplate plus the example from the documentation.)
Compile with make -j4 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs
, copy the output dtbo
file to the CM4's /boot/overlays directory, and run dtoverlay pipad-rtc.dtbo
to load the overlay. Test with sudo hwclock --systohc
then sudo hwclock --get
. Add dtoverlay=pipad-rtc
to /boot/config.txt, reboot, check sudo hwclock --get
again, and it's still working.
Remove the fake-hwclock
package and disable the systemd unit with the instructions on https://pimylifeup.com/raspberry-pi-rtc/, and double-check that it's actually reading the hardware clock on startup (and not just using NTP) by using rfkill block wifi
to turn off wifi, reboot, and check that the time is accurate.
No incorrect PCB footprints or unwired pins, no Linux kernel debugging. Just things working correctly on the first try. Feels good.