Has anybody done anything on this that could help me from reinventing the wheel ??
I can do this with bus-pirate but I would like to be able to do it with uPython.
I guess the only way would be bit-banging using an interrupt pin ?
I2C Bus Sniffing
Re: I2C Bus Sniffing
What are you trying to do exactly?
Re: I2C Bus Sniffing
Listen to a battery talking to it's parent device.
Re: I2C Bus Sniffing
To collect raw clocked data, you can use the SPI peripheral, but you will still need to find some way to get the start and stop conditions somehow — probably with a pin interrupt, as you wrote. There is one more problem — you won't know which of the devices is pulling the line at any given moment — for that, your board would have to act as a man-in-the-middle, having each device connected to a separate set of pins and repeating what they do to the other device.
Re: I2C Bus Sniffing
Using the SPI interface will only work if a device doesn't stretch the clock.
You probably want to create a new I2C-sniffer module based on the software I2C code, or add a mode to the software I2C module to allow it to be a sniffer.
To be a sniffer the SDA and SCL signals will always be inputs and would never be driven.
You probably want to create a new I2C-sniffer module based on the software I2C code, or add a mode to the software I2C module to allow it to be a sniffer.
To be a sniffer the SDA and SCL signals will always be inputs and would never be driven.
Re: I2C Bus Sniffing
Why won't SPI work with clock stretching? The clock line will remain low until the new bit is sent, whether it's stretched or not, so I think it should work?
Re: I2C Bus Sniffing
You're right. I wasn't thinking about this in the right context. I think that the issue would be detecting start & stop bits and dealing with the ack/nack.
Re: I2C Bus Sniffing
Thanks but writing a module is beyond my capabilities, I was hoping to be able to do this within Python.