Introduction
These instructions provide a quick setup for your oscilloscope for I2C monitoring. They will help you get a usable few bytes of transaction on screen. From that starting point, you can explore packets, inter-byte delays, read-to-write turnaround times, signal integrity issues and timing problems.
When setting up your oscilloscope, you need to know two parameters about your bus.
- bus speed
- operating voltage
You will need at least two channels to see the I2C bus.
You will need the scope to be free-running to find your signals on the screen. You will adjust the voltage to bring the signal waveforms on-screen. You might see static levels, square waves, or flat lines with occasional vertical lines as you set up. Once you have your signals on-screen, you can set up to capture signals and adjust timing to make them visible.
Channels
The I2C bus has two signals that you need to look at. Other signals may interface between the host controller and the target device.
Signal | Typical state | comments | |
---|---|---|---|
bus only | SDA | Idles high | |
SCL | Idles High | ||
optional signals | RESET# | Active low | Use for bus hangs and boot timing analysis. |
INTERRUPT | Active high | Interrupt latency timing. Peripheral set up analysis. | |
ENABLE | Active high | Peripheral set up analysis. | |
POWER | on | Peripheral availability. Brown out analysis. |
Remember, you must connect to the ground as well as the signal.
Each channel on your scope has a separate enable control to turn it on and off. Turn on each channel using this enable.
Start the scope running
- Trigger – auto/continuous.
- RUN – enable
Voltage
The scope may not be configured for your needs. Use the voltage scale and position controls to bring the active signals on-screen.
Voltage Scale
- Initally 2v/div.
The I2C bus will operate at 5v or less. The optional signals may not be at the same voltage level as the I2C bus. Refer to the schematic and datasheets for the actual operating parameters.
A good starting voltage scale is 2v/div to easily accommodate 4 channels on screen at once, with some overlap. 2v/div will make the signals no more than 2.5 divisions tall, and all should be visible after you set the voltage offset. You may choose to reduce the scale for each channel individually after you set the voltage offsets.
Voltage Offset
- Initially set to 0v.
- Use vertical position to spread signals evenly over the screen.
Initially, zero the voltage offset of all channels. You should see SDA and SCL overlapping and just above the axis. Some oscilloscopes have a zero
function for the channel voltage position.
Use the position dial to move the SDA signal’s 0v position above the SCL; this will match most datasheets you are looking at.
Set Trigger
- source = SDA
- Type = Falling Edge
- Level = 0.5v
- Offset = 0.0 seconds
Source and edge
- SDA
- Falling edge
You must trigger on the SDA channel to find I2C transactions on your scope. The SDA channel will have a falling edge with a valid START condition, the first event in any transaction.
Trigger level
- Level = 0.5v
The low should, theoretically, reach 0v, but this might not always happen. A logic low is usually below 30% of the maximum voltage for the signal we are monitoring. For any I2C bus implementation, a 0.5v level should work as a rule of thumb. This level is practical if you are moving your scope probe around a segmented bus where you could be on either side of a level shifter.
A logic high should be at full voltage, but logic will recognise a high above 70%.
We would use a 50% trigger level to catch risings or falling edges.
If you know the bus voltage, use the values in the table below.
bus voltage | either 50% | falling 30% | rising 70% |
---|---|---|---|
5.0v | 2.5v | 1.5v | 3.5v |
3.3v | 1.65v | 1v | 2v |
1.8v | 900mv | 600mv | 1.2v |
1.0v | 500mv | 300mv | 700mv |
Remember, just because your oscilloscope recognises a state change, your hardware may not.
Trigger offset
- 0.0 seconds
If you do not see the trigger marker on the top of your screen, you may not see events, even if you catch them. Use the horizontal scale zero
function to reset the offset to be visible.
Timing scale
- 50us/div
Timing is bus speed dependent. With our trigger set up on the START (SDA falling edge) condition, we capture from before the first bit-time. There may be some latency between the start and the first falling SCL.
speed | bit time | byte time | show one byte | 5 bytes |
---|---|---|---|---|
100 kbit/s | 10us | 90us | 9us/div | 45us/div |
400 kbit/s | 2.5us | 22.5us | 2.25us/div | 12us/div |
1 Mbit/s | 1us | 9us | 1us/div | 5us/div |
1.7 Mbit/s | 588ns | 5.3us | 500ns/div | 5us/div |
3.4 Mbit/s | 294ns | 2.6us | 250ns/div | 2us/div |
5 Mbit/s | 200ns | 1.8us | 200ns/div | 1us/div |
Sample rate
Most oscilloscopes have a sampling rate that tracks the timing scale. However, you do need to make sure you capture each clock edge on SCL so that you can see all the data. The sample rate should be at least twice that of the edges we are trying to catch.
mode | max speed | sample rate samples/sec |
---|---|---|
standard | 100 kbit/s | 400k |
fast | 400 kbit/s | 1.6M |
fast+ | 1 Mbit/s | 4M |
high-speed | 1.7 Mbit/s | 8M |
high-speed | 3.4 Mbit/s | 16M |
ultra-fast | 5 Mbit/s | 20M |