root@OpenWrt:~# logread | grep rtc
Mon Jan 6 00:39:48 2025 kern.err kernel: [ 2.729737] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
Mon Jan 6 00:39:48 2025 kern.info kernel: [ 2.744808] rtc-pcf8563 0-0051: registered as rtc0
Mon Jan 6 00:39:48 2025 kern.err kernel: [ 2.755763] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
Mon Jan 6 00:39:48 2025 kern.err kernel: [ 2.770546] rtc-pcf8563 0-0051: hctosys: unable to read the hardware clock
Mon Jan 6 00:39:48 2025 kern.err kernel: [ 15.663300] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Sometimes it even shows this:
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
I tried several versions of OpenWrt 24.10.0-rc4 and older. Sometimes hwclock
shows datetime.
I tried with and without battery, same problem.
I have 2 identical WiTi boards and they both show the same problem.
maurer
January 7, 2025, 8:18am
2
Is it the same with 23.05?
Yes. The 23.05.5 the same. Sometimes it even isn't registered:
root@OpenWrt:~# logread | grep rtc
Mon Sep 23 12:34:52 2024 kern.err kernel: [ 2.672937] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-6 addr=0e, data=03
Mon Sep 23 12:34:52 2024 kern.err kernel: [ 2.687959] rtc-pcf8563 0-0051: pcf8563_probe: write error
Mon Sep 23 12:34:52 2024 kern.warn kernel: [ 2.698894] rtc-pcf8563: probe of 0-0051 failed with error -5
root@OpenWrt:~# logread | grep i2c
Mon Sep 23 12:34:52 2024 kern.info kernel: [ 2.662510] i2c_dev: i2c /dev entries driver
Mon Sep 23 12:34:52 2024 kern.info kernel: [ 2.710389] i2c-mt7621 1e000900.i2c: clock 100 kHz
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- 54 -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
I tried to change i2c bus to 10000 Hz (default is 100000 Hz), result is the same.
Part of target/linux/ramips/dts/mt7621_mqmaker_witi.dts :
&i2c {
status = "okay";
clock-frequency = <10000>;
rtc@51 {
status = "okay";
compatible = "nxp,pcf8563";
reg = <0x51>;
};
};
I inserted a fresh new battery and got this:
root@OpenWrt:~# logread | grep rtc
Tue Jan 7 09:44:46 2025 kern.err kernel: [ 2.704582] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
Tue Jan 7 09:44:46 2025 kern.info kernel: [ 2.719655] rtc-pcf8563 0-0051: registered as rtc0
Tue Jan 7 09:44:46 2025 kern.err kernel: [ 2.730539] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
Tue Jan 7 09:44:46 2025 kern.err kernel: [ 2.745308] rtc-pcf8563 0-0051: hctosys: unable to read the hardware clock
Tue Jan 7 09:44:46 2025 kern.err kernel: [ 11.877747] rtc-pcf8563 0-0051: low voltage detected, date/time is not reliable.
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
Tue Feb 15 13:16:14 2067 0.000000 seconds
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
hwclock: RTC_RD_TIME: I/O error
root@OpenWrt:~# hwclock
Wed Feb 16 21:25:33 2067 0.000000 seconds
Among many errors the hwclock
showed Tue Feb 15 13:16:14 2067
and Wed Feb 16 21:25:33 2067
.
I would do the following.
Remove rtc from the dts and leave there only this:
&i2c {
status = "okay";
};
Rebuild the image, then run after the boot:
echo pcf8563 0x51 > /sys/bus/i2c/devices/i2c-0/new_device
and check the system log.
Then install hwclock
and run
hwclock -w
hwclock -r
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# logread | grep i2c
Mon Dec 23 00:55:44 2024 kern.info kernel: [ 2.686374] i2c_dev: i2c /dev entries driver
Mon Dec 23 00:55:44 2024 kern.info kernel: [ 2.696207] i2c-mt7621 1e000900.i2c: clock 100 kHz
root@OpenWrt:~# logread | grep rtc
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# echo pcf8563 0x51 > /sys/bus/i2c/devices/i2c-0/new_device
root@OpenWrt:~# logread | grep rtc
Wed Jan 8 19:35:03 2025 kern.err kernel: [ 356.088031] rtc-pcf8563 0-0051: pcf8563_write_block_data: err=-6 addr=0e, data=03
Wed Jan 8 19:35:03 2025 kern.err kernel: [ 356.103099] rtc-pcf8563 0-0051: pcf8563_probe: write error
Wed Jan 8 19:35:03 2025 kern.warn kernel: [ 356.114082] rtc-pcf8563: probe of 0-0051 failed with error -5
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~#
root@OpenWrt:~# hwclock
hwclock: can't open '/dev/misc/rtc': No such file or directory
May be a bad PCB design? May be diagnose the i2c bus with an oscilloscope?
Could be a power issue as well, check Vcc on RTC chip directly. That's not good that i2cdetect sometimes returns no results.
I've got very strange behavior, when I measure a signal from the SCL pin it reads registers, when I take off an oscilloscope probe there is a read error. My finger also works X-D when I touch the SCL pin it works.
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x08
0x25
root@OpenWrt:~# i2cget -y -a 0 0x51 0x00
Error: Read failed
root@OpenWrt:~# i2cget -y -a 0 0x51 0x00
0x88
root@OpenWrt:~#
AndrewZ
January 8, 2025, 10:22pm
10
I could be wrong but it looks like it lacks pullup or pulldown.
I'm trying to get the board schema MQ-WiTi-Board.pdf
but it seems it was available only from MQMaker's site which is dead now.
Found the schematic and checked, SDA and SCL are pulled up to 3.3V with 3.7K resistors I have checked it with a TRUE RMS multi-meter (3.66K and 3.69K).
GPT-4o advice:
Terminate Properly
If your bus length is long, consider adding small capacitors (e.g., 10 pF to 20 pF) between SCL/SDA and ground at the device to reduce ringing.
Inserting of a short wire into external connector's SCL solved the problem. Thinking of where to solder a capacitor.