I have some errors during debugging I2C chip. I took an oscilloscope and found some strange artifacts on the log: enter image description here

Maybe somebody has a suggestion about such questions? 1. What are these strange spikes at the beginning of each clock cycle? 2. Why SDA data ground level have different values?

  • \$\begingroup\$ 2 V/division on SDA? \$\endgroup\$ Sep 16 '19 at 20:30
  • \$\begingroup\$ artsin - There are several strange parts of that trace. It would help if you can add more context and background into the question e.g. what are the master & slave I2C devices, has this ever worked, add the relevant part of the schematic, add some photos of the actual hardware and probing etc. Then about that trace - the annotation by the scope says 2V/div for both channels, but Ch1 seems to be ~ 8 div max (no overshoot!) and Ch2 seem to be ~ 3 div max (exc overshoot), so 2V/div makes no sense. And the two signals have very different amplitudes, again nonsense for both being 2V/div. Thanks. \$\endgroup\$
    – SamGibson
    Sep 16 '19 at 20:53
  • \$\begingroup\$ So SCLK has 5VPP and SDA has 15 or 16VPP. Not bad for a 5V signal. \$\endgroup\$ Sep 16 '19 at 21:03
  • \$\begingroup\$ when I see waveforms like that, sometimes it's the result of two totem pole outputs fighting to drive a bus signal to different levels... \$\endgroup\$
    – vicatcu
    Sep 16 '19 at 23:31

SDA has different low levels depending on whether the master or slave is pulling it down. This is actually a useful debug tool because you can tell who is controlling the SDA at that moment. You will probably eventually wish to determine why they are pulling down to different grounds, though.

The spikes are overshoot, caused by impedance mismatch.

  • \$\begingroup\$ They are not pulling to different grounds. Master and slave devices just have different output driver strength (output impedance). So with the pull-up resistor there is on the bus, stronger device is able to pull the voltage lower than the weaker device. \$\endgroup\$
    – Justme
    Sep 16 '19 at 20:16
  • \$\begingroup\$ @Justme, that could definitely be the case. Normally the drivers should be pulling low with a few ohms resistance at most, versus a pull-up of several kohm, so this large difference wouldn't be visible. Without knowing anything about the setup and devices, it's hard to say what's causing the master and slave to have different low levels. Certainly one of them might have a terribly weak output. \$\endgroup\$
    – Annie
    Sep 16 '19 at 20:25
  • \$\begingroup\$ It looks like there's three distinct levels, so you can see Slave, Slave+Master, and Master \$\endgroup\$
    – BeB00
    Sep 16 '19 at 20:52
  • 1
    \$\begingroup\$ @Annie pin output stages can pull low with a resistance in the few tens of ohms range, not in the few ohms range. A MCU I use can pull 8mA down to 0.4V, while I2C specs only requires a device to pull low 3mA down to 0.4V - and many I2C devices only guarantee this. So that's already about a range of 50 to 130 ohms for the low output driver, so allowed variation is large. Also the pull-ups that would provide the 3mA necessary on a high performance 400kHz bus would be in the 1.5 kohm to 2 kohm range, not several kohm range. This will make any differences in the SDA output stages quite visible. \$\endgroup\$
    – Justme
    Sep 16 '19 at 22:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.