Академический Документы
Профессиональный Документы
Культура Документы
MODULE II
COMMUNICATION PROTOCOLS
Serial Communication
1
Embedded Systems Module II: Communication Protocols
Parallel Communication
Parallel transmission allows transfers of multiple data bits at the same time over
separate media
Bus Protocol
2
Embedded Systems Module II: Communication Protocols
In UART communication, two UARTs communicate directly with each other. The transmitting
UART converts parallel data from a controlling device like a CPU into serial form, transmits it in
serial to the receiving UART, which then converts the serial data back into parallel data for the
receiving device. Only two wires are needed to transmit data between two UARTs. Data flows
from the Tx pin of the transmitting UART to the Rx pin of the receiving UART.
3
Embedded Systems Module II: Communication Protocols
UARTs transmit data asynchronously, which means there is no clock signal to synchronize the
output of bits from the transmitting UART to the sampling of bits by the receiving UART.
Instead of a clock signal, the transmitting UART inserts start and stop bits to the data packet
being transferred. These bits define the beginning and end of the data packet so the receiving
UART knows when to start reading the bits.
When the receiving UART detects a start bit, it starts to read the incoming bits at a
specific frequency known as the baud rate. Baud rate is a measure of the speed of data
transfer, expressed in bits per second (bps). Both UARTs must operate at about the same baud
rate.
The UART that is going to transmit data receives the data from a data bus. The data bus is used
to send data to the UART by another device like a CPU, memory, or microcontroller. Data is
transferred from the data bus to the transmitting UART in parallel form. After the transmitting
UART gets the parallel data from the data bus, it adds a start bit, a parity bit, and a stop bit,
creating the data packet. Next, the data packet is output serially, bit by bit at the Tx pin. The
receiving UART reads the data packet bit by bit at its Rx pin. The receiving UART then converts
the data back into parallel form and removes the start bit, parity bit, and stop bits. Finally, the
receiving UART transfers the data packet in parallel to the data bus on the receiving end:
4
Embedded Systems Module II: Communication Protocols
UART transmitted data is organized into packets. Each packet contains 1 start bit, 5 to 9 data bits
(depending on the UART), an optional parity bit, and 1 or 2 stop bits.
START BIT
The UART data transmission line is normally held at a high voltage level when it’s
not transmitting data. To start the transfer of data, the transmitting UART pulls the transmission
line from high to low for one clock cycle. When the receiving UART detects the high to low
voltage transition, it begins reading the bits in the data frame at the frequency of the baud rate.
DATA FRAME
The data frame contains the actual data being transferred. It can be 5 bits up to 8 bits long if a
parity bit is used. If no parity bit is used, the data frame can be 9 bits long. In most cases, the data
is sent with the least significant bit first.
PARITY
The parity bit is a way for the receiving UART to tell if any data has changed during
transmission. Bits can be changed by electromagnetic radiation, mismatched baud rates, or long
distance data transfers. After the receiving UART reads the data frame, it counts the number of
5
Embedded Systems Module II: Communication Protocols
bits with a value of 1 and checks if the total is an even or odd number. If the parity bit is a 0
(even parity), the 1 bits in the data frame should total to an even number. If the parity bit is a 1
(odd parity), the 1 bits in the data frame should total to an odd number. When the parity bit
matches the data, the UART knows that the transmission was free of errors. But if the parity bit
is a 0, and the total is odd; or the parity bit is a 1, and the total is even, the UART knows that bits
in the data frame have changed.
STOP BITS
To signal the end of the data packet, the sending UART drives the data transmission line from a
low voltage to a high voltage for at least two bit durations.
6
Embedded Systems Module II: Communication Protocols
Operation
If multiple slave devices exist, the master generates a separate slave select signal for
each slave.
• Bit-oriented protocol.
• Developed by the ISO.
• Specifies packetization standard for serial links.
• Supports half-duplex and full-duplex communication lines
7
Embedded Systems Module II: Communication Protocols
HDLC Stations
• Primary Station
• Controls all other stations on the link
• Primary station issues commands and secondary issues responses.
• Responsible for the organization of data flow and error recovery at the data link
level.
• Secondary Station
• Under the control of the primary station.
• No control over the link.
• Activated when requested by the primary station.
• It only responds to the primary station.
• Combined Station
• Combination of a primary and secondary station.
• All combined stations are able to send and receive commands and responses
without any permission from any other stations on the link.
• Each combined station is in full control of itself.
• No other stations can control any combined station.
• May issue both commands and responses.
HDLC Configurations
• Unbalanced Configuration
• Consists of a primary station and one or more secondary stations.
• The unbalanced condition arises because one station controls the other stations.
• In an unbalanced configuration, any of the following can be used:
• Full-Duplex or Half-Duplex operation
• Point to Point or Multi-point networks
• Balanced Configuration
• Consists of two or more combined stations.
• Each of the stations has equal and complimentary responsibility compared to each
other.
• Balanced configurations can use only the following:
• Full - Duplex or Half - Duplex operation
• Point to Point networks
8
Embedded Systems Module II: Communication Protocols
• Symmetrical Configuration
• Consists of two independent point-to-point, unbalanced station configurations.
• In this configuration, each station has a primary and secondary status.
• Each station is logically considered as two stations.
9
Embedded Systems Module II: Communication Protocols
• Flag
– It identifies the beginning and end of the frame.
– unique 8 bit sequence.
• Address -Typically source or destination
• Control - Status or commands
• Info – not always present
• Flow Control
– Mechanism by which a slow receiver prevents it from being swamped with
transmission from a fast transmitter.
• CRC/FCS
– The Frame Checksum field is a minor variation on the cyclic redundancy
code.
10
Embedded Systems Module II: Communication Protocols
11
Embedded Systems Module II: Communication Protocols
• Each device hooked up to the bus has its own unique address (whether it is MCU, LCD
Driver, memory or ASIC)
• Each of these can act as receiver and /or transmitter
• Devices can be considered as masters or slaves
START
• Generated by master
• Acts as a signal to all connected ICs that something is about to be transmitted. All
connected ICs will listen to the bus
• Bus is considered to be busy after Start condition
• A HIGH to LOW transition on the SDA line while SCL is HIGH indicates a START
condition
STOP
• Generated by master
• Acts as a signal for all devices on the bus that the bus is available again
• Bus is considered to be idle after Stop condition
• A LOW to HIGH transition on the SDA line while SCL is HIGH indicates STOP
condition
The bus stays busy if a repeated START is generated instead of a STOP condition.
Transmission of data
12
Embedded Systems Module II: Communication Protocols
Here the master (microcontroller A) generates the timing and terminates the transfer.
13
Embedded Systems Module II: Communication Protocols
CAN Networks
1 2 3 n
CAN_H
RT
RT = 120
(120
CAN_L
Introduction
Features
14
Embedded Systems Module II: Communication Protocols
Uses A Tiered- Star Topology With Upto 127 Devices Connected To A Single Host
Controller.
Hot Swappable
Plug ‘N’ Play
Usb Hub Enable Rapid And Seamless Port Expansion.
Capable Of Sourcing Upto 500 Ma Current At +5v.
Guaranteed Bandwidth And Low Latencies.
Eliminating The Need For External Power Supply
Attachment Is Detected And Device Is Configured Automatically.
Single Standard Connector.
Error Detection/ Recovery Is Automatic
Individual Usb Cables Can Run As Long As 5 Meters; With Hubs, Devices Can Be Upto
30 Meters Away From The Host
Many Usb Devices Can Be Put To Sleep By The Host Computer When The Computer
Enters A Power Saving Mode.
USB PROCESS
When the host powers up, it queries all of the devices connected to the bus and assigns
each one an address.this process is called enumeration.
Devices are also enumerated when they connect to the bus.
The host also finds out from each device what type of data transfer it wishes to perform
When a usb device is first connected to a usb host, the usb device enumeration is started.
The Enumeration Starts By Sending A Reset Signal To The Usb Device.
The speed of the usb device is determined during the reset signaling.
After reset, the usb device’s information is read by the host, then the device is assigned a
unique 7-bit address
If the device is supported by the host, the device drivers needed for communicating with
the device are loaded and the device is set to a configured state
15
Embedded Systems Module II: Communication Protocols
If the usb host is restarted, the communication process is repeated for all connected
devices. In the enumeration process, data structures (transfer descriptors) contain
information needed by the host to generate transactions.
16
Embedded Systems Module II: Communication Protocols
Types of PCI
Original PCI
PCI 2.3
PCI-X
PCI Express
17
Embedded Systems Module II: Communication Protocols
Low speed
low cost
16 Jumpers & DIP
ISA 16 bits 8MHz compatibilit
MBps switches.
y
becoming obsolete
widely used
very high
speed,
incompatible with
Plug &
PCI 64 bits 133 MHz 1 GBps older systems,
Play,
can cost more
dominant
board-level
bus
18