dresden-elektronik / raspbee2-rtc

RTC kernel module builder for RaspBee II
BSD 3-Clause "New" or "Revised" License
21 stars 2 forks source link

RTC wont work #10

Closed mspbonn closed 3 years ago

mspbonn commented 3 years ago

Cant get raspbee ii rtc working:

root@gateway:~# dmesg | grep -i rtc
[    6.992665] rtc_pcf85063: loading out-of-tree module taints kernel.
[   21.808910] rtc-pcf85063 1-0051: registered as rtc0

root@gateway:~# grep -i rtc /var/log/syslog | tail -5
Dec  7 14:59:10 gateway systemd-modules-load[74]: Inserted module 'rtc_pcf85063'
Dec  7 14:59:10 gateway systemd[1]: Started Enable RTC-PCF85063.
Dec  7 14:59:10 gateway kernel: [    6.992665] rtc_pcf85063: loading out-of-tree module taints kernel.
Dec  7 14:59:10 gateway kernel: [   21.808910] rtc-pcf85063 1-0051: registered as rtc0
Dec  7 14:59:10 gateway systemd[1]: rtc-pcf85063.service: Succeeded.

root@gateway:~# hwclock --verbose
hwclock from util-linux 2.33.1
System Time: 1607349798.153139
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1607343926 seconds after 1969
Last calibration done at 1607343926 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
ioctl(4, RTC_UIE_ON, 0): Invalid argument
Waiting in loop for time from /dev/rtc0 to change
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
...synchronization failed

root@gateway:~# GCFFlasher -l
rmmod: ERROR: Module ftdi_sio is not currently loaded
rmmod: ERROR: Module usbserial is not currently loaded
GCFFlasher V2_11 (c) dresden elektronik ingenieurtechnik gmbh 2017/12/10
RaspBee: /dev/ttyAMA0 (default)

no FTDI devices found
root@gateway:~# GCFFlasher -l
GCFFlasher V2_11 (c) dresden elektronik ingenieurtechnik gmbh 2017/12/10
RaspBee: /dev/ttyAMA0 (default)

no FTDI devices found

Whats worng ?

ChrisHae commented 3 years ago

The GCFFlasher Version is to old. Please follow this guide to update the RaspBee2FW to the latest version: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Update-deCONZ-manually#update-in-raspbian To get the latest GCFFlasher install the latest deconz version: https://phoscon.de/de/raspbee2/install#raspbian (scroll to deconz install)

Then don't forget sudo hwclock --systohc before hwclock --verbose.

mspbonn commented 3 years ago

I also tried the latest GCFFlasher from the deCONZ package, which results in the same error.

hwclock --systohc and hwclock --verbose were done.

ChrisHae commented 3 years ago

what is the output of GCFFlasher_internal -r ?

mspbonn commented 3 years ago
root@gateway:~# dmesg | grep rtc
[    7.460517] rtc_pcf85063: loading out-of-tree module taints kernel.
[   21.931395] rtc-pcf85063 1-0051: registered as rtc0
root@gateway:~# /usr/bin/GCFFlasher_internal -l
GCFFlasher V2_11 (c) dresden elektronik ingenieurtechnik gmbh 2017/12/10
RaspBee: /dev/ttyAMA0 (default)

no FTDI devices found

Is that the bee ii device ?

root@gateway:~# dmesg | grep AMA
[    2.432190] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
ChrisHae commented 3 years ago

This is still GCFFlasher v2_11. It does not work with the RaspBee2 and also the newest FW is needed to run the RTC. The newest veresion of GCFFlaher is 3.17 Which version of deCONZ do you have installed? If installing via apt repository does not work you can download the newest installer via curl http://deconz.dresden-elektronik.de/raspbian/deconz-latest.deb -o deconz-latest.deb and then install it manually with sudo dpkg -i deconz-latest.deb

GCFFlasher_internal -r should then return something like this:

sudo GCFFlasher_internal -r GCFFlasher V3_17 (c) dresden elektronik ingenieurtechnik gmbh Reboot device RaspBee (RaspBee) deCONZ firmware version 26610700 Bootloader version 0x00030003, app crc: 0x769F0F78

The Raspbee2 can be /dev/ttyAMA0 or /dev/ttyS0

mspbonn commented 3 years ago
/usr/bin/GCFFlasher_internal -l
GCFFlasher V3_17 (c) dresden elektronik ingenieurtechnik gmbh
Path             | Vendor | Product | Serial     | Type
-----------------+--------+---------+------------+-------
/dev/ttyAMA0     | 0x0000 | 0x0000  |            | RaspBee 
root@gateway:/data/software# /usr/bin/GCFFlasher_internal -r
GCFFlasher V3_17 (c) dresden elektronik ingenieurtechnik gmbh
Reboot device RaspBee (RaspBee)
deCONZ firmware version 26520700
Bootloader version 0x00030003, app crc: 0xD4E57E35

Seems that the bee ii needs newer firmware, because it still not works:

root@gateway:~# hwclock --verbose
hwclock from util-linux 2.33.1
System Time: 1607441081.896492
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1607440012 seconds after 1969
Last calibration done at 1607440012 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
ioctl(4, RTC_UIE_ON, 0): Invalid argument
Waiting in loop for time from /dev/rtc0 to change
hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
...synchronization failed

Where to get the latest firmware ?

mspbonn commented 3 years ago

With the latest fireware from http://deconz.dresden-elektronik.de/deconz-firmware/deCONZ_RaspBeeII_0x26610700.bin.GCF it works:

root@gateway:~# hwclock --verbose
hwclock from util-linux 2.33.1
System Time: 1607441538.203946
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Last drift adjustment done at 1607441528 seconds after 1969
Last calibration done at 1607441528 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
ioctl(4, RTC_UIE_ON, 0): Invalid argument
Waiting in loop for time from /dev/rtc0 to change
...got clock tick
Time read from Hardware Clock: 2020/12/08 15:32:19
Hw clock time : 2020/12/08 15:32:19 = 1607441539 seconds since 1969
Time since last adjustment is 11 seconds
Calculated Hardware Clock drift is 0.000000 seconds
2020-12-08 16:32:18.693828+01:00

Thanks !