Saving time with Hardware Clock

From Alpine Linux
Revision as of 11:19, 10 August 2015 by Sillysausage (talk | contribs) (Created page with "= Install Hardware = I used a [http://www.piface.org.uk/products/piface_clock PiFace Real Time Clock]. After installing the CR1220 battery and correctly mounting on the board...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Install Hardware

I used a PiFace Real Time Clock. After installing the CR1220 battery and correctly mounting on the board, see manual for that.

Install Software

Add the modules from the kernel

/etc/modules/

Add these modules so they're loaded on boot. You can modprobe each one individually if you don't want to reboot.

i2c_dev
i2c_bcm2708
i2c:mcp7941x


/media/mmcblk0p1/config.txt

You will need to mount this as read-write

mount -o remount,rw /media/mmcblk0p1

Add these two parameters to the bottom

dtparam=i2c1=on
dtparam=i2c_arm=on

mount -o remount,ro /media/mmcblk0p1

Then you will need to reboot.

/etc/conf.d/hwclock

You will want to make sure the device is created when hwclock starts, if it isn't already created. To the bottom of /etc/conf.d/hwclock add this:

start_pre() {
    if [ ! -d "/sys/class/i2c-adapter/i2c-1/i2c-dev/i2c-1" ]; then
        einfo "Creating RTC device";
        echo mcp7941x 0x6f > /sys/class/i2c-adapter/i2c-1/new_device
    fi
}