Serial Communication Standards PDF

Document Details

MightyRoentgenium

Uploaded by MightyRoentgenium

Batangas State University

Tags

serial communication communication protocols electronics computer science

Summary

This document provides an overview of serial communication standards, including synchronous and asynchronous transmission, and explains various protocols like SPI, I2C, and UART. It also touches upon parallel data transmission.

Full Transcript

Lesson 3: Serial Communication Standards Synchronous - Synchronous data transmission is a data transfer method in which a continuous Communication Protocols - Communication stream of data signals is accompanied by ti...

Lesson 3: Serial Communication Standards Synchronous - Synchronous data transmission is a data transfer method in which a continuous Communication Protocols - Communication stream of data signals is accompanied by timing between electronic devices is like communication signals (generated by an electronic clock) to ensure between humans. Both sides need to speak the that the transmitter and the receiver are in step same language. (synchronized) with one another. The data is sent in blocks (called frames or THREE MOST COMMON PROTOCOLS packets) spaced by fixed time intervals. SPI - Serial Peripheral Interface I2C - Inter-Integrated Circuit UART - Universal Asynchronous Receiver Transmitter SPI, I2C, and UART are ideal for communication between microcontrollers and between microcontrollers and sensors where large amounts of high speed data don’t need to be transferred. Asynchronous - Asynchronous transmission Balanced Transmission - Requires two works in spurts and must insert a start bit before conductors to transmit each signal. each data character and a stop bit at its termination - The signal at the receiving end is the to inform the receiver where it begins and ends. voltage difference measured within two wires. - Also known as differential system Unbalanced Transmission - The signal common reference conductor is shared by many signals and Protocol - set of rules agreed by both the sender other electronic circuitry. and receiver on - One wire carries the signal which is How the data is packed referenced into one common wire How many bits constitute a character (commonly called ground). When the data begins and ends - The transmitted signal is the voltage between the signal conductor and the COMMON SERIAL COMMUNICATION reference conductor PROTOCOLS I2C - Inter-Integrated Circuit DATA COMMUNICATION TYPES SPI - Serial Peripheral Interface 1. Parallel - all the bits of data are transmitted USB - Universal Serial Bus simultaneously on separate communication UART - Universal Asynchronous Receiver lines. Transmitter Used for shorter distances. In order to transmit n bits, n wires or COMMON SERIAL COMMUNICATION lines are used. STANDARDS More costly. RS 232 Faster than serial transmission. RS 422 Data can be transmitted in less time. RS 485 2. Serial - data bits are transmitted serially one by one It requires only one communication line rather than n lines to transmit data from sender to receiver. Thus all the bits of data are transmitted on single lines in serial fashion. Less costly. Long distance transmission. UART Communication - In UART communication, two UARTs communicate directly with each other. Shar - 3304 - The transmitting UART converts parallel Well documented and widely used method 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 DISADVANTAGES receiving device. The size of the data frame is limited to a - Only two wires are needed to transmit data maximum of 9 bits between two UARTs. Doesn’t support multiple slave or multiple master systems The baud rates of each UART must be within 10% of each other SPI COMMUNICATION PROTOCOL (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. Devices communicating via SPI are in a master-slave relationship. Master - is the controlling device (usually a microcontroller) Slave (usually a sensor, display, or memory chip) takes instruction from the master. MOSI (Master Output/Slave Input) - Line for the master to send data to the slave. MISO (Master Input/Slave Output) – Line for the slave to send data to the master SCLK (Clock) – Line for the clock signal. SS/CS (Slave Select/Chip Select) – Line for the master to select which slave to send data to HOW SPI WORKS? ADVANTAGES AND DISADVANTAGES OF UART 1. The master outputs the clock signal: ADVANTAGES Only uses two wires No clock signal is necessary Has a parity bit to allow for error checking The structure of the data packet can be 2. The master switches the SS/CS pin to a low changed as long as both sides are set up voltage state, which activates the slave: for it Shar - 3304 3. 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: Start Condition: The SDA line switches from a high voltage level to a low voltage level before the SCL line switches from high to low. Stop Condition: The SDA line switches from a low voltage level to a high voltage 4. If a response is needed, the slave returns level after the SCL line switches from low to data one bit at a time to the master along high. the MISO line. The master reads the bits as Address Frame: A 7 or 10 bit sequence they are received: unique to each slave that identifies the slave when the master wants to talk to it. Read/Write Bit: A single bit specifying whether the master is sending data to the slave (low voltage level) or requesting data from it (high voltage level). ACK/NACK Bit: Each frame in a message is ADVANTAGES AND DISADVANTAGES OF SPI followed by an acknowledge/no acknowledge bit. If an address frame or ADVANTAGES data frame was successfully received, an No start and stop bits, so the data can be ACK bit is returned to the sender from the streamed continuously without interruption receiving device. No complicated slave addressing system like I2C Higher data transfer rate than I2C (almost twice as fast) Separate MISO and MOSI lines, so data can be sent and received at the same time. DISADVANTAGES Uses four wires (I2C and UARTs use two) No acknowledgement that the data has been successfully received (I2C has this) No form of error checking like the parity bit in UART Only allows for a single master STEPS OF I2C DATA TRANSMISSION I2C COMMUNICATION PROTOCOL I2C combines the best features of SPI and 1. The master sends the start condition to UARTs. every connected slave by switching the With I2C, you can connect multiple slaves to SDA line from a high voltage level to a low a single master (like SPI) and you can have voltage level before switching the SCL line multiple masters controlling single, or from high to low: multiple slaves. SDA (Serial Data) – The line for the master and slave to send and receive data. SCL (Serial Clock) – The line that carries the clock signal. HOW I2C WORKS - With I2C, data is transferred in messages. Messages are broken up into frames of data. Shar - 3304 2. The master sends each slave the 7 or 10 bit address of the slave it wants to 5. After each data frame has been transferred, communicate with, along with the read/write the receiving device returns another ACK bit bit: to the sender to acknowledge successful receipt of the frame: 3. Each slave compares the address sent from the master to its own address. If the address matches, the slave returns an ACK bit by pulling the SDA line low for one bit. If the address from the master does not match 6. To stop the data transmission, the master the slave’s own address, the slave leaves sends a stop condition to the slave by the SDA line high. switching SCL high before switching SDA high: 4. The master sends or receives the data frame: Shar - 3304 ADVANTAGES AND DISADVANTAGES OF I2C USB 1.0 and USB 2.0 ADVANTAGES Pin Number Cable Colour Function Only uses two wires 1 Red VBUS (5 volts) Supports multiple masters and multiple 2 White D- slaves 3 Green D+ ACK/NACK bit gives confirmation that each 4 Black Ground frame is transferred successfully Hardware is less complicated than with UARTs Well known and widely used protocol DISADVANTAGES Slower data transfer rate than SPI The size of the data frame is limited to 8 bits More complicated hardware needed to implement than SPI COMMON SERIAL COMMUNICATION PROTOCOLS USB Universal Serial Bus Most common type of port found on modern computers. Provides both data transmission and low LINE CODING - Code used for data transmission voltage (5V) power over a single cable. of a digital signal over a transmission line. This Plug-and-play and allow hot swapping process of coding is chosen so as to avoid overlap and distortion of signals such as inter-symbol interference. Properties of Line Coding As the coding is done to make more bits transmit on a single signal USB 1.0 (white USB-A and USB-B — very For a given bandwidth, the power is rare) → 1.5 Mbps efficiently used. USB 1.1 (white USB-A and USB-B, The probability of error is much reduced. Mini-USB) →12 Mbps Error detection is done and the bipolar too USB 2.0 (black USB-A and USB-B, has a correction capability. Mini-USB, Micro-USB) → 480 Mbps Power density is very favorable. USB 3.0 / SuperSpeed (blue USB-A and The timing content is adequate. USB-B, Micro-USB B) → 5 Gbps Long strings of 1s and 0s are avoided to USB 3.1 / SuperSpeed+ (green USB-A and maintain transparency. USB-B, USB Type C) → 10 Gbps USB 3.2 (USB Type C) → 20 Gbps Types of Line Coding USB 4 (USB Type C) → 40 Gbps Unipolar - A logic 1 represent with a pulse and logic 0 represent absence of pulse Polar - A logic 1 represent positive pulse and logic 0 represent a negative pulse Bi-polar - A tri state line coding technique which uses –V, 0V, and +V - For logic 1, the voltage level gets a transition from + to – or from – to +, having alternate 1’s to be equal polarity. - Logic 0 represent a no pulse Shar - 3304 Unipolar NRZ and RZ RS232 INTERFACE STANDARD Polar NRZ The RS-232 interface standard was developed for the single purpose of the interface between data terminal equipment (DTE) and data circuit terminating equipment (DCE) employing serial binary data interchange. In particular, RS-232 was developed for interfacing data terminals to modems. DTE: Data terminal equipment, for example, a computer or a printer. A DTE device communicates with a DCE device. A DTE device transmits data on pin 2 and receives data on pin 3. Bipolar NRZ and RZ DCE: Data communications equipment, for example a modem, now also called data circuit-terminating equipment in RS-232E. A DCE device receives data from the DTE and retransmits via another data communications link, such as the telephone system. A DCE device transmits data on pin 3 and receives data on pin 2. MAJOR ELEMENTS OF RS-232 In RS232, ‘RS’ stands for Recommended Standard. It defines the serial communication using DTE and DCE signals. Here, DTE refers to Data Terminal Equipment and DCE refers to the Data Manchester Coding Communication Equipment. Example of a DTE Manchester encoding is a synchronous device is a computer and a DCE is a modem. clock encoding technique used by the Formally, it is specified as the interface between physical layer of the Open System DTE equipment and DCE equipment using serial Interconnection [OSI] to encode the clock binary data exchange. and data of a synchronous bit stream. A logic 0 is represented by 0 to 1 transition, and logic 1 is represented by 1 to 0 transition (GE Thomas Shar - 3304 COMMUNICATION INTERFACE Straight-through cable. As the name implies, it is a one to one connector, i.e. a transmit pin of one RS232 determines the communication between the device is connected to the transmit pin of another DTE and DCE using DB9 and DB25 connectors. device and receiver pin of one device is connected The D-sub connectors (DB9, DB25) come with to the receiver pin of another device. Apart from male and female cables. The DB9 connector has 9 connections, the cable length depends upon the pins and DB25 connector has 25 pins with each pin wiring capacitance. As per specification, the cable having its own function. length is nearly 80 feet. FUNCTIONAL DESCRIPTION HOW RS232 COMMUNICATION WORKS? RS-232 is a point-to-point asynchronous communication protocol, it sends data in a single direction. Here, no clock is required for synchronizing the transmitter and receiver. The data format is initiated with a start bit followed by 7-bit binary data, parity bit and stop bit which are sent one after another. TYPES OF SERIAL CABLES To make serial communication possible between DTE and DCE, two types of RS232 cables exist. They are Null modem and Straight-cable. In null modem cable, the TX (Transmitter) pin of the male connector is linked up with the RX (Receiver) pin of the female and the RX pin of the male is connected to the TX pin of the female. Shar - 3304 ADVANTAGES AND DISADVANTAGES Xon and Xoff characters so that the receiver does not mistake the commands as device control The advantages of RS232 make it as a standard commands. This is usually done by some form of serial interface for system to system escape characters, but this means that more communication and also for the following benefits. bandwidth is taken up by these commands. Simple protocol design. Hardware overhead is lesser than parallel BINARY SYNCHRONOUS COMMUNICATIONS communication. PROTOCOL (BISYNC) - Recommended standard for short distance applications. Developed by IBM for computer-to-terminal Compatible with DTE and DCE and computer-to-computer communications communication. Byte oriented protocol Low cost protocol for development. Designed to handle large blocks of data The limitations of the RS232 protocol are, it doesn’t BISYNC OPERATION support full-duplex communication and it is a Beginning of a frame is denoted by sending single-ended protocol which shifts the ground a special SYNC character potential. Moreover, the longer cable length Data portion of the frame is contained introduces cross talk during serial communication. between special character STX and ETX Hence, this protocol is restricted for long distance SOH: Start of Header communication. DLE: Data Link Escape CRC: Cyclic Redundancy Check XON/OFF PROTOCOLS - It is a character-based flow-control protocol, which uses two special characters. Typically, these are the ASCII characters DC1 for XON and DC3 for XOFF. Xoff means to stop sending data. Xon mean ready to CHARACTER STUFFING receive data Byte stuffing is the process of adding one extra byte whenever there is a flag or escape character in the text Done by DLE in BISYNC protocol HDLC AND SDLC High-Level Data Link Control and Synchronous Data Link Control Widely used and initiated by IBM replacement for its BISYNC protocol Bit oriented protocol Protocol ensure that the data arrive successfully from one point to the next point XON/OFF PROTOCOLS Advantage The main advantage of Xon-Xoff flow control is that it only requires the minimum number of signal HDLC AND SDLC OPERATIONS wiring, three. This is because Xon-Xoff flow control Flag – Begins and ends the error checking with only requires two signals (send, receive), and of 0x7E To ensure that the receiver always knows that course a single common ground wire. the character it receives is unique a procedure called zero insertion is adopted. This requires the Disadvantage transmitter to insert a 0 after a sequence of five 1s Sending Xoff/Xon characters takes up bandwidth in the text, so that the flag character can never because they are in-band signals. Due to this, they appear in the message text. The receiver removes cannot be mistaken for data but must be the inserted zeros. recognised as flow control commands. This means that encoding is needed for the transmission of the Shar - 3304 Address – Receiver's address Lesson 4: Industrial Ethernet Control – identifies the frame’s function Information – data to send Fieldbus Control - it is a group of protocols that Frame Check Sequence – check is carried are used in the industrial arena standardized as out IEC 61158 It works on a network that permits on sending and receiving frames various topologies such as the ring, branch, star, and daisy chain. Frame Format Information frames: Used to convey the actual Fieldbus Configuration data from one node to another. Supervisory frames: Used for flow control and error control purposes. They indicate whether the secondary station is available to receive the information frames; they are also used to acknowledge the frames. There are two forms of error control used: a selective retransmission Trunk procedure because of an error, or a request to Power Conditioner transmit a number of previous frames. Terminators Device Couplers Unnumbered frames: Used for setting up the link or connection and to define whether Unbalanced Normal Response Mode (NRM) or Asynchronous Balanced Mode (ABM) is to be used. They are called unnumbered frames because no sequence numbers are included. Common modes of operation Unbalanced normal response mode (NRM) - This is used with only one primary station initiating all transactions. Asynchronous balanced mode (ABM) - In this mode each node has equal status and can act as either a primary or secondary node. HDLC AND SDLC 1. HDLC is actually adopted from SDLC 2. HDLC is a standard protocol while SDLC is Two terminators are required on each not segment 3. HDLC has the Asynchronous Balanced One at the control room end of cable Mode feature while SDLC does not Other is in the junction box in the field 4. HDLC supports frames that are not multiple An extra terminator cause 300 mV drop in of bit-octets while SDLC does not signal level 5. HDLC removed some procedures that were present in SDLC Shar - 3304 One or more fieldbus devices can connect to the segment at one location Short-circuit protection Physical Layer Deals with translating messages into physical signals on the wire --and vice versa. Provides the common electrical interface for all FOUNDATION fieldbus devices Can run on existing field wiring over long distances, supports two-wire devices, and offers intrinsic safety as an option. In short, it's an ideal match for a typical process-automation environment. FIELDBUS TOPOLOGIES Data Link and Application Layer Combines several technologies that together control transmission of data on the fieldbus Provide a standard way of "packaging" the data, as well as managing the schedule for communication and function-block execution. Enable process control while providing standardization and interoperability. BENEFITS OF THE MODERN FIELDBUS Greatly reduced wiring costs FIELDBUS SYSTEM ARCHITECTURE Reduced installation and startup time The physical layer and the data link and application Improved on-line monitoring and diagnostics layers make up the communications stack. The Easy change-out and expansion of devices user layer sits on top of the stack and enables you Improved local intelligence in the devices to interact with the other layers and with other Improved interoperability between manufacturers applications in your system. DEVICENET PROTOCOL What is DeviceNet? It is an application-level protocol used in an automation environment. A communication tool that allows you to logically talk between a PLC and many control devices. Originally developed by Allen-Bradley which is a Rockwell automation brand and decided to make it an open network Controller Area Networking (CAN) is a communications standard with a rather prolific set of offspring that includes DeviceNet, Can Open, Can Kingdom and several hundred other offspring all over the world. Shar - 3304 CAN is a serial communications standard for This connection must meet ANSI/B93.55M-1981. intelligent devices to communicate with each other. The female connector (attached to the bus cable) Unlike many other communication standards that must have rotational locking. This connector provide fast data rates with thousands or millions of requires a minimum voltage rating of 25 V, and for data bytes in a single frame, CAN has a bit rate that trunk use a current rating of 8 A is required. tops out at one mega baud. Most industrial Additional options can include oil and water applications don’t need that speed, but instead use resistance. the lowly 125K baud. Micro (sealed) connector This connector is effectively a 12 mm DEVICENET PROTOCOL diameter miniature version of the mini style Open Systems Interconnection (OSI) model that connector, except its suitability is for thin uses seven layers which are Physical, Datalink, wire drop connections requiring reduction in Network, Transport, Session, Presentation, and both physical and current carrying capacity. Application. ControlNet and Ethernet/IP use the same PHYSICAL LAYER (NETWORK POWER) application layer protocols. Because of this particular architecture, messages are routable One or more 24 V power supplies can be used to between DeviceNet, ControlNet and Ethernet/IP power the devices on the DeviceNet network, systems provided that the 8 A current limit on thick/flat wire and the 3 A limit on thin wire is not exceeded. The power supplies used should be dedicated to the PHYSICAL LAYER (TOPOLOGY) DeviceNet cable power only! Consists of a physical bus topology and must be terminated at either end by a 120 Ω 1/4 W resistor. DATA-LINK LAYER (FRAME FORMAT) DeviceNet frame Note that the data field is rather small (8 bytes) and that any messages larger than this need to be fragmented. DATA-LINK LAYER (MEDIUM ACCESS) The medium access control method is described as ‘carrier sense multiple access with non-destructive PHYSICAL LAYER (CONNECTORS) bit-wise arbitration’ (CSMA/NBA), where the arbitration takes place on a bit-by-bit basis on the Pluggable (unsealed) connector first field in the frame (the 11 bit identifier field). If a 5 pin, unsealed open connector utilizing node wishes to transmit, it has to defer to any direct soldering, crimping, screw terminals, existing transmission. Once that transmission has barrier strips or screw type terminations. ended, the node wishing to transmit has to wait for This type of connector entails removing 3 bit times before transmitting. This is called the system power for connection. interframe space. Hard-wired (unsealed) connection The ends of the cable are ‘live’ if the cable DATA-LINK LAYER (FRAGMENTATION) has been removed from the node in question and are still connected as part of Any device that needs more than 8 bytes of data the bus infrastructure. As such, care MUST sent in any direction will cause fragmentation to be taken to insulate the exposed ends of the occur. This happens since a frame can only contain cable 8 bytes of data. When fragmentation occurs, only 7 bytes of data can be sent at a time since the first Mini (sealed) connector byte is used to facilitate the reassembly of This 18 mm round connector is fragments. It is used as follows: recommended for harsh environments (field connections). Shar - 3304 First byte Significance 00 First fragment (number 0) 41–7F Intermediate fragment (lower 6 bits of the byte is the fragment number) 80–FF Last fragment (lower 6 bits of the byte is the fragment number) THE APPLICATION LAYER It provides the user with a standard set of messaging services for all three networks. It lets the user connect to any network and configure and collect data from any network. It saves time and effort during system configuration because no routing tables or added logic are necessary to move data between networks. It reduces the amount of training needed when moving personnel between different networks by providing similar configuration tools and features. Shar - 3304

Use Quizgecko on...
Browser
Browser