Breaking News

I2C Tap Helps Assign Blame For SDA Conflicts

Screenshot of a logic analyzer software, showing the SDA channel being split into three separate traces

If you’ve ever debugged a misbehaving I2C circuit, you probably know how frustrating it can be. Thankfully [Jim] over at, has a proto-boardable circuit that can help!

Inter-integrated circuit bus (aka I2C) uses open collector outputs on a two wire interface. Open collector means a device connected to the I2C bus can only pull the bus down to ground. Chips never drive a logic “HIGH” on the wires. When nothing is driving the lines low, a weak resistor pulls the lines up to VCC. This is a good thing, because I2C is also a multidrop bus — meaning many devices can be connected to the bus at the time. Without open collector outputs, one chip could drive a high, while another drives a low – which would create a short circuit, possibly damaging both devices.

Even with all this protection, there can be problems. The SCL and SDA lines in the I2C communication protocol are bidirectional, which means either a controller or a peripheral can pull it low. Sometimes, when tracing I2C communications you’ll need to figure out which part is holding the line low. With many devices sharing the same bus, that can become nigh-impossible. Some folks have tricks with resistors and analog sampling, but the tried and true method of de-soldering and physically lifting chip pins off the bus often comes into play.

[Jim’s] circuit splits SDA signal into controller-side and peripheral-side, helping you make it clear who is to blame for hiccups and stray noise. To do that, he’s using 6N137 optoisolators and LMV393 comparators. [Jim] shared a NapkinCAD schematic with us, meant to be replicate-able in times of dire need. With this design, you can split your I2C bus into four separate channels – controller-side SDA, peripheral-side SDA, combined SDA and SCL. 4 Channels might be a lot for a scope, but this is no problem for today’s cheap logic analyzers.

The circuit is rated for 100KHz debugging, but if it doesn’t work for your 400KHz (or higher) bus, you can always lower the speed. This kind of monitor is useful for taming devices going rogue, and it isn’t technically limited to SDA splitting! I2C also has a feature called clock stretching, where prehiperals are are allowed to manipulate the SCL line, too. In case of clock stretching-related problems, you can swap the SCL and SDA lines, which will allow you to use [Jim’s] circuit on SCL.

It absolutely wouldn’t be hard to assemble a device like this when you’re really stuck with a tricky I2C situation. What kind? We’ve talked about all the possible I2C problems in a long-form article of ours!

Read full news from source

No comments