Click here to skip to a step-by-step PicoScope tutorial
I2C (Inter Integrated Circuit) is a low-speed serial data protocol, commonly used to transfer data between multiple components and modules within a single device.
Developed in the early 1980s by Philips Semiconductors (now NXP), I2C employs 2 signal wires to transfer “packets” of information between one or more “master” devices such as microcontrollers, and multiple “slave” devices such as sensors, memory chips, ADC and DACs.
Wiring #
Multiple “master” and “slave” I2C devices are connected to the bus using two lines:
- SCL – Serial Clock
- SDA – Serial Data
Signaling voltages are typically 0 V for logic low and +3.3 V or +5 V for logic high.
Pull-up resistors keep both lines at logic high level when the bus is idle.
Signaling #
I2C bus speeds range from 100 kbit/s in Standard mode, 400 kbit/s in Fast mode, 1 Mbit/s Fast mode plus, and 3.4 Mbit/s in High Speed mode.
Each device on the bus is recognised by a unique 7-bit or 10-bit address.
Data is transferred in “packets”, which include the address of the device, a read/write command, acknowledgements and the data being transferred.
The diagram shows the structure of a single packet of I2C data.
At the start of packet a master device takes control of the bus by driving SDA low while SCL remains high. This indicates that a message will follow.
Next a 7 (or 10) bit address is transmitted followed by a R/W bit to indicate whether it is a read (1) or write (0) instruction.
The addressed slave device then transmits an acknowledge (ACK) bit by pulling the SDA line low. If the line remains high, the master can infer that the slave did not recognise the address and corrective action needs to be taken.
After the address is acknowledged by the slave, the master continues to generate the clock and depending on the R/W bit either the master or the slave will send data over the bus. After each byte of data sent, an ACK is generated by the receiving device.
The end of packet is recognised by the SDA line going from low to high when the SCL is already high.
I2C decoding in PicoScope #
I2C serial decoding is included in PicoScope as standard.
To get started, open Serial decoding from the tool park.
Select I2C from the selection of serial decoders (left).
In the Configuration page (middle), select the data and clock channels.
The Threshold, Hysteresis will be automatically detected, but can be adjusted along with the Invert toggle and Bus Speed if not standard-mode.
On the Display page (right), give your decoder a name, and set the formats for both Graph and Table displays – Hex/Binary/Decimal/ASCII or Off. Your decoding selection can also be adjusted to a single or all buffers, and/or between rulers if setup.
Graph #
Shows decoded data in a bus format, aligned with the analog waveform, on a common time axis. Frames can be zoomed and correlated with acquired analog channels to investigate timing errors or other signal integrity issues that are the cause of data errors.
Table #
Shows a list of the decoded frames, including the data and all flags and identifiers. You can set up filtering conditions to display only the frames or data you are interested in, search for frames with specified properties, or use a Link File to translate frame ID and hexadecimal data into human-readable form.
For more information on PicoScope’s serial decoding capabilities, see Serial bus decoding and protocol analysis – overview.