I2C Read but not write

Started by Andrew.G, August 29, 2013, 01:57:47 AM

Previous topic - Next topic

Andrew.G

I am using an iMX233 Mirco with the "stock" SD card image:

Linux alarm 2.6.35-8-ARCH+ #1 PREEMPT Fri Sep 21 17:02:25 UTC 2012 armv5tejl GNU/Linux

I have moved the SMD jumpers over to HW_SDA and HW_SCL

I have installed i2c-tools and I am finding that all four devices on my bus are detected with i2cdetect:

[root@alarm ~]# i2cdetect -r 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- 4c 4d 4e --



I can also read from these devices, using i2cget no problem for example

[root@alarm ~]# i2cget -y 0 0x4e 0x3d
0x00


If I write to the devices using i2cset or i2c-tool (from the Olimex git) it reports success:

either

i2cset -y 0 0x4e 0x3d 0xff

or

[root@alarm ~]# ./i2c-tool -w 0 0x4e 2 0x3d 0xff
SLAVE ADDRESS: 0x4E
NUMBER OF BYTES TO WRITE: 2
MEMORY ALLOCATED AT ADDRESS: 0x12008
/dev/i2c-0 OPENDED!
WRITE:SUCCESS


However, if I then read from the same register, it is clear that the write has not been sucesfull. In fact,  nothing has happened.

[root@alarm ~]# i2cget -y 0 0x4e 0x3d
0x00


I am confident in the operation of the I2C devices I am using, I have not had a problems doing similar operations with them before. Has anyone else had these problems? Is it worth trying a later version of the SD card image? All the forum posts I have read seem to relate to problems getting I2C to work on a 3.x Kernel and Olimex say that it should work on 2.6. Any ideas please?