Linux Kernel & Device Driver Programming

I2C Bus

This file uses the W3C HTML Slidy format. The "a" key toggles between one-slide-at-a-time and single-page mode, and the "c" key toggles on and off the table of contents. The ← and → keys can be used to page forward and backward. For more help on controls see the "help?" link at the bottom.

*

Image of a AUV using I2C bus from http://www.ncsurobotics.com/site/pages/auv1.1.php

The I2C Bus

  • A simple, cheap, low-speed bus, used in many embedded systemss
*

Image from http://www.lammertbies.nl/comm/info/I2C-bus.html

The I2C Bus

Image from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1163405566/2

Protocol to Send a Message

  1. MCU sends START; everyone else listens for incoming data
  2. MCU sends ADDRESS of the target & whether it is a read or write
  3. Devices that don't match the address stay silent until the MCU sends a STOP
  4. Target replies, with an ACKNOWLEDGE
  5. Once MCU receives the ACKNOWLEDGE, it begins sending or receiving data
  6. When the communication is done, MCU issues a STOP

Image from http://www.8051projects.net/i2c-twi-tutorial/introduction.php

The Bus Conditions/States

  • START:
    (1) SDA pulled low;
    (2) SCL pulled low
    It is OK to repeat STARTs within message
  • STOP:
    (1) SCL released;
    (2) SDA released
    There can be no STOPs within a message

Sending A Byte to a Slave

Slave Acknowledging Receipt of Byte

To send data to a device a "start" command is issued. It tells all devices to pay attention to the next command, which is the address phase. The address phase selects the specific device on the I2C bus that is targeted for communication. After a device is selected by the address phase number (register pointer) is sent to the device to tell it which of its internal registers will be written to. Then the data is sent. The device (SAA7110 A/D) will autoincrement its internal register pointer after each byte is sent. The transmission is then completed with a "stop" command.

Hazards

The Linux I2C Core

References