3

I've been trying to learn about I2C today, it's taken me some time to set up but I've now got a Raspberry Pi configured with i2c-tools installed and I can see /dev/i2c-0.

However when I run i2cdetect -y 0 I get an empty address table. This makes sense as I don't have any device connected to the I2C bus. What I would like to do is be able to write to the I2C pins and observe the output using my oscilloscope or even connect an LED so I can see state changes.

Is this even possible, and if so how would I go about it? Thanks in advance.

James
  • 3,957
  • 4
  • 37
  • 82

1 Answers1

5

Provided you have everything set up correctly, you should see something on your scope while i2cdetect scans the I2C bus for available devices.

I2C is built such that you get a NACK after writing the i2c-address if you try to talk to an address that doesn't exist on the bus. This is how i2cdetect knows a device of a specific address doesn't exist on the bus. So you can't see any actual data transactions without having another device on the bus. See the I2C User Manual.

I suggest you attach a simple I2C device such as an RTC (like DS3231M or DS3232M) or a temperature sensor on your I2C bus and try interfacing with them to see an actual I2C transaction.

Another method (which I usually use) is to have another microcontroller with a known-good I2C-slave implementation act as a loopback on the bus.

Akhil
  • 344
  • 1
  • 8