CM3-Panel-7-poe technical documentation Buy

Setting the Real Time Clock

Install package

$ sudo apt-get update
$ sudo apt-get install python-smbus i2c-tools

Now sudo raspi-config, enable I2C and reboot:

$ sudo raspi-config

$ sudo reboot

Run this command:

$ sudo i2cdetect -l

Result:

i2c-3   i2c             3.i2c                                   I2C adapter
i2c-1   i2c             bcm2835 (i2c@7e804000)                  I2C adapter

Address Rtc

Run command for read address Rtc on bus 1

$ sudo i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
  • 0x68 Address = Real time clock.

Launch these commands in sequence:

$ sudo apt-get -y remove fake-hwclock
$ sudo update-rc.d -f fake-hwclock remove
$ sudo systemctl disable fake-hwclock

Edit file /lib/udev/hwclock-set:

$ sudo nano /lib/udev/hwclock-set

and comment line:

#!/bin/sh
# Reset the System Clock to UTC if the hardware clock from which it
# was copied by the kernel was in localtime.

dev=$1

#if [ -e /run/systemd/system ] ; then
# exit 0
#fi

Edit the file /etc/modules

$ sudo nano /etc/modules

with these contents:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev
rtc-8523

Edit file /etc/rc.local:

$ sudo nano /etc/rc.local (Insert value before exit 0)

with these contents:

# PCF8523
echo pcf8523 0x68 > /sys/class/i2c-adapter/i2c-1/new_device

exit 0

Reboot:

$ sudo reboot

Now run command:

$ sudo i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- 
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

Address 0x68 is Real Time Clock

Home page CM3-Panel-7-poe technical documentation Buy