Both I2C and SPI use a controller-generated clock to time serial data. I2C addresses multiple devices over two wires. A typical four-wire SPI link selects a peripheral and can send and receive simultaneously.
A simulator showing I2C and SPI clock and data signals step by step
1. Choose the bus and values to transmit
2. Step through the transfer
Each step reveals another part of the waveform. Orange dots mark sampling instants.
I2C: two wires, address-based selection
I2C uses SCL for clock and SDA for data. Pull-up resistors hold the lines high; devices drive them low using open-drain outputs. This allows devices to share the lines without actively driving opposite logic levels.
START is SDA falling while SCL is high, followed by a 7-bit address and read/write bit. The addressed target acknowledges by pulling SDA low. Data changes while SCL is low and is stable while SCL is high; SDA transitions during SCL high indicate START or STOP.
SPI: four wires and simultaneous exchange
SPI uses SCK, controller output MOSI, peripheral output MISO, and chip select CS. Selecting a peripheral with CS avoids an address field, and SPI has no standard ACK bit. Over eight clocks, each side shifts out and receives one byte.
Mode 0 keeps the clock low when idle and samples on rising edges. Modes 1–3 use other clock polarity (CPOL) and phase (CPHA) combinations. Always match the peripheral's datasheet settings.