Skip to contentSkip to conversation

I2C -bus programming

DISCUSSION Kari Laine 3 participants 3 messages Aug 13, 2009 – Sep 12, 2009 I2C subsystem host drivers

lore
Share & tools
lore

Kari Laine

author
#0 lore raw

Dear List,

this is my first post here and I am not sure if this is a suitable topic here. Anyway I have a Velleman K8000 IO-card and it uses I2C over parallel port to communicate.

when I modprobe i2c-parport it does not complain. I tested without card connected and it complained so it seems to find the card.

modprobe pcf8591

modprobe i2c-core

modprobe i2c-dev

I am not sure I am doing it right. Should i2c-core probed first ?

anyway now I have

/dev/i2c-0 /dev/i2c-1

Now I don't know whether these i2c-devices refer to this Velleman board or some other i2c-device which happen to be in the computer...

If these devices probably refer to Velleman - then how I can refer different i2c-devices on the board.

I am totally new to this i2c thing (reading spec at the moment but it does not help much with Linux).

I would be very greatfull if some could point me the way - thanks.

Best Regards
Kari Laine

#1 lore raw

Copied to i2c mailing list.

Quoted 42 lines

Dear List,

this is my first post here and I am not sure if this is a suitable topic here. Anyway I have a Velleman K8000 IO-card and it uses I2C over parallel port to communicate.

when I modprobe i2c-parport it does not complain. I tested without card connected and it complained so it seems to find the card.

modprobe pcf8591

modprobe i2c-core

modprobe i2c-dev

I am not sure I am doing it right. Should i2c-core probed first ?

anyway now I have

/dev/i2c-0 /dev/i2c-1

Now I don't know whether these i2c-devices refer to this Velleman board or some other i2c-device which happen to be in the computer...

If these devices probably refer to Velleman - then how I can refer different i2c-devices on the board.

I am totally new to this i2c thing (reading spec at the moment but it does not help much with Linux).

I would be very greatfull if some could point me the way - thanks.

Best Regards
Kari Laine

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw

Hi Kari,

Quoted 6 lines · Kari Laine

this is my first post here and I am not sure if this is a suitable topic here. Anyway I have a Velleman K8000 IO-card and it uses I2C over parallel port to communicate.

when I modprobe i2c-parport it does not complain. I tested without card connected and it complained so it seems to find the card.

This doesn't mean the card is handled properly. You must pass the proper card type parameter. The Velleman K8000 is type 2, so:

modprobe i2c-parport type=2

Alternatively you can add:

options i2c-parport type=2

to /etc/modprobe.conf or whatever modprobe configuration file your system uses.

You didn't tell which kernel you are using, but kernel 2.6.17 and later wouldn't let you load i2c-parport without a type parameter.

Quoted 7 lines

modprobe pcf8591

modprobe i2c-core

modprobe i2c-dev

I am not sure I am doing it right. Should i2c-core probed first ?

It doesn't matter. i2c-core gets loaded automatically when any other module needs it.

Quoted 6 lines

anyway now I have

/dev/i2c-0 /dev/i2c-1

Now I don't know whether these i2c-devices refer to this Velleman board or some other i2c-device which happen to be in the computer...

You should install i2c-tools and use the command "i2cdetect -l". This will tell you what each i2c bus on your system is.

Then you can try "i2cdetect <n>" where <n> is a bus number, to scan the bus in question. This is a good way to test whether the driver and device are working properly.

Quoted 2 lines

If these devices probably refer to Velleman - then how I can refer different i2c-devices on the board.

Depends on the device. In the case of the Philips PCF8591, which apparently you are using, sysfs attributes will be created somewhere under /sys/bus/i2c/drivers/pcf8591. Each device has a name of the form <bus number>-<device address>, for example "1-0048" for a PCF8591.

The sysfs attributes in question are described in Documentation/hwmon/pcf8591 (or Documentation/i2c/chips/pcf8591 on kernels older than 2.6.30.)

Hope this helps,

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/wishlist.html