Set up the analyser
Our Uno asks an LM75B temperature sensor for a reading over I2C and gets nothing back. Clip on a logic analyser: channel 0 to SCL, channel 1 to SDA, and its ground to the board's ground.
The analyser samples: it checks every wire again and again. Wire runs I2C at 100 kHz, so one clock lasts 10 µs. At 4 MS/s (million samples a second) that is 40 samples per clock: every edge shows.
Memory is limited, so tell the analyser which moment to keep: a trigger. SDA falling while SCL is high happens only at an I2C START. It waits for that edge, then keeps the samples just before and after it.
Find the NACK
Run the driver. At each SCL rise the decoder reads SDA: 0 0 1 0 0 0 0, then 0 for write. That is address 0x10. But the sensor's address is 0x48.
On the ninth clock the Uno lets go of SDA, and the chip with that address should pull it low: an ACK. SDA stays high: a NACK. No chip has address 0x10, so endTransmission() returns 2.
The code passes 0x90, the 8-bit form that already holds the write bit. Wire expects 7 bits and shifts left itself: 0x90 becomes 0x120, the top bit falls off the byte, and 0x20 goes out.
Set ADDR to 0x48. Now 0x90 goes out: 1001000, then write. On the ninth clock the sensor pulls SDA low: ACK. endTransmission() returns 0, and the read brings back 0x19 0x00: 25 °C.
Catch a glitch
Days later, some readings come back wrong, yet every capture looks clean. The cause is a 100 ns spike on SCL. At 4 MS/s the analyser samples every 250 ns, so the spike can slip between two samples.
Sample at 50 MS/s, every 20 ns, and trigger on SCL high for less than 1 µs. A real clock stays high at least 4 µs, so only a glitch fires it. It fires: the sensor took the spike as an extra clock.
The spike comes from a motor wire laid beside SCL. Move it away and leave the pulse trigger armed while the board runs. If it never fires again, the glitch is gone, and so are the bad readings.
What happens
;; step 1/10 · probes board Arduino Uno R3 (ATmega328P, 5 V) sensor LM75B, runs on 2.8 to 5.5 V CH0 -> SCL (clock) CH1 -> SDA (data) GND -> board ground: the 0 V both read against the analyser records each wire as 0 or 1
The capture is drawn with idealised square edges and an evenly spaced 100 kHz clock (SCL high and low 5 µs each). A real bus has slow rising edges set by the pull-up resistors, and the Uno's clock is not exactly half high and half low. Whether the 4 MS/s capture misses a 100 ns spike depends on where it falls: with 250 ns between samples it is missed whenever no sample lands inside it. At 50 MS/s at least 5 samples always land on it.