Armadilloフォーラム

RTC時刻情報が初期化される件

yasuda0108

2025年1月29日 15時10分

==========
製品型番:AGX4500-U00Z
Debian/ABOSバージョン:3.20.3-at.7
カーネルバージョン:5.10.232-0-at
3G/LTE モジュール情報 (Debianのみ):非搭載(LAN経由でIoT端末に接続)
その他:
==========

お世話になっております。
以下の条件で電源を投入した際に、時刻情報が時々初期化される現象が発生しています。
・12V電源を常時接続
・CON12の5pinで起動
・rtcwake -m no -s 3600 ⇒ poweroffのコマンドを記述したスクリプトでシステムを終了

起動時に時刻が正常な場合と、初期化される場合があります。
詳細な検証はできていませんが、poweroff後数十秒以内であれば時刻は保持され、数分経過すると初期化されるように見えます。
失敗の際は、setup_rtc_disarm_alarm: Can't find device id=0x32とブート時に出ていますので、初期設定に失敗しているように見受けられます。
※BaseOSのイメージは、HPからダウンロードした「baseos-x2-installer-3.20.3-at.7」をそのまま使用しています。

原因について、わかるようでしたらお教えいただきたいです。
よろしくお願いします。

以下、ログです。

### OK ###
armadillo:~# date
Wed Jan 29 14:44:28 JST 2025
armadillo:~# hwclock
Wed Jan 29 05:44:33 2025  0.000000 seconds
armadillo:~# local                    | * Stopping local ... [ ok ]
avahi-daemon             | * Stopping avahi-daemon ...zramswap                 | * Deactivating zram swap device ...dnsmasq                  | * Stopping dnsmasq ...klogd                    | * Stopping busybox klogd ... [ ok ]
podman-atmark            | * Stopping all podman containers ... [ ok ]
 [ ok ]
 [ ok ]
armadillo-twin-agentd    | * Stopping armadillo-twin-agentd ...buttond                  | * Stopping button watching daemon ...chronyd                  | * Stopping chronyd ... [ ok ]
abos-web                 | * Stopping abos-web ... [ ok ]
 [ ok ]
 [ ok ]
syslog                   | * Stopping busybox syslog ... [ ok ]
udev                     | * Stopping udev ...networkmanager           | * Stopping networkmanager ... [ ok ]
 [ ok ]
dbus                     | * Stopping System Message Bus ...nm-dispatcher: Caught signal 15, shutting down...
 [ ok ]
 [ ok ]
localmount               | * Unmounting loop devices
localmount               | * Unmounting filesystems
localmount               | *   Unmounting /opt/firmware ... [ ok ]
localmount               | *   Unmounting /var/tmp ... [ ok ]
localmount               | *   Unmounting /var/app/volumes ... [ ok ]
localmount               | *   Unmounting /var/app/rollback/volumes ... [ ok ]
localmount               | *   Unmounting /var/lib/containers/storage_readonly ... [ ok ]
localmount               | *   Unmounting /tmp ... [ ok ]
localmount               | *   Unmounting /var/log ... [ ok ]
localmount               | *   Unmounting /var/at-log ... [ ok ]
killprocs                | * Terminating remaining processes ... [ ok ]
killprocs                | * Killing remaining processes ... [ ok ]
mount-ro                 | * Remounting remaining filesystems read-only ... *   Remounting / read only ... [ ok ]
mount-ro                 | [ ok ]
indicator_signals        | * Signaling external devices we are shutting down ... [ ok ]
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
[  328.697425] imx2-wdt 30280000.watchdog: Device shutdown: Expect reboot!
[  328.704390] reboot: Power down
 
