How I Analyse I2C Communication Using Saleae Logic Analyzer
- Uchi Embedded Solutions

- 33 minutes ago
- 4 min read
In this article, I will show how I analyse I2C communication using a Saleae logic analyzer. This tutorial explains the basic setup, how to capture signals, how to enable the I2C protocol analyzer, and how to understand the decoded data. The same method can be used when debugging communication between a microcontroller and peripheral devices such as sensors, EEPROM, or display controllers.

I2C is one of the most used serial communication protocols in embedded systems. It uses two signals, SDA for data and SCL for clock, and allows multiple devices to communicate on the same bus using addressing. Because of this shared bus architecture, debugging I2C using only an oscilloscope is often difficult, so I normally use a logic analyzer with protocol decoding support from Saleae.
Test Setup
For this tutorial I used HMC5883L three-axis magnetometer. This sensor communicates over the I2C interface and continuously updates the magnetic field measurement registers, which makes it very convenient for testing I2C read operations. The device can also generate status updates internally, but for this example I only focus on reading data from the measurement registers. After power-up, the HMC5883L automatically starts sampling the magnetic field and stores the output values in its data registers, so the microcontroller can read the values at any time through the I2C bus.
To prepare the hardware, I solder header pins to the HMC5883L breakout board and connect it to the ESP32C6 board as shown in the wiring diagram. The I2C signals GND, SDA, and SCL are available on the external header pins of the ESP32C6 board, which allows the same lines to be connected to the logic analyzer. This setup makes it possible to monitor the I2C communication using the Saleae logic analyzer while the microcontroller reads data from the magnetometer.
Typical connections:
Logic analyzer GND → Target GND
Channel 0 → SDA
Channel 1 → SCL

Open HMC5883L with ESP32C6 demo code in your chosen IDE. Compile the program and upload it to the ESP32C6 development board.
Open any serial terminal program line Putty, HyperTerminal, etc.
Connect to the ESP32C6 board over the assigned serial port with a baud rate of 115200, 8 data bits, no parity bit, and 1 stop bit (8-N-1). Open the connection, and you should see the Magnetometer readings being reported to you in regular intervals. Try changing the position of the Magnetometer sensor to change the readings.

Adding the I2C Analyzer
After the hardware setup, I enable the I2C analyzer in the software.
Steps I normally follow:
Open the Logic software with the Logic Analyzer plugged in.
Click on the Device Settings Button.
In the device settings window, set the speed to at least 50 MS/s and the duration to 1 second.
Click both Clear buttons to disable all channels, leaving only digital Channel 0 enabled.
Click digital Channel 1 to enable it as well.


Set the protocol analyzer by clicking on the plus button (+) next to Analyzers on the right side.

Select I2C to bring up the settings window. Leave everything as default and click Save.

The data line (SDA) is normally the first signal to change during an I2C transfer. Because the lines are open drain, they will be nominally high, which means that we need to watch for a high-to-low transition.
Click on the Trigger Button next to Channel 0 (I2C - SDA), and select the Trigger on Falling Edge option.

Click Start to begin collecting data.
Once the analyzer is Started, the software automatically decodes:
Start condition
Slave address
Read / Write bit
Data bytes
ACK / NACK
Stop condition

This makes it much easier to understand the communication between the master and slave device.
Understanding the Captured Data
When I analyse the captured data, I check the communication in this order:
Verify START condition
Check slave address
Confirm read / write operation
Check data bytes
Verify ACK after every byte
Confirm STOP condition
If decoding is incorrect, I zoom into the waveform and check for signal issues.
Common problems I usually see:
Missing pull-up resistors
Slow rising edges
Noise on SCL
Wrong clock frequency
Incorrect slave address
Since I2C uses open-drain lines, signal quality directly affects decoding accuracy.
Why I Use Logic Analyzer for I2C Debugging
In many embedded projects, I2C problems are caused by firmware mistakes or hardware timing issues. Using a logic analyzer allows me to see the real bus activity instead of relying only on software logs.
With protocol decoding enabled, I can quickly verify:
Whether the master sends correct address
Whether the slave responds with ACK
Whether the data matches expected value
Whether timing is correct
This makes debugging much faster during:
Board bring-up
Firmware development
Peripheral integration
Production testing
Conclusion - Debug Hardware like the Pros.
Using a Saleae logic analyzer is one of the most effective ways to analyse I2C communication in embedded systems. By capturing SDA and SCL signals and enabling the I2C analyzer, I can view the complete transaction including address, data, and acknowledge bits. This method helps quickly identify communication problems and is very useful when working with multiple I2C devices on the same bus.




Comments