I have put RTC (Model is SHIM RTC Realtime Clock Accessory Board) at my RPI.
I need to test if it is working or not.
Is there any command which is checking if it is working or not?
I am using RPI 3B+ and Raspbian Buster.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
Googling "SHIM RTC Realtime Clock Accessory Board" we can find a picture and tell that there is a MCP7940N RTC chip onboard, with connects via I2C. So first, related: Using the MCP7940N RTC with the Pi 3B+
To check if it's detected by the Pi, you should be able to use the
i2cdetect -y 1 command and see 'UU' for the address 0x6f.
To use it with Rasbian, following these directions you should add
# Enable i2c real-time clock dtoverlay=i2c-rtc,mcp7940x
/boot/config.txt. You may also need to run
sudo sh -c "echo mcp7940x 0x6f > /sys/class/i2c-adapter/i2c-1/new_device" after a reboot. Then run
hwclock --systohc to set the clock. On reboot it should automatically use the date and time from the RTC.
To test if it's working correctly start up the Pi without any internet access (unplugging Ethernet and disabling WiFi). The time should be set correctly.
timedatectl will show the current status of the clock and RTC (if fitted)
Local time: Tue 2019-10-01 12:16:29 AEST Universal time: Tue 2019-10-01 02:16:29 UTC RTC time: Tue 2019-10-01 02:16:30 Time zone: Australia/Sydney (AEST, +1000) Network time on: yes NTP synchronized: yes RTC in local TZ: no
If the RTC is missing or not correctly installed it will show
RTC time: n/a
I prefer to use this command:
$ sudo hwclock -rv
It's more affirmative and informative wrt the RTC status IMO. For example, here's an output from earlier today:
$ sudo hwclock -rv hwclock from util-linux 2.33.1 System Time: 1646036590.206071 Trying to open: /dev/rtc0 Using the rtc interface to the clock. 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: 2022/02/28 08:23:11 Hw clock time : 2022/02/28 08:23:11 = 1646036591 seconds since 1969 Time since last adjustment is 1646036591 seconds Calculated Hardware Clock drift is 0.000000 seconds 2022-02-28 02:23:10.689309-06:00