Scan I2C bus for any present device - the easy way!
Using a ScanaQuad logic analyzer and pattern generator, powered by the latest ScanaStudio V4.0, there are really a lot of things you can do. Today let’s look at one application which you may encounter in many different situations in the life cycle of an electronics product. Often we design printed circuit boards with many (sometimes dozens) of I2C devices (like temperature sensors, ambient light sensors, IMU, EEPROM, RAM, and the list goes on!).
In such a scenario, one often needs to quickly check if all devices are responding correctly (i.e. that they are acknowledging their address call on the I2C bus).
We have written a small add-on script for SQ logic analyzer device that let’s you do just that! Meet the I2C scanner script:
How the I2C scanner actually works
This add-on script offer two features:
- A signal builder feature
- A signal decoder feature
So here is how it works:
- Using the signal builder feature, you build a long series of I2C address calls (128 addresses actually, minus the reserved and invalid I2C addresses).
- Then, you setup the SQ logic analyzer in mixed mode (Capture + Generate) and set the I2C lines in open drain mode. Optionally, you can activate internal 10K pull up resistors inside the SQ device front end (see picture below).
- Run a Generate/capture sequence with your SQ device
- Decode captured signals and open the hex view.
The decoder function of this script is very simplistic and it’s main (and only) purpose is to like the addresses of I2C devices present on an I2C bus as in the example below: