i2c sniffer using the TWI module on the atmega.
This works by ACK-ing any reads/writes to any address and then quickly disabling the TWI module and using the SPI module on the SDA/SCL pins. Watch out that the slave that we're trying to sniff will always ACK its read + write commands. We could get around this by putting a diode on the SDA line so the AVR can't pull the rest of the bus low and ack for the slave that it's trying to sniff. For example (Rp = pullup resistor):
||Rp ||Rp SDA -----|<----- AVR
- SDA -> PC1 and PB5 (MOSI)
- SCL -> PC0 and PB7 (SCK)
- PB4 (SS) -> PB3 (to control SS)
- PB2 (INT2) -> SDA (for reading stop conditions)
- Read the Serial port at 115200 baud. On startup, the AVR should say 'hi'
- After the buffer is full, the atmega will dump all the data read and reset the buffer.