how can I make an I2C sniffer

Status
Not open for further replies.

kito

Active member
Hi,

I made a simple i2c program to sniff 2 IO inputs looking for a START condition. Once it sees the START it then records changes on the 2 pins in a tight loop. When it sees the STOP condition, the raw data is then decoding into human readable text i2c command via serial port. It works well while capturing one command, but its misses i2c commands while processing the raw data into text commands.

I measured the polling read speed to be 16Mhz in a loop with no overhead(96Mhz). So I think the Teensy can sample the inputs for changes and build a buffer while decoding the previous buffer. My I2C bus run pretty slow and I can program it to 60-400khz speed. So I am wondering if it is possible to run ISR routine or a 2nd thread to make this work. I read about ISR input capture info but it looks a bit complex for me.

Another idea I had was to just trigger the ISR at a set interval to check if the input pins changed.

Any suggestions on how to proceed.

Thanks.
 
Status
Not open for further replies.
Back
Top