Islamic University of Technology: EEE 4483 Digital Electronics & Pulse Techniques
Islamic University of Technology: EEE 4483 Digital Electronics & Pulse Techniques
EEE 4483
Digital Electronics & Pulse Techniques
Lecture- 14
Serial-Parallel Communication
Communication between electronic devices is like communication between humans. Both sides need to speak the same
language. In electronics, these languages are called communication protocols.
Electronic devices talk to each other by sending bits of data through wires physically connected between devices. A bit is
like a letter in a word, except instead of the 26 letters (in the English alphabet), a bit is binary and can only be a 1 or 0. Bits
are transferred from one device to another by quick changes in voltage. In a system operating at 5 V, a 0 bit is
communicated as a short pulse of 0 V, and a 1 bit is communicated by a short pulse of 5 V.
The bits of data can be transmitted either in parallel or serial form. In parallel communication, the bits of data are sent all at
the same time, each through a separate wire. The following diagram (Fig 2.) shows the parallel transmission of the letter “C”
[ASCII – 43hex] in binary (01000011):
In serial communication, the bits are sent one by one through a single wire. The following diagram (Fig. 1) shows the serial
transmission of the letter “C” in binary (01000011):
To work around this problem, asynchronous serial connections add extra start and stop bits to each byte help the receiver
sync up to data as it arrives. Both sides must also agree on the transmission speed (such as 9600 bits per second) in
advance. Slight differences in the transmission rate aren’t a problem because the receiver re-syncs at the start of each byte.
Asynchronous serial works just fine, but has a lot of overhead in both the extra start and stop bits sent with every
byte, and the complex hardware required to send and receive data.
SPI Communication
The Serial Peripheral Interface (SPI) is used to transfer data between integrated circuits using a reduced number of data lines.
SPI is a common communication protocol used by many different devices. For example, SD card modules, RFID card
reader modules, and 2.4 GHz wireless transmitter/receivers all use SPI to communicate with microcontrollers. One
unique benefit of SPI is the fact that data can be transferred without interruption. Any number of bits can be sent or
received in a continuous stream.
Key Features:
❑ Communication with serial external devices (ADC and DAC, RTC, temperature and pressure sensors,
LCD controller, etc.).
SPI Communication : continued ..
Devices communicating via SPI are in a master-slave relationship. The master is the controlling device (usually a
microcontroller), while the slave (usually a sensor, display, or memory chip) takes instruction from the master. The
simplest configuration of SPI is a single master, single slave system, but one master can control more than one
slave (more on this below).
The master sends data to the slave bit by bit, in serial through the MOSI line. The slave receives the data sent from the
master at the MOSI pin. Data sent from the master to the slave is usually sent with the most significant bit first. The
slave can also send data back to the master through the MISO line in serial. The data sent from the slave back to the
master is usually sent with the least significant bit first.
SS Line
The master switches the SS/CS pin to a low voltage state, which activates the slave
Steps of SPI Data Transmission : continued ..
The master sends the data one bit at a time to the slave along the MOSI line. The slave reads the bits as they
are received:
If a response is needed, the slave returns data one bit at a time to the master along the MISO line. The master
reads the bits as they are received
Single Master Multiple Slaves
SPI can be set up to operate with a single master and a single slave, and it can be set up with multiple slaves
controlled by a single master. There are two ways to connect multiple slaves to the master. If the master has
multiple slave select pins, the slaves can be wired in parallel like this ⇨
Single Master Multiple Slaves : Continued ..
If only one slave select pin is available, the slaves can be daisy-chained like this:
Benefits and Drawbacks
Benefits Drawbacks
No slave acknowledgment;
Supports full-duplex
communication;
I2C bus is popular because it is simple to use, there can be more than one master, only upper bus speed is defined and
only two wires with pull-up resistors are needed to connect almost unlimited number of I2C devices. I2C can use even
slower microcontrollers with general-purpose I/O pins since they only need to generate correct Start and Stop conditions
in addition to functions for reading and writing a byte.
What is I2C
17 of 40
I2C Bus Connections
I2C requires a mere two wires, like asynchronous serial, but those two wires can support up to 1008 slave devices. Also,
unlike SPI, I2C can support a multi-master system, allowing more than one master to communicate with all devices on the
bus.
Data rates fall between asynchronous serial and SPI; most I 2C devices can communicate at 100kHz or 400kHz. There is
some overhead with I2C; for every 8 bits of data to be sent, one extra bit of meta data (the “ACK/NACK” bit, which we’ll
discuss later) must be transmitted.
The hardware required to implement I2C is more complex than SPI, but less than asynchronous serial. It can be fairly
trivially implemented in software.
The Physical I2C Bus
This is just two wires, called SCL and SDA. SCL is the clock line. It is used to synchronize all data transfers over the I 2C
bus. SDA is the data line. The SCL & SDA lines are connected to all devices on the I 2C bus. There needs to be a third wire
which is just the ground or 0 volts. There may also be a 5V wire is power is being distributed to the devices. Both SCL
and SDA lines are "open drain" drivers. What this means is that the chip can drive its output low, but it cannot drive it
high. For the line to be able to go high you must provide pull-up resistors to the 5V supply. There should be a resistor
from the SCL line to the 5V line and another from the SDA line to the 5V line. You only need one set of pull-up resistors
for the whole I2C bus, not for each device, as illustrated below:
If the resistors are missing, the SCL and SDA lines will always be low - nearly 0 volts - and the I2C bus will not work.
I2C Terminology
Slave
This is the device that listens to the bus
Transmitter
and is addressed by the master
This is the device that transmits data
to the bus
Multi-master
I2C can have more than one master and
Receiver each can send commands
This is the device that receives data
from the bus
Arbitration
A process to determine which of the
Master masters on the bus can use it when
This is the device that generates clock, more masters need to use the bus
starts communication, sends I2C
commands and stops communication
Synchronization
A process to synchronize clocks of two
or more devices