Hardware Reference
In-Depth Information
The lower count of the used pins makes serial methods more viable for microcontroller work. Out of the three common
communication methods that are implemented in the Arduino, only two are viable for use for multiprocessing: I2C
and Serial Peripheral Interface (SPI).
I2C and SPI have the advantage over serial because they offer the ability to connect multiple devices over a data
bus. The I2C and SPI serial communication standards are natively available within the Arduino without any extra
hardware and are excellent choices for chip-to-chip communication. Unlike regular serial, which uses two separate
lines for each connected device, I2C and SPI share the same data transmission lines and are also synchronous
communication methods, both using a shared clock line, which helps with the reliability of transmitted data. SPI is
capable of running faster than I2C, but SPI uses more digital connection when adding more end devices. The added
digital connections are used to address the individual connected devices. Concentrations of the differences between
SPI and I2C need to be taken into account when deciding which method will meet the requirements of a project.
I2C
I2C is a great choice for connecting processors, sensors, and accessories. It has a significant amount of support from
multiple hardware vendors, at least in part because of its low pin count to connect multiple devices. I2C requires
only two lines, a serial clock and a serial data line, shared between multiple end devices. It has advanced features
including flow control, addressing, master/slave both able to control data transmission, and clock stretching to allow
interoperability of slower devices.
I2C has some disadvantages that keep it from being a direct choice for chip-to-chip communications:
I2C is only capable of half-duplex transmission and the bus speed is lower to allow for
two-way communications.
I2C has a large address space and allows you to create large networks. An increase in the
number of devices can be problematic, however, because as the number of devices go up,
the data line can become saturated with transmissions, choking the serial transmission and
increasing the number of data collisions.
I2C has a deterministic method to deal with collisions between devices, so data should not
be lost unless the end device waiting to send fills its entire buffer with data before it can take
control of the data line, which is possible on busy networks.
Other problems can occur with communications between two distant endpoints within a large network.
Capacitance of the data and clock lines can be increased when a line grows in size, due to the data and clock on I2C
connections being pulled high. The change in capacitance directly affects the rise and fall time of the digital signal,
requiring slower bus speeds to accommodate the delay in the state change. The capacitance is negligible with short-
run wire distances, but requires extra consideration on larger systems if a higher data rate is required. There is more
bandwidth loss in I2C inherently because the protocol has built-in handshaking and reply packets.
I2C may be a sufficient solution for chip-to-chip communication if only a few devices neesd to be connected or
the amount of data being transferred is minimal. I2C was earlier described in Chapter 6; refer to the example there for
the basic techniques for implementing I2C communications with Arduino.
hardware that is labeled as having a “two-wire interface” is similar to i2C, with some key differences.
diligence should be used when selecting components, especially if the two standards are to be used in conjunction to
ensure compatibility.
Note
 
 
Search WWH ::




Custom Search