Do you have a question? Post it now! No Registration Necessary
- Posted on
- Got i2c working ? Can you answer this ?
June 29, 2004, 6:33 pm
rate this thread
I'm trying to get an i2c interface going, and I'm not quite sure
where my problems lie. Suffice to say, it doesn't work.
I have built an Philips style adaptor. The software modules appear
to load OK, and I have this in /proc
# ls -l /proc/bus
-r--r--r-- 1 root root 0 Jun 29 18:18 i2c
-r--r--r-- 1 root root 0 Jun 29 18:18 i2c-0
dr-xr-xr-x 3 root root 0 Jun 29 18:18 isapnp
# cat /proc/bus/i2c
i2c-0 i2c Philips Parallel port adapter
# cat /proc/bus/i2c-0
cat: read: Invalid argument
What I don't understand is this problem with /proc/bus/i2c-0.
Am I right in thinking that this file should contain the addresses
of all the devices on the i2c-0 bus ? and I should be able to read the
file shouldn't I ?
Ignoring that problem for a moment - if I try to set the slave
address with something like
if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0)
fprintf(stderr, "Error eeprom_open: %s\n",
then it errors out. This code snippet is from 'eeprog' which is a
simple program to access 24Cxx EEPROM devices available at
http://codesink.org/eeprog.html so I guess should work OK. I assume it
fails because it can't read the file /proc/bus/i2c-0
So the problem is either with the adaptor I have built or the way
the modules have loaded.
If I disconnect my adaptor, then I still get problems typing the
contents of /proc/bus/i2c-0 as above.
Can someone with i2c working please confirm that I should be able to
type out the contents of /proc/bus/i2c-0 and that it contains addresses
of devices on the i2c bus
Re: Got i2c working ? Can you answer this ?
Basically, it's a bug in the 2.4 kernel.
The bug is in module i2c-core.c and a patch is available. I found it by
using Google and searching for "cat: read: Invalid argument"
I hope this helps someone in the future.
- » Job - Embedded Linux Developer - San Francisco Area
- — Next thread in » Embedded Linux
- » In search of the perfect Home Audio Appliance (or something like it)
- — Previous thread in » Embedded Linux
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux