Search code examples
pythoni2c

I2C tools, i2cdetect and i2cset works perfectly, but i2cget returns 'read failed'


I am pretty new to I2C protocol, but I managed to write to my device. I bought the ADV7630 evaluation board, which is an HDMI switch controlled by I2C.

I can write to registers using I2c, also i2cDetect works showing all devices. I also tried to read register contents, but whatever I try to read, I always get 'Read failed'. Also i2Cdump get all 'XX'.

Whai I read somewhere is bad connection, so I double checked, and soldered connectors, but this does not helped.

My hardware is ADV7630 Evaluation board from Analog Device, and a Raspberry Pi using raspbian latest distro.

Any clue about that would be really appreciated.

Thanks.

Command used:

i2cdetect -y 1

I got only 0x74 device (which is normal according to the adv7630 datasheet)

i2cset -y 1 0x58 0xff 0xff  # reset device
i2cset -y 1 0x58 0x0c 0x40  # disable chip powerdown
i2cset -y 1 0x58 0xea 0xc8  # set TXB main map address
i2cset -y 1 0x58 0xeb 0x80  # set TXB packet map address
i2cset -y 1 0x58 0xec 0x8e  # set TXB EDID map address
i2cset -y 1 0x58 0xed 0x8c  # set TXB Test map address
i2cset -y 1 0x58 0xee 0xb8  # set TXA main map address 
i2cset -y 1 0x58 0xef 0x70  # set TXA packet map address
i2cset -y 1 0x58 0xf0 0x7e  # set TXA EDID map address
i2cset -y 1 0x58 0xf1 0x7a  # set TXA test map address
i2cset -y 1 0x58 0xf9 0x64  # set repeater map address
i2cset -y 1 0x58 0xfa 0x6c  # set EDID map address
i2cset -y 1 0x58 0xfb 0x68  # set HDMI rx map address


i2cget -y 1 0x58 0xe1

Error: Read failed

i2cdetect -y 1

I got devices numbers detected: (in this case: 38,3d,3f,40,46,47,64,74) which is expected.


Solution

  • I found out what happened. Actually my device require something caled i2c repeat start condition. Since this is not activated by default on i2ctools, it is not working with my device.

    The way you can activate i2c repeat start condition with Raspbian and i2ctools is this:

    Create a file at /etc/modprobe.d/i2c.conf and set content to this:

    options i2c_bcm2708 combined=1

    and it works fine!

    Thank you for your help!

    References:

    https://ez.analog.com/message/77452

    http://rabbit-note.com/2015/02/15/raspberry-pi-i2c-repeated-start/