2

I am trying to verify I2C bus through command (i2c tools) only. For this purpose I detect my I2C buses as follows

ls -l /sys/bus/i2c/devices/i2c*
lrwxrwxrwx    1 root     root             0 Jan 27 12:33 /sys/bus/i2c/devices/i2c-0 -> ../../../devices/platform/ocp/44e0b000.i2c/i2c-0
lrwxrwxrwx    1 root     root             0 Jan 27 12:33 /sys/bus/i2c/devices/i2c-2 -> ../../../devices/platform/ocp/4819c000.i2c/i2c-2

For the first I2C

i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- 2d -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  

Similarly for other one

i2cdetect -y -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: UU UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

For writing something on the I2C bus trying to write 2 bytes at address 0x77

i2cset -y 0 0x77 0xf4 0x34                                                                                                          
Error: Write failed

Similarly for other one

i2cset -y 2 0x77 0xf4 0x34
Error: Write failed

Read is been done by

i2cget 

But not getting the result as expected. Please guide me. Thanks in advance.

2

The Raspberry Pi does do not have an I2C bus 2, it has an I2C bus 0 and an I2C bus 1.

Are you using a Raspberry Pi?

You can't write to an I2C device which doesn't exist. There is no evidence that a device exists at address 0x77. That is why the write fails.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.