Checking I2C pull-ups

A project log for Wild Thumper based ROS robot

My ROS (Robot Operating System) indoor & outdoor robot

HumpelstilzchenHumpelstilzchen 10/03/2018 at 08:060 Comments

TL;DR: Always check your signals with an oscilloscope!

Long version:

I wanted to try out rosruby, a ROS wrapper for the ruby programming language, so I decided to port the ROS node for the LPD8806 LED strip of this robot to it. This strip uses a somewhat crippled SPI with only MOSI and SCK to control the lights. While testing the new node the I2C bus immediately and repeatable fails. Since I2C is used as the connection to e.g. the motor controller, the bus is critical for operation. This has not happened before. After ruling out power issues this smelled like a problem with electromagnetic interference, which is why I checked the SPI signals (yellow: SCK, green: MOSI) with an oscilloscope:

While there are some spikes in the SPI signal and I'm certainly missing the line impedance matching resistors for termination of the bus I don't consider the signal bad enough to disrupt a healthy I2C.

So I looked at the I2C bus instead which resulted in the following horrific picture (yellow: SCL, green: SDA)

This by any means is matching more a saw tooth then a clean rectangular signal. It is obvious that the value of 5k Ohm for the pull-up is way too high in this robot. After replacing both resistors with 1k ones the signal is now much better (yellow: SCL, green: SDA):

Also the I2C no longer fails when sending data on the LPD8806 SPI.