[i2c] Microchip PIC i2c

Jean Delvare khali at linux-fr.org
Fri Sep 28 10:33:05 CEST 2007

Hi Petr,

On Sun, 23 Sep 2007 10:38:19 +0200, Petr Jakeš wrote:
> Hi,
> I am using following configuration:
> HW: 
> AMD Geode GX CPU + AMD Geode CS5536 Companion Device
> SMSC SCH3114 super I/O chip
> SW:
> Ubuntu 7.04 (minimalistic command line distro)
> kernel 2.6.20-15-386
> sensors version 2.10.4-SVN with libsensors version 2.10.4-SVN
> drivers: scx200_acb, i2c-dev, compiled dme1737
> py-smbus
> I would like to know, if is possible to set lm-sensors to communicate
> "pure" i2c, not a SMBus protocol. We are trying to connect a Microchip
> PIC 16F88 which has HW i2c port.
> We can see this chip on the bus, we can communicate with it (using
> py-smbus) but sometimes i2c port on the PIC freezes. We suspect the
> slight diferences between i2c and SMBus protocol causes this.

As its name says, py-smbus can only do SMBus-level transactions. If you
want to do I2C-level transactions, you'll have to use i2c-dev directly,
doing either direct reads and writes, or using the I2C_RDWR ioctl.
There are examples of how the later works under prog/eepromer/ in the
source lm-sensors package.

That being said... scx200_acb can't do I2C-level transactions, so it
won't work for you anyway. You'd need to do software-driven I2C using
the scx200_i2c driver instead.

When the underlying bus driver can do I2C, SMBus requests are converted
to I2C messages, so even py-smbus will actually cause I2C messages to be
sent to your PIC.

> BTW I do not realy understand which way are informations in
> /sys/class/hwmon/hwmon0/device acquired? Via SMBus or via ISA bus?
> sensors-detect returns:
> Use of uninitialized value in pack at /usr/sbin/sensors-detect line 2197.
> Success! (address 0x3f0, driver `dme1737')

This is off-topic for this list, please post this question to the
lm-sensors list:

Jean Delvare

More information about the i2c mailing list