glambert Posted March 30 Posted March 30 Hello, I am trying to connect a ds3231 module to get time during boot (dns does'nt like 1970) and without internet connexion. I load a recent build UBUNTU 26.2.1 on the M5 but unfortunatly after 2 days of research with chatgpt , I ask to knowledge experience people if they know if it's possible and which kind of dts can make this module up and running. I did'nt identify a dtbo on the distribution , a made a lot of investigation , pin 3 and 5 og the 40pins connector is connect to the cpu with pullup resistor , i try a lot dts conf and nothing gave result. If some one did this kind of connexion thanks in advance. Gérard 0 Quote
tparys Posted Thursday at 01:01 AM Posted Thursday at 01:01 AM (edited) So, I went through this recently on an NVidia device, and device tree overlays really aren't that hard. But there's a few things you'll need to get set up first, and not having an M5 to check, you'll probably have to do some reading / verification. I make no claim this will work out of the box for you. But I imagine this will save you a lot of reading. There's an example .dtbo at https://github.com/KF0ARE/i2c0-rtc.dtbo/blob/main/i2c0-rtc.dtbo you should look at, and you can decompile it with the following: dtc -O dts -o i2c0-rtc.dts i2c0-rtc.dtbo Which contains a fragment you'll be interested in, explicitly for the DS3231 ... /dts-v1/; / { compatible = "brcm,bcm2708"; ... snip ... fragment@3 { target = <0xffffffff>; __dormant__ { #address-cells = <0x01>; #size-cells = <0x00>; status = "okay"; ds3231@68 { compatible = "maxim,ds3231"; reg = <0x68>; status = "okay"; phandle = <0x04>; }; }; }; ... snip ... }; But you can't use this directly, because "compatible" doesn't include your M5, and "target" doesn't point anywhere useful in your DT. But it does call out the ds3231, and that it's at I2C address 0x68, so you can use that to find where the kernel thinks your RTC is. Take a look at where your I2C buses are (/dev/i2c-*) and just scan each of them like this to see if you can find it: tparys@pebble:~$ sudo i2cdetect -y -r 0 # NOTE: I2C bus #0 is /dev/i2c-0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- In the above, address 0x10 is unusable as there's something else bound at that register. But check your buses to see if you can find 0x68. If you see something other than "--" or "UU" there, that's probably it. If you can't find it, double check that it's connected, powered on, and that your I2C bus has been enabled (might need to enable via DTB). Once you find it, you should be able to register it by doing something similar to the below as root (driver and I2C bus may be different): echo ds3231 0x68 > /sys/bus/i2c/devices/i2c-0/new_device If that works, and creates a /dev/rtc0 device, test that it's working with "hwclock". Once it's working, it's time to make your .dtbo. You'll probably want to dump your main .dtb with the same dtc command above, and look for i2c-0 (or whatever other bus you found), as well as a .dtbo or two for your M5 to find text to enter for "compatible". And you'll end up with something like this, saved as "m5-ds3231.dts" (or whatever): /dts-v1/; /plugin/; / { compatible = "brcm,bcm2708"; // <---- Change this fragment@0 { target = "i2c-0"; // <---- Change this __overlay__ { #address-cells = <0x01>; #size-cells = <0x00>; status = "okay"; ds3231@68 { compatible = "maxim,ds3231"; reg = <0x68>; status = "okay"; phandle = <0x04>; }; }; }; }; And you'll compile it like this: dtc -@ -O dtb -o m5-ds3231.dtbo m5-ds3231.dts And check it against your M5's DTB like below. Note that "target" or "target-path" has some odd syntax requirements. Quotes with a leading slash is a full path to your I2C device. Quotes without a leading slash is an alias. And angle brackets with an ampersand is a label (not everything has an explicit label). Worst case scenariou, call out the whole path in "target-path" with a leading slash, and call it a day. I beat my head against a wall for a while here before I realized I could test this without rebooting ... fdtoverlay -i /path/to/your/used.dtb -o modified.dtb m5-ds3231.dtbo And then add it to your overlay directory (/boot/dtb/CHIPNAME/overlays), enable it armbianEnv.txt, and give it a go? There's also two kernel build configs that may be of interest as well: CONFIG_RTC_HCTOSYS_DEVICE="rtc0" CONFIG_RTC_SYSTOHC_DEVICE="rtc0" The first triggers the kernel to load time from a given RTC when it first shows up. The second will tell the system to update RTC when locked against NTP. FYI, it seems that you can change these only with a new kernel build. Edited Thursday at 01:04 AM by tparys 0 Quote
glambert Posted Thursday at 06:03 PM Author Posted Thursday at 06:03 PM Thanks for your help. Unfortunatly there are few progress. I change in the global dts of the board the state of all the i2c descriptor from disable to okay and the device i2c-0 to 3 appear in linux, unfortunatly i2cdetect does'nt see the device on address 68 i2c@1c000 { compatible = "amlogic,meson-axg-i2c"; status = "disabled"; reg = <0x00 0x1c000 0x00 0x20>; interrupts = <0x00 0x27 0x01>; #address-cells = <0x01>; #size-cells = <0x00>; clocks = <0x02 0x18>; phandle = <0x12d>; }; I try a lot of tracks with the overlay but nothing change. And it's very difficult to debug and understand what is missing dtoverlay is not available nothing in syslog during boot and quite frankly I have'nt experience in dts design. the only information is the schematic of the board which describe pin3(40pins connector) =GPIOX_17 and pin5 =GPIOX_18 of the processor. inside the processor the route between the ports and the software is a mystery for me (mux adress of register ...) and how to link all that in the dtbo. Thanks if you can give me some direction ? 0 Quote
c0rnelius Posted Thursday at 07:13 PM Posted Thursday at 07:13 PM Here is an example of an overlay for adding an RTC to the radxa zero /dts-v1/; /plugin/; / { compatible = "radxa,zero", "amlogic,g12a"; fragment@0 { target-path = "/"; __overlay__ { aliases { rtc0 = &rtc; }; }; }; fragment@1 { target = <&i2c3>; __overlay__ { #address-cells = <1>; #size-cells = <0>; rtc: rtc@68 { compatible = "dallas,ds1307"; reg = <0x68>; wakeup-source; }; }; }; __overrides__ { rtc = <0>,"+0"; addr = <&rtc>, "reg:0"; }; }; Key bits here: * aliases (some of these AML units have vrtc on rtc0, so it may need to be set to rtc1) * i2c# (this should be obvious) * compatible string * wakeup-source The i2c-dev module must be force loaded in some cases. If it isn't hard coded into the kernel, you can add it to /etc/modules 0 Quote
tparys Posted Friday at 01:24 AM Posted Friday at 01:24 AM Quote I change in the global dts of the board It may be better to do this with an overlay, as a kernel update will wipe out any changes you make. Quote Thanks if you can give me some direction ? If you're not seeing anything on any of the I2C buses, I'd first check your wiring. You should have 4 wires, SCL, SDA, GND, and either +3.3V or +5V (depending). Next, I'd check for similar boards to your M5. A quick search suggests it's an Amlogic S905X3, which is the same Meson SM1 CPU as the ODroid C4. And there's a pair of ODroid C4's overlays to enable I2C, and they're doing more than setting the status to "okay". May be worth a try? - meson-sm1-odroid-c4-i2c0.dtbo - meson-sm1-odroid-c4-i2c1.dtbo Failing that, I'd check to see if there's anything useful in the Banana Pi forums or documentation on how to enable those I2C buses. I'm afraid some of the Amlogic documentation may be somewhat limited. 0 Quote
glambert Posted Friday at 11:51 AM Author Posted Friday at 11:51 AM bellow the conclusion of 4 days of investigations and it works create dts file in tmp directory root@bananapim5:/home/gerard# cat meson-sm1-bananapi-m5-i2c0.dts /dts-v1/; /plugin/; / { compatible = "amlogic,meson-sm1"; fragment@0 { target-path = "/soc/bus@ffd00000/i2c@1d000"; __overlay__ { status = "okay"; clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins>; }; }; fragment@1 { target-path = "/soc/bus@ff600000/bus@34400/pinctrl@40"; __overlay__ { i2c2_pins: i2c2_pins { mux { groups = "i2c2_sda_x", "i2c2_sck_x"; function = "i2c2"; bias-disable; drive-strength-microamp = <3000>; }; }; }; }; fragment@2 { target-path = "/soc/bus@ffd00000/i2c@1d000"; __overlay__ { #address-cells = <1>; #size-cells = <0>; rtc@68 { compatible = "maxim,ds3231"; reg = <0x68>; }; }; }; }; compile the dts on a tmp directory root@bananapim5:/home/gerard# dtc -@ -I dts -O dtb -o meson-sm1-bananapi-m5-i2c0.dtbo meson-sm1-bananapi-m5-i2c0.dts Copy the output to the /boot environnement root@bananapim5:/home/gerard# cp meson-sm1-bananapi-m5-i2c0.dtbo /boot/dtb-6.18.15-current-meson64/amlogic/overlay/meson-sm1-bananapi-m5-i2c0.dtbo modify the boot file /boot/armbianEnv.txt to setup the overlay root@bananapim5:/home/gerard# cat /boot/armbianEnv.txt verbosity=1 console=both overlay_prefix=meson fdtfile=amlogic/meson-sm1-bananapi-m5.dtb rootdev=UUID=d5516764-cadb-4a54-9453-6c500b56656c rootfstype=btrfs overlays=sm1-bananapi-m5-i2c0 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u root@bananapim5:/home/gerard# then a bad surprise the utility hwclock was not in the distro get the package util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb and install it root@bananapim5:/home/gerard# wget http://launchpadlibrarian.net/801453777/util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb --2026-04-03 10:46:26-- http://launchpadlibrarian.net/801453777/util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb Resolving launchpadlibrarian.net (launchpadlibrarian.net)... 2620:2d:4000:1009::3b8, 2620:2d:4000:1009::13e, 185.125.189.229, ... Connecting to launchpadlibrarian.net (launchpadlibrarian.net)|2620:2d:4000:1009::3b8|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 122602 (120K) [application/x-debian-package] Saving to: ‘util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb’ util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb 100%[=========================================================================================================================================>] 119.73K --.-KB/s in 0.05s 2026-04-03 10:46:26 (2.42 MB/s) - ‘util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb’ saved [122602/122602] root@bananapim5:/home/gerard# dpkg -i util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb Selecting previously unselected package util-linux-extra. (Reading database ... 25343 files and directories currently installed.) Preparing to unpack util-linux-extra_2.39.3-9ubuntu6.3_arm64.deb ... Unpacking util-linux-extra (2.39.3-9ubuntu6.3) ... Setting up util-linux-extra (2.39.3-9ubuntu6.3) ... Processing triggers for man-db (2.12.0-4build2) ... root@bananapim5:/home/gerard# you can reboot the module for rtc is download automaticly no need load any module boot and hwclock command to test with the version and build used on my bpi m5 v26.2.1 for Banana Pi M5 running Armbian Linux 6.18.15-current-meson64 Packages: Ubuntu stable (noble) IPv4: (LAN) 192.168.1.243 IPv6: xxxxxxx Performance: Load: 19% Uptime: 1m Memory usage: 7% of 3.67G CPU temp: 41°C Usage of /: 5% of 14G Tips: Flash Armbian from macOS, Windows, and Linux https://tinyurl.com/mryujx5u Commands: Configuration: armbian-config Monitoring : htop Last login: Fri Apr 3 09:54:29 2026 from 192.168.1.101 root@bananapim5:~# hwclock -r -f /dev/rtc1 2026-04-03 11:15:15.211101+02:00 root@bananapim5:~# root@bananapim5:~# Story not finished I try to integrate rtc1 as a fallback to ntp and chrony unfortunatly i was not able to install chrony on this distro (the last one avalaible for m5) so I try apt update and apt upgrade surprise upgrade downgrade from 6.18.15 to 6.18.10 the system but install util-linux-extra and allow chrony installation After that I create the necessary service to boot with rtc1 then start chrony and update system clock with ntp or rtc1 depending of availablility of internet root@bananapim5:/etc/systemd/system# cat sync-* ds3231-rtc.service [Unit] Description=Synchronize RTC1 with system or NTP fallback After=chronyd.service [Service] Type=oneshot ExecStart=/usr/rtc/sync-rtc1.sh [Unit] Description=Run RTC1 sync every hour [Timer] OnBootSec=5min OnUnitActiveSec=5min Unit=sync-rtc1.service [Install] WantedBy=timers.target [Unit] Description=Synchronize system time from DS3231 RTC DefaultDependencies=no Before=sysinit.target [Service] Type=oneshot ExecStart=/sbin/hwclock -s -f /dev/rtc1 RemainAfterExit=yes [Install] WantedBy=sysinit.target root@bananapim5:/etc/systemd/system# cat /usr/rtc/sync-rtc1.sh #!/bin/bash # sync-rtc1.sh # Synchronisation RTC1 <-> système avec logging # Vérifie si Chrony a des sources NTP actives NTP_OK=$(chronyc tracking | grep 'Reference ID' | grep -v '0.0.0.0') if [ -n "$NTP_OK" ]; then # Chrony OK, mettre RTC1 à jour depuis l’heure système hwclock -w -f /dev/rtc1 logger -t sync-rtc1 "NTP actif : mise à jour RTC1 depuis l'heure système" else # NTP indisponible, remettre l’heure système depuis RTC1 hwclock -s -f /dev/rtc1 logger -t sync-rtc1 "NTP indisponible : mise à jour de l'heure système depuis RTC1" fi root@bananapim5:/etc/systemd/system# end of story. log of the result 2026-04-03T13:24:30.009238+02:00 bananapim5 sync-rtc1: NTP indisponible : mise à jour de l'heure système depuis RTC1 2026-04-03T13:24:30.013803+02:00 bananapim5 systemd[1]: sync-rtc1.service: Deactivated successfully. 2026-04-03T13:24:30.014705+02:00 bananapim5 systemd[1]: Finished sync-rtc1.service - Synchronize RTC1 with system or NTP fallback. 2026-04-03T13:29:35.005855+02:00 bananapim5 systemd[1]: Starting sync-rtc1.service - Synchronize RTC1 with system or NTP fallback... 2026-04-03T13:29:36.001355+02:00 bananapim5 systemd-resolved[1433]: Clock change detected. Flushing caches. 2026-04-03T13:29:36.010529+02:00 bananapim5 sync-rtc1: NTP indisponible : mise à jour de l'heure système depuis RTC1 2026-04-03T13:29:36.016160+02:00 bananapim5 systemd[1]: sync-rtc1.service: Deactivated successfully. 2026-04-03T13:29:36.016473+02:00 bananapim5 systemd[1]: Finished sync-rtc1.service - Synchronize RTC1 with system or NTP fallback. 2026-04-03T13:30:01.478054+02:00 bananapim5 CRON[2521]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs) 2026-04-03T13:34:44.331407+02:00 bananapim5 systemd[1]: Starting sync-rtc1.service - Synchronize RTC1 with system or NTP fallback... 2026-04-03T13:34:45.001445+02:00 bananapim5 systemd-resolved[1433]: Clock change detected. Flushing caches. 2026-04-03T13:34:45.010331+02:00 bananapim5 sync-rtc1: NTP indisponible : mise à jour de l'heure système depuis RTC1 2026-04-03T13:34:45.015243+02:00 bananapim5 systemd[1]: sync-rtc1.service: Deactivated successfully. 2026-04-03T13:34:45.016212+02:00 bananapim5 systemd[1]: Finished sync-rtc1.service - Synchronize RTC1 with system or NTP fallback. 2026-04-03T13:36:55.097288+02:00 bananapim5 chronyd[1725]: chronyd exiting 2026-04-03T13:36:55.098535+02:00 bananapim5 systemd[1]: Stopping chrony.service - chrony, an NTP client/server... 2026-04-03T13:36:55.106444+02:00 bananapim5 systemd[1]: chrony.service: Deactivated successfully. 2026-04-03T13:36:55.107444+02:00 bananapim5 systemd[1]: Stopped chrony.service - chrony, an NTP client/server. 2026-04-03T13:36:55.130493+02:00 bananapim5 systemd[1]: Starting chrony.service - chrony, an NTP client/server... 2026-04-03T13:36:55.296466+02:00 bananapim5 chronyd[2559]: chronyd version 4.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG) 2026-04-03T13:36:55.297080+02:00 bananapim5 chronyd[2559]: Loaded 0 symmetric keys 2026-04-03T13:36:55.298281+02:00 bananapim5 chronyd[2559]: Frequency -22.284 +/- 4.769 ppm read from /var/lib/chrony/chrony.drift 2026-04-03T13:36:55.298541+02:00 bananapim5 chronyd[2559]: Using right/UTC timezone to obtain leap second data 2026-04-03T13:36:55.302159+02:00 bananapim5 chronyd[2559]: Loaded seccomp filter (level 1) 2026-04-03T13:36:55.308879+02:00 bananapim5 systemd[1]: Started chrony.service - chrony, an NTP client/server. 2026-04-03T13:37:00.601703+02:00 bananapim5 chronyd[2559]: Selected source 2620:2d:4000:1::41 (ntp.ubuntu.com) 2026-04-03T13:37:00.602025+02:00 bananapim5 chronyd[2559]: System clock TAI offset set to 37 seconds 2026-04-03T13:37:01.826456+02:00 bananapim5 chronyd[2559]: Selected source 2001:41d0:2:c837::123 (2.ubuntu.pool.ntp.org) 2026-04-03T13:40:11.651555+02:00 bananapim5 systemd[1]: Starting sync-rtc1.service - Synchronize RTC1 with system or NTP fallback... 2026-04-03T13:40:12.008233+02:00 bananapim5 sync-rtc1: NTP actif : mise à jour RTC1 depuis l'heure système 2026-04-03T13:40:12.011630+02:00 bananapim5 systemd[1]: sync-rtc1.service: Deactivated successfully. 2026-04-03T13:40:12.012299+02:00 bananapim5 systemd[1]: Finished sync-rtc1.service - Synchronize RTC1 with system or NTP fallback. 2026-04-03T13:45:01.529270+02:00 bananapim5 CRON[2593]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs) 2026-04-03T13:45:12.987841+02:00 bananapim5 systemd[1]: Starting sync-rtc1.service - Synchronize RTC1 with system or NTP fallback... 2026-04-03T13:45:14.008414+02:00 bananapim5 sync-rtc1: NTP actif : mise à jour RTC1 depuis l'heure système 2026-04-03T13:45:14.012561+02:00 bananapim5 systemd[1]: sync-rtc1.service: Deactivated successfully. 2026-04-03T13:45:14.012904+02:00 bananapim5 systemd[1]: Finished sync-rtc1.service - Synchronize RTC1 with system or NTP fallback. 2026-04-03T13:45:14.013548+02:00 bananapim5 systemd[1]: sync-rtc1.service: Consumed 1.028s CPU time. 2026-04-03T13:45:37.968500+02:00 bananapim5 chronyd[2559]: Selected source 2620:2d:4000:1::40 (ntp.ubuntu.com) root@bananapim5:/etc/systemd/system# 0 Quote
tparys Posted 17 hours ago Posted 17 hours ago (edited) On 4/3/2026 at 7:51 AM, glambert said: it works Nicely done. As some additional thoughts: 1. Fragment 0 and 2 of your .dts point to the same spot. They could be combined if you'd like. 2. The util-linux-extra package should be part of the core Ubuntu distribution. An apt install should have been enough, though you may need to enable the universe repository. 3. If you have a /dev/rtc1 device, that suggests that you have an rtc0 as well, and if you disable it, the kernel will natively load and store time to the one you provided. A quick glance at the .dts suggests one at /soc/bus@ff800000/rtc@a8. Adding one final fragment to your overlay like the below might allow you to skip need of hwclock, and both SystemD services for your RTC. See my note about CONFIG_RTC_HCTOSYS_DEVICE and CONFIG_RTC_SYSTOHC_DEVICE above. fragment@3 { target-path = "/soc/bus@ff800000/rtc@a8"; __overlay__ { status = "disabled"; }; }; 4. If you're up for it, submit a PR to create a dtbo for the I2C buses on the M5? Contributions to the project are always welcome. Edited 17 hours ago by tparys 0 Quote
glambert Posted 1 hour ago Author Posted 1 hour ago @tparys Thanks for your precious advices I merged them in one dts. This suppress the dummy rtc0 rplace it by the real ds3231 rtc , and as it's rtc0 linux uses it at boot with out any service or script. the dts : /dts-v1/; /plugin/; / { compatible = "amlogic,meson-sm1"; fragment@0 { target-path = "/soc/bus@ffd00000/i2c@1d000"; __overlay__ { status = "okay"; clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins>; #address-cells = <1>; #size-cells = <0>; rtc@68 { compatible = "maxim,ds3231"; reg = <0x68>; }; }; }; fragment@1 { target-path = "/soc/bus@ff600000/bus@34400/pinctrl@40"; __overlay__ { i2c2_pins: i2c2_pins { mux { groups = "i2c2_sda_x", "i2c2_sck_x"; function = "i2c2"; bias-disable; drive-strength-microamp = <3000>; }; }; }; }; fragment@2 { target-path = "/soc/bus@ff800000/rtc@a8"; __overlay__ { status = "disabled"; }; }; }; then I set up a basic service to keep ds3231 up to date either by internal system clock or NTP if chrony synchronize with internet extract of syslog : 2026-04-06T10:19:22.245210+02:00 bananapim5 systemd[1]: Started sync-rtc.timer - Run RTC sync every 6 hour. 2026-04-06T10:19:22.248077+02:00 bananapim5 kernel: rtc-ds1307 0-0068: SET TIME! 2026-04-06T10:19:22.248112+02:00 bananapim5 kernel: rtc-ds1307 0-0068: registered as rtc0 2026-04-06T10:19:22.248120+02:00 bananapim5 kernel: rtc-ds1307 0-0068: setting system clock to 2026-04-06T08:19:16 UTC (1775463556) 2026-04-06T10:24:18.665668+02:00 bananapim5 systemd[1]: Starting sync-rtc.service - Synchronize RTC0 avec l'horloge systeme si NTP actif... 2026-04-06T10:24:18.743806+02:00 bananapim5 sync-rtc: NTP actif : mise à jour RTC0 depuis l'heure système 2026-04-06T10:24:18.751001+02:00 bananapim5 sync-rtc: Mise à jour RTC0 depuis l'heure système NTP actif/inactif 2026-04-06T10:24:19.005750+02:00 bananapim5 systemd[1]: sync-rtc.service: Deactivated successfully. 2026-04-06T10:24:19.006443+02:00 bananapim5 systemd[1]: Finished sync-rtc.service - Synchronize RTC0 avec l'horloge systeme si NTP actif. root@bananapim5:/home/gerard# service : root@bananapim5:/home/gerard# cat /etc/systemd/system/sync-rtc.service [Unit] Description=Synchronize RTC0 avec l'horloge systeme si NTP actif After=chronyd.service [Service] Type=oneshot ExecStart=/usr/rtc/sync-rtc.sh root@bananapim5:/home/gerard# cat /etc/systemd/system/sync-rtc.timer [Unit] Description=Run RTC sync every 6 hour [Timer] OnBootSec=5min OnUnitActiveSec=6h Unit=sync-rtc.service Persistent=true [Install] WantedBy=timers.target root@bananapim5:/home/gerard# cat /usr/rtc/sync-rtc.sh #!/bin/bash # sync-rtc.sh # Synchronisation RTC <-> système avec logging # Vérifie si Chrony a des sources NTP actives NTP_OK=$(chronyc tracking | grep 'Reference ID' | grep -v '0.0.0.0') if [ -n "$NTP_OK" ]; then # Chrony OK, mettre RTC à jour depuis l’heure système logger -t sync-rtc "NTP actif : mise à jour RTC0 depuis l'heure système" else # NTP indisponible logger -t sync-rtc "NTP inactif" fi logger -t sync-rtc "Mise à jour RTC0 depuis l'heure système NTP actif/inactif" hwclock -w -f /dev/rtc0 root@bananapim5:/home/gerard# thanks again 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.