Jump to content

glambert

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by glambert

  1. @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
  2. 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#
  3. 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 ?
  4. 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
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines