emPC-A/RPI3
(
Hardware and
Software Manual)
•
Operating System and Drivers
5 - 21
Rev. 1.3
©
Janz Tec AG
5.2.4.4 rtc-ds1307 : RTC
MCP7940N RTC is compatible with the rtc-ds1307 Linux driver (supported from kernel 3.19). The
emPC-A/RPI3 installation installs the RTC service, so that the RTC automatically sets the system time
on every boot.
Reading the RTC time:
pi@raspberry ~$
sudo hwclock -r
Writing the system time to the RTC
pi@raspberry ~$
sudo hwclock --systohc -D --noadjfile --utc
After replacing the RTC battery, call the following command lines to set the RTC oscillator trim register
to value 0 persistently. (Otherwise the RTC will be less precise than it could be)
pi@raspberry ~$
sudo bash
pi@raspberry ~$
modprobe i2c-dev
pi@raspberry ~$
mknod /dev/i2c-1 c 89 1 2>/dev/null
pi@raspberry ~$
i2cset -f -y 1 0x6f 8 0x00 b