i2c Sniffer with the Atmega


Alex Leone / codes / avr / i2c_sniffer

main.c
Makefile

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
                

Hardware Setup:

Software Setup: