6

Just a quick question. On my i2c bus 0, I have two devices, 0x32 and 0x20.

When I use i2cdetect, only one of them shows up.

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

The strange thing is, though, I can use i2cset and i2cget to send and receive messages to both of them just fine. I suppose this is not really a technical problem but just a curiosity -- why does 0x20 pretend that nobody's home?

Thanks!

Andy J
  • 1,479
  • 6
  • 23
  • 40

1 Answers1

9

Various I2C devices may behave differently when reading / writing bytes.

Some, for example, may expect write_then_read command, and won't acknowledge a standalone read command. Others may expect at least 16 bits of data to be read / written and otherwise the transaction fails.

i2cdetect can use different approaches for probing, such as read / write command, tuned by command line options. You may try -r or -q.

If that doesn't work, look at the command implementation and your device's datasheet, and make sure probing is possible.

Adashi
  • 461
  • 1
  • 4
  • 8
  • As described above, it changes the way i2cdetect performs the probing. i2cdetect loops on all range of addresses and probes each by sending either read or write command, with different methods. -r instructs it to use read command instead of write, or vice versa. – Adashi Dec 24 '14 at 12:55