Home

aliazzz
There is a newer version of this page. You can find it here.

Project Members:

[TOC]

I2C MCP7941x

Library containing support for battery backed SRAM support provided by realtime clock MCP7941x.

Changelog

v0.0.2.1 under construction

devdescr.xml: vendor id set to 0003, device id set to 0009, see https://forge.codesys.com/drv/io-drivers/database/Home/ for details.

    <DeviceIdentification>
      <Type>500</Type>
      <Id>0003 0009</Id>
      <Version>0.0.2.1</Version>
    </DeviceIdentification>

v0.0.0.1 initial version

i2c address setting

install i2c tools

sudo apt-get update
sudo apt-get install i2c-tools

MCP7941x i2c address and resources check

Be sure the MCP7941x is attached.

  • run
    sudo i2cdetect -y 0

You should now see a table with the connected i2c slave address.
* If "sudo i2cdetect -y 0" does not work, then run "sudo i2cdetect -y 1", this is Pi model dependant.

aliazzz@Raspbian:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 6f
70: -- -- -- -- -- -- -- --

If "UU" shows in the table, probing was skipped because this address is currently in use by a driver.
This strongly suggests that there is a chip at this address.
The UU means that the I2C address is already being used by some other bit of software.
Now disable the "fake hwclock" which interferes with the 'real' hwclock

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

Now with the fake-hw clock disabled, you can start the original 'hardware clock' script.
Run "sudo nano /lib/udev/hwclock-set" and comment out these three lines:

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