From: Meece, Clifford T <clifford.meece@bp...> - 2007-04-20 01:17:29
Back with more questions. I've got a connex 400, wifistix-cf and
I really like avrlib, and have been playing with some of the samples,
but I can't seem to get the i2c communication right. I get this error:
I2CTransfer: ioctl failed
When trying to read or write to the robostix. On the robostix, I am
using the example for i2c provided by avrlib. It runs a master and
slave service, and has a control interface on the uart. =20
If I attach to the uart, it gives me an interface to send and receive,
and it appears to work, but when I try to send from the i2c command line
program I get the error above.
One interesting thing about the avrlib library is that you can specify
the i2c bus address. In the example, it is set to 0xA0, which is > than
128, so i2c complains. I set it to 0x50, and the hex program runs, and
send data to 'itself' ( from the uart control) but still can't seem to
send from the gumstix.
Anyone have some insight into this?
From: Dave Hylands <dhylands@gm...> - 2007-04-20 02:57:56
> One interesting thing about the avrlib library is that you can specify
> the i2c bus address. In the example, it is set to 0xA0, which is > than
> 128, so i2c complains. I set it to 0x50, and the hex program runs, and
> send data to 'itself' ( from the uart control) but still can't seem to
> send from the gumstix.
So i2c addresses are only 7-bits (0-127). Some people confuse things
and use what's known as the address byte (which has the address in the
upper 7-bits and the R/W bit in the low bit).
So when you read the data sheet you need to figure out whether they're
talking about the 7-bit or 8-bit address and adjust accordingly.
Also, when using i2c, one side has to be the master and one side has
to be the slave. I've only ever used the gumstix as the master, and
the robostix as the slave. I used my own code rather than the avrlib
code, since I needed to get my bootloader to fit in 2k.
Vancouver, BC, Canada