U-Boot SPL 2020.04-at24 (Jun 25 2024 - 05:23:49 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
image offset 0x0, pagesize 0x200, ivt offset 0x0
NOTICE:  BL31: v2.4(release):2020.04-at19
NOTICE:  BL31: Built : 08:29:47, Dec 14 2023
 
 
U-Boot 2020.04-at24 (Jun 25 2024 - 05:23:49 +0000)
 
CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 39C
Model: Atmark-Techno Armadillo X2 Series
DRAM:    Hold key pressed for tests: t (fast) / T (slow)
2 GiB
WDT:   Started with servicing (10s timeout)
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
 
 BuildInfo:
  - ATF 2020.04
  - U-Boot 2020.04-at24
 
reset cause: first boot since power on
switch to partitions #0, OK
mmc2(part 0) is current device
flash target is MMC:2
Net:   eth0: ethernet@30be0000 [PRIME], eth1: ethernet@30bf0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc2(part 0) is current device
22923776 bytes read in 497 ms (44 MiB/s)
Booting from mmc ...
79066 bytes read in 3 ms (25.1 MiB/s)
Loading fdt boot/armadillo.dtb
45 bytes read in 1 ms (43.9 KiB/s)
2048 bytes read in 1 ms (2 MiB/s)
Applying fdt overlay: armadillo_iotg_g4-at-dtweb.dtbo
## Flattened Device Tree blob at 45000000
   Booting using the fdt blob at 0x45000000
   Loading Device Tree to 0000000052bbe000, end 0000000052bf4fff ... OK
 
Starting kernel ...
 
[    1.797520] imx6q-pcie 33800000.pcie: failed to initialize host
[    1.803457] imx6q-pcie 33800000.pcie: unable to add pcie port.
 
   OpenRC 0.54 is starting up Linux 5.10.232-0-at (aarch64)
 
 * Mounting /proc ... [ ok ]
 * Mounting /run ... [ ok ]
 * /run/openrc: creating directory
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Caching service dependencies ... [ ok ]
 * Mounting /sys ... * Remounting devtmpfs on /dev ... [ ok ]
 [ ok ]
 * Mounting security filesystem ... [ ok ]
 * Mounting config filesystem ... [ ok ]
 * Mounting /dev/mqueue ... [ ok ]
 * Mounting /dev/pts ... [ ok ]
 * Mounting /dev/shm ... [ ok ]
udev                     | * Starting udev ... [ ok ]
fsck                     | * Checking local filesystems  ... [ ok ]
fsck_atlog               | * Checking log filesystems ...root                     | * Remounting filesystems ... [ ok ]
 [ ok ]
localmount               | * Mounting local filesystems ... [ ok ]
overlayfs                | * Preparing overlayfs over / ... [ ok ]
sysctl                   | * Configuring kernel parameters ...hostname                 | * Setting hostname ... [ ok ]
udev-trigger             | * Generating a rule to create a /dev/root symlink ... [ ok ]
 [ ok ]
udev-trigger             | * Populating /dev with existing devices through uevents ... [ ok ]
bootmisc                 | * Migrating /var/lock to /run/lock ... [ ok ]
bootmisc                 | * Creating user login records ... [ ok ]
bootmisc                 | * Wiping /var/tmp directory ... [ ok ]
dbus                     | * /run/dbus: creating directory
dbus                     | * /run/dbus: correcting owner
syslog                   | * Starting busybox syslog ... [ ok ]
micron-emmc-reten        | * Starting micron-emmc-reten
dbus                     | * Starting System Message Bus ... [ ok ]
klogd                    | * Starting busybox klogd ... [ ok ]
micron-emmc-reten        | [ ok ]
networkmanager           | * Starting networkmanager ... [ ok ]
dnsmasq                  | * /var/lib/misc/dnsmasq.leases: creating file
dnsmasq                  | * /var/lib/misc/dnsmasq.leases: correcting owner
dnsmasq                  | * Starting dnsmasq ... [ ok ]
buttond                  | * Starting button watching daemon ...reset_bootcount          | * Resetting bootcount in bootloader env ... [ ok ]
Environment OK, copy 0
reset_bootcount          | [ ok ]
zramswap                 | * Creating zram swap device ...armadillo-twin-agentd    | * Starting armadillo-twin-agentd ...avahi-daemon             | * Starting avahi-daemon ... [ ok ]
podman-atmark            | * Starting configured podman containers ...chronyd                  | * Starting chronyd ... [ ok ]
 [ ok ]
Starting 'gk-ib'
abos-web                 | * Starting abos-web ... [ ok ]
podman-atmark            |2b85ac7d66f2423811b6db06b162f658110bcc22cdcd1cf8eb397bb551de26a9
podman-atmark            | [ ok ]
 [ ok ]
local                    | * Starting local ... [ ok ]
 
Welcome to Alpine Linux 3.20
Kernel 5.10.232-0-at on an aarch64 (/dev/ttymxc1)
 
armadillo login: root
Password:
Welcome to Alpine!
 
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.
 
 
Please note this system is READ-ONLY with a read-write overlayfs,
after updating password make sure to save new password with
# persist_file /etc/shadow
 
You can change this message by editing /etc/motd.
Last update on Wed Jan 29 11:53:18 JST 2025, updated:
  gk-ib: unset -> 10000
  extra_os.gk-ib: unset -> 10000
armadillo:~# date
Wed Jan 29 14:45:48 JST 2025
armadillo:~# hwclock
Wed Jan 29 05:45:52 2025  0.000000 seconds
### NG ###
armadillo:~# date
Wed Jan 29 14:13:23 JST 2025
armadillo:~# hwclock
Wed Jan 29 05:13:27 2025  0.000000 seconds
armadillo:~# local                    | * Stopping local ...zramswap                 | * Deactivating zram swap device ...avahi-daemon             | * Stopping avahi-daemon ...podman-atmark            | * Stopping all podman containers ... [ ok ]
armadillo-twin-agentd    | * Stopping armadillo-twin-agentd ... [ ok ]
 [ ok ]
klogd                    | * Stopping busybox klogd ...abos-web                 | * Stopping abos-web ... [ ok ]
chronyd                  | * Stopping chronyd ... [ ok ]
 [ ok ]
 [ ok ]
buttond                  | * Stopping button watching daemon ... [ ok ]
dnsmasq                  | * Stopping dnsmasq ...udev                     | * Stopping udev ... [ ok ]
 [ ok ]
networkmanager           | * Stopping networkmanager ...syslog                   | * Stopping busybox syslog ... [ ok ]
 [ ok ]
dbus                     | * Stopping System Message Bus ...nm-dispatcher: Caught signal 15, shutting down...
 [ ok ]
 [ ok ]
localmount               | * Unmounting loop devices
localmount               | * Unmounting filesystems
localmount               | *   Unmounting /opt/firmware ... [ ok ]
localmount               | *   Unmounting /var/tmp ... [ ok ]
localmount               | *   Unmounting /var/app/volumes ... [ ok ]
localmount               | *   Unmounting /var/app/rollback/volumes ... [ ok ]
localmount               | *   Unmounting /var/lib/containers/storage_readonly ... [ ok ]
localmount               | *   Unmounting /tmp ... [ ok ]
localmount               | *   Unmounting /var/log ... [ ok ]
localmount               | *   Unmounting /var/at-log ... [ ok ]
killprocs                | * Terminating remaining processes ... [ ok ]
killprocs                | * Killing remaining processes ... [ ok ]
mount-ro                 | * Remounting remaining filesystems read-only ... *   Remounting / read only ... [ ok ]
mount-ro                 | [ ok ]
indicator_signals        | * Signaling external devices we are shutting down ... [ ok ]
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
[  257.197021] imx2-wdt 30280000.watchdog: Device shutdown: Expect reboot!
[  257.204287] reboot: Power down
 
U-Boot SPL 2020.04-at24 (Jun 25 2024 - 05:23:49 +0000)
setup_rtc_disarm_alarm: Can't find device id=0x32
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
image offset 0x0, pagesize 0x200, ivt offset 0x0
NOTICE:  BL31: v2.4(release):2020.04-at19
NOTICE:  BL31: Built : 08:29:47, Dec 14 2023
 
 
U-Boot 2020.04-at24 (Jun 25 2024 - 05:23:49 +0000)
 
CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 30C
Model: Atmark-Techno Armadillo X2 Series
DRAM:    Hold key pressed for tests: t (fast) / T (slow)
2 GiB
WDT:   Started with servicing (10s timeout)
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
 
 BuildInfo:
  - ATF 2020.04
  - U-Boot 2020.04-at24
 
reset cause: first boot since power on
switch to partitions #0, OK
mmc2(part 0) is current device
flash target is MMC:2
Net:   eth0: ethernet@30be0000 [PRIME], eth1: ethernet@30bf0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc2(part 0) is current device
22923776 bytes read in 497 ms (44 MiB/s)
Booting from mmc ...
79066 bytes read in 3 ms (25.1 MiB/s)
Loading fdt boot/armadillo.dtb
45 bytes read in 1 ms (43.9 KiB/s)
2048 bytes read in 2 ms (1000 KiB/s)
Applying fdt overlay: armadillo_iotg_g4-at-dtweb.dtbo
## Flattened Device Tree blob at 45000000
   Booting using the fdt blob at 0x45000000
   Loading Device Tree to 0000000052bbe000, end 0000000052bf4fff ... OK
 
Starting kernel ...
 
[    0.424718] rtc-rv8803 1-0032: hctosys: unable to read the hardware clock
[    1.777163] imx6q-pcie 33800000.pcie: failed to initialize host
[    1.783146] imx6q-pcie 33800000.pcie: unable to add pcie port.
 
   OpenRC 0.54 is starting up Linux 5.10.232-0-at (aarch64)
 
 * Mounting /proc ... [ ok ]
 * Mounting /run ... [ ok ]
 * /run/openrc: creating directory
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Caching service dependencies ... [ ok ]
 * Clock skew detected with /etc/init.d'
 * Adjusting mtime of /run/openrc/deptree' to Mon Dec 23 10:11:43 2024
 
 * WARNING: clock skew detected!
 * Mounting /sys ... * Remounting devtmpfs on /dev ... [ ok ]
 [ ok ]
 * Mounting security filesystem ... [ ok ]
 * Mounting config filesystem ... [ ok ]
 * Mounting /dev/mqueue ... [ ok ]
 * Mounting /dev/pts ... [ ok ]
 * Mounting /dev/shm ... [ ok ]
udev                     | * Starting udev ... [ ok ]
fsck                     | * Checking local filesystems  ... [ ok ]
root                     | * Remounting filesystems ...fsck_atlog               | * Checking log filesystems ... [ ok ]
 [ ok ]
localmount               | * Mounting local filesystems ... [ ok ]
overlayfs                | * Preparing overlayfs over / ... [ ok ]
 * WARNING: clock skew detected!
udev-trigger             | * Generating a rule to create a /dev/root symlink ...hostname                 | * Setting hostname ...sysctl                   | * Configuring kernel parameters ... [ ok ]
 [ ok ]
udev-trigger             | * Populating /dev with existing devices through uevents ... [ ok ]
 [ ok ]
bootmisc                 | * Migrating /var/lock to /run/lock ... [ ok ]
bootmisc                 | * Creating user login records ... [ ok ]
bootmisc                 | * Wiping /var/tmp directory ... [ ok ]
syslog                   | * Starting busybox syslog ... [ ok ]
dbus                     | * /run/dbus: creating directory
dbus                     | * /run/dbus: correcting owner
micron-emmc-reten        | * Starting micron-emmc-reten
dbus                     | * Starting System Message Bus ...klogd                    | * Starting busybox klogd ... [ ok ]
 [ ok ]
micron-emmc-reten        | [ ok ]
networkmanager           | * Starting networkmanager ... [ ok ]
dnsmasq                  | * /var/lib/misc/dnsmasq.leases: creating file
dnsmasq                  | * /var/lib/misc/dnsmasq.leases: correcting owner
dnsmasq                  | * Starting dnsmasq ... [ ok ]
 * WARNING: clock skew detected!
buttond                  | * Starting button watching daemon ... [ ok ]
reset_bootcount          | * Resetting bootcount in bootloader env ...avahi-daemon             | * Starting avahi-daemon ...Environment OK, copy 0
reset_bootcount          | [ ok ]
armadillo-twin-agentd    | * Starting armadillo-twin-agentd ... [ ok ]
zramswap                 | * Creating zram swap device ...podman-atmark            | * Starting configured podman containers ...chronyd                  | * Starting chronyd ... [ ok ]
 [ ok ]
Starting 'gk-ib'
abos-web                 | * Starting abos-web ... [ ok ]
podman-atmark            |3c52b8fbfbed077324af1c53bd5c5285db23ae0ccbc546692e842297e580aecc
podman-atmark            | [ ok ]
 [ ok ]
local                    | * Starting local ... [ ok ]
 
Welcome to Alpine Linux 3.20
Kernel 5.10.232-0-at on an aarch64 (/dev/ttymxc1)
 
armadillo login: root
Password:
Welcome to Alpine!
 
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.
 
 
Please note this system is READ-ONLY with a read-write overlayfs,
after updating password make sure to save new password with
# persist_file /etc/shadow
 
You can change this message by editing /etc/motd.
Last update on Wed Jan 29 11:53:18 JST 2025, updated:
  gk-ib: unset -> 10000
  extra_os.gk-ib: unset -> 10000
armadillo:~# date
Thu Jan  1 09:00:15 JST 1970
armadillo:~# hwclock
hwclock: ioctl 0x80247009 failed: Invalid argument
armadillo:~#  * WARNING: clock skew detected!
コメント

追記補足です。
rtcwakeを設定していますが、先ほどのログは双方ともに、poweroff後、CON12から起動しています。
数十秒以内であれば~の下りは、poweroff⇒CON12起動の間の時間です。

> 追記補足です。
> rtcwakeを設定していますが、先ほどのログは双方ともに、poweroff後、CON12から起動しています。
> 数十秒以内であれば~の下りは、poweroff⇒CON12起動の間の時間です。

バッテリーバックアップ用のコイン電池を接続した状態で実施すると状況は変わりますか?
poweroffの場合コイン電池を接続していないと主電源系からRTC系の電源も遮断しているので
RTCがリセットしているはずです。

> バッテリーバックアップ用のコイン電池を接続した状態で実施すると状況は変わりますか?
> poweroffの場合コイン電池を接続していないと主電源系からRTC系の電源も遮断しているので
> RTCがリセットしているはずです。

コイン電池の使用は想定していません。
今回、搭載Appの更新に加えて、BaseOSを3.18.5-at.8⇒3.20.3-at.7に変更しています。
同じ基板で、以前は主電源系のみの接続状態で、1時間おきに定期的にウェイクアップし、dateコマンドで正常な時刻が更新されていることを確認していますので、RTCは主電源接続状態であればRTCウェイクアップ可能な認識です。(認識が異なりましたら、ご指摘お願いします。)
ログの内容から、問題の想定は可能でしょうか?

※本問題に関する不具合が、OSの更新に依存しているかどうかは引き続き検証します。

> コイン電池の使用は想定していません。
はい、それは理解しています。条件確認のためコイン電池使用で変化するかを確認したかったのです。

> 今回、搭載Appの更新に加えて、BaseOSを3.18.5-at.8⇒3.20.3-at.7に変更しています。
> 同じ基板で、以前は主電源系のみの接続状態で、1時間おきに定期的にウェイクアップし、dateコマンドで正常な時刻が更新されていることを確認していますので、RTCは主電源接続状態であればRTCウェイクアップ可能な認識です。(認識が異なりましたら、ご指摘お願いします。)
> ログの内容から、問題の想定は可能でしょうか?

HW設計に確認したところ現状、poweroff状態では12Vが入っていてもRTCへの電源系が
内部的に遮断されるので、内部のコンデンサ分(40秒程度)を超えるとRTCがリセットされる設計となっています。

現状poweroffまで落としてしまうと、コイン電池非搭載の場合RTCの時刻を喪失します。
これは、2025年後半(出荷状況によって前後します)出荷製品で変更され12V系から直接供給の設計に変更予定です。

コイン電池を利用いただくか、Suspend-to-RAM/Suspend-to-Idleであれば、コイン電池なしでもRTCが維持されるので
いずれかの方法で回避いただけると幸いです。
OSのソフトウェア的な挙動ではありません。

ご説明ありがとうございます。
内容理解いたしました。

ご回答ありがとうございました。