Spy on i2c bus

Hi all. I've used a logic analyzer to sniff som data on a circuit. It uses i2c to communicate between 2 devices and I got all the details about the communication.
However. I want to "listen in" on the communication with my arduino. Do I have to time a request via the bus during the other master is waiting, or can I listen in when the other master makes a request with something like Wire.read()?

Sorry for my english. But hopefully you guys can understand my question anyways. :slight_smile:

Have you heard of the XY-problem ?

Why do you want to use an Arduino to listen to the I2C bus ?
Tell us about your project.

The normal 16MHz Arduino boards with ATmega microcontrollers are not fast and they can not store enough samples.
It is possible to use Wire.read(), but that will return a HIGH or LOW, and that will not detect a collision.

Are you trying to create a Multi Master I2C bus ? That will not work. Are you trying to add an Arduino to an existing I2C bus (with a Master and a Slave/sensor) ? That is not possible.
The Arduino microcontroller can detect a collision and the Arduino Wire library recognizes most collision problems, but there will be a lot of problems.

If you want to be the first person to get a Multi Master I2C bus reliably working with Arduino, then you have to be a super experienced software engineer and a nerd as well.

Design your project to have a single Master, or perhaps some kind of I2C multiplexer is possible. When a 5V I2C bus will be combined with a 3.3V I2C bus, use a I2C level shifter.

If you have a spare Mega lying around, you could use this to spy on the I2C. I haven't used it so have no idea if it's any good.

Pete

Thanks for the reply. And no. I have not heard about the XY problem earlier. However, looking back on my post. I can surely relate to it. :slight_smile:

I have a commercial product, communicating via i2c between 2 pcb's. I want to use an arduino to listen in on the transmitted data to process it in my own way. Via a logical analyser, I have already got addresses and such information. But my question is:

Can I initialize a Wire.read() when the master pulls the data line low (getting ready for a transmission). Or can I in some other way get the information that is communicated between the pcb's on the i2c bus to my arduino? Some typ of data sniffing. :slight_smile:

Hopefully this was a bit more clear, even though. It's sortof messy trying to explain.

No, not with a normal Arduino board and the normal Arduino Wire library.

Perhaps with extra hardware, or a microcontroller with a USI: https://community.atmel.com/projects/i2c-twi-sniffer or with a faster processor.

It depends on the Master and the Slave/sensor. There is a very small chance that an Arduino can be used as man-in-the-middle by setting the Arduino as a Slave and using a software I2C for the Slave/sensor.

Every solution is complex and might not work.

Why do you want to read that data ? Please explain what your project is about. What kind of Master device ? What kind of Slave/sensor ? What kind of data ?