master (a microcontroller), three slave nodes (an ADC, a
DAC, and a microcontroller), and pull-up resistors (Rp) uses
only two bidirectional open-drain lines — Serial Data (SDA)
and Serial Clock (SCL) — pulled up with resistors, with one
on each signal line, ranging from 2.2K ohms to 10K ohms.
These pull-ups are required for only one of the I2C devices
connected to the bus. Typical voltages used are +5V or
+ 3.3V, although systems with other voltages are permitted.
The I²C reference design has a seven-bit or a 10-bit
(depending on the device used) address space. Common
I²C bus speeds are the 100 Kbit/s standard mode and the
10 Kbit/s low-speed mode, but arbitrarily low clock
frequencies are also allowed. Recent revisions of I²C can
host more nodes and run at faster speeds (400 kbit/s fast
mode; 1 Mbit/s fast mode plus or Fm+; and 3. 4 Mbit/s
high-speed mode). These speeds are more widely used with
embedded systems rather than on PCs. There are also other
features, such as 16-bit addressing.
Note that the bit rates quoted are for transactions
between the master and slave without clock stretching or
other hardware overhead. Protocol overheads include a
slave address and perhaps a register address within the
slave device, as well as per-byte ACK/NACK bits. So, the
actual transfer rate of user data is lower than those peak
bit rates alone would imply. For example, if each interaction
with a slave inefficiently allows only one byte of data to be
transferred, the data rate will be less than half the peak bit
rate. The maximum number of nodes is limited by the
address space, and also by the total bus capacitance of 400
pF which restricts practical communication distances to a
few yards.
There is an I2C bus master and the I2C peripherals
which respond to commands sent by the master controller.
Each device on the bus listens for its address, and wakes up
when the address sent by the master matches the selected
peripheral address. Using the I2C bus, we can network up to
128 devices using seven-bit addressing, and up to 16,384
devices using 14-bit addressing. Bus capacitance will limit
the distance at which we can reliably communicate, and will
probably also limit the actual number of devices to well
below the theoretical limits.
The master initiates the I2C message transfers using its
Start condition. Each device on the I2C bus listens for its
address before responding. The I2C interface is known as a
synchronous serial interface since one of the signals is a
clock signal, unlike serial RS-232 which is asynchronous. It is
similar to the SPI four-wire interface.
The I2C message strings are just sequences of I2C
conditions sent from the master to the peripherals. These
include the Start condition, Re-start condition, Acknowledge
condition, Not Acknowledge condition, and the Stop
condition. We will describe these sequences in greater
detail in Part 2 when we cover the necessary I2C firmware.
HOW I2C CAN BE USED ON VEX
You may be asking yourself how I2C relates to VEX
robotics. Well, see for yourself in Figure 4, which shows
the new VEX Cortex microcontroller and a new 393 motor
with the integrated quadrature encoder connected to the
I2C port. This is the first I2C sensor product to be released
by IFI. The new VEX Pro microcontroller based on an ARM9
core also has a similar I2C port. Why would you want to use
the I2C interface?
The main reason for VEX users is the variety of new
digital sensors and actuators that can be connected to the
I2C bus. These can easily be interfaced. Other advantages
are that digital sensors are much simpler to use. In addition
to providing digital readings, they don’t require much
calibration since they are usually factory calibrated.
Another advantage is that they can easily be networked
to processors with a limited number of general-purpose
The new VEX Cortex microcontroller allows
users to connect advanced digital sensors to it
using its built-in I2C hardware interface. Just think
of all the sensors and other devices that we will
be able to use for our VEX robot applications!
These include electronic compasses, GPS, serial
EEPROMs, digital temperature sensors, pressure,
humidity, XYZ accelerometers, six to nine DOF
gyros, DC motor controllers, servo controllers,
stepper motor controllers, LCD displays, and math
co-processors.
Another advantage for using I2C is saving
precious GPIO pins on the VEX microcontroller. It
FIGURE 4. The new VEX
Cortex microcontroller and a
new 393 motor with the
integrated quadrature encoder
connected to the I2C port.
54 SERVO 01.2013