Electronic – Is the SCK line in I2C unidirectional or bidirectional

communicationi2cserial

I've always considered SCK to be a unidirectional line since the master generates/transmits the clock signal and the slaves "see" the generated pulses. I have found many sources that agree with this idea via Google. However, I was reading this I2C primer/refresher by Analog and I noticed they defined the SCK line as bidirectional:

From paragraph 3: "The I2C bus uses only two bidirectional lines, Serial Data Line (SDA) and a Serial Clock Line (SCL). "

So what's going on here? Is the SCK line only bidirectional sometimes, like when there is more than one master in the I2C configuration?

Best Answer

The clock line can be bi-directional for two reasons.

  • Clock stretching
  • Multi-master.

Typically on slave devices that are entirely implemented in hardware the clock line is input-only. Such devices have no need to stretch the clock.

On the other hand microcontroller based slaves typically do need to stretch the clock to give them time to interpret the incoming bytes and prepare an appropriate response.

Unfortunately there are some masters out there that do not fully implement I2C and don't take any notice of clock-stretching or worse try to drive the line hard high. Such masters will not work correctly with a slave that needs to clock stretch.