[5] Bus Events

Submitted by rgcustodio on June 10, 2007 - 1:26pm.

There are many events occurring on the I2C bus but without a logic analyzer or an oscilloscope you won't be able to "see" them.

START - the device (usually the MASTER) issuing the START condition first pulls the SDA line low. And next pulls the SCL line low.

STOP - the bus MASTER first releases the SCL and then the SDA line

ACKNOWLEDGE - the addressed SLAVE device or the MASTER pulls the SDA line low, depending on the current operation

 

START and STOP

Fig 3. START and STOP events

 

The START condition acts as a signal to all connected devices that something is about to be transmitted on the I2C bus. The STOP condition tells the connected devices that the message has been completed.

 

The ACKNOWLEDGE is given by an I2C device (MASTER or SLAVE) after every byte is transmitted.

ACKNOWLEDGE

 

Fig 4. A 1-byte packet on the I2C bus.

 

The MASTER should give an ACKNOWLEDGE after receiving a byte from the SLAVE in a read operation. The SLAVE should give an ACKNOWLEDGE after receiving a byte from the MASTER in a write operation. The SLAVE should give an ACKNOWLEDGE if it is being addressed. If there is no ACKNOWLEDGE the SLAVE is not on the bus.

 

SLAVE addressed in a write operation

SLAVE addressed in a read operation

Fig 5. SLAVE being addressed on the I2C bus. A6...A0 is the 7-bit device address.

 

These events are necessary for the correct operation of the I2C bus. MCUs that have hardware support for I2C perform all this behind the scenes. If you have an MCU that does not support the I2C bus but have 2 extra I/O pins, then all is not lost! You can bit-bang the bus.

AttachmentSize
SoR_tut1_html_46a89f76.gif3.18 KB
SoR_tut1_html_2b592566.gif8.07 KB
SoR_tut1_html_76c3c7fc.gif5.06 KB
SoR_tut1_html_453ba535.gif5.97 KB
SoR_tut1_html_2640054e.gif9.72 KB

About the ack from the slave.

It might be out of the scope of the tutorial but you might want to mention how a slave device can stretch the clock (hold down the clock line untill it's ready to recieve the next byte) Generally not needed but if you are going to bit bang the interface and having problems with a device and you don't know why, clock stretching could be the reason.