Serial Communications

Slides:



Advertisements
Similar presentations
Serial Interface Dr. Esam Al_Qaralleh CE Department
Advertisements

INPUT-OUTPUT ORGANIZATION
11-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL I/O System Design.
DATA COMMUNICATIONS Some organisations concerned with standards: EIA - Electroonic Industries Association (RS standards including RS-232) IEEE - Institute.
Interfacing The Serial/RS-232 Port Hardware Serial Port Registers Programming.
Serial I/O - Programmable Communication Interface
1 Fall 2005 Local Serial Asynchronous Communication Qutaibah Malluhi Computer Science and Engineering Qatar University.
Transmission of Digital Data: Interfaces and Modems NETE 0510 Dr.Apichan Kanjanavapastit.
1 Pertemuan 12 Layer Physical Matakuliah: H0174/Jaringan Komputer Tahun: 2006 Versi: 1/0.
Eng. Husam Alzaq The Islamic Uni. Of Gaza
COMP3221: Microprocessors and Embedded Systems
EET Advanced Digital Chapter 21 Serial Ports.
1 The 9-Pin Connector Pin abbreviations (numbers in parentheses are the 25D pin numbers): 1. CD (8) 2. RD (Rx) (3) 3. TD (Tx) (2) 4. DTR (20) 5. SG (Ground)
Chapter 6 Serial Communications Objectives Introduce the RS232 standard and position it within the crowded field of serial communications standards. Configure.
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
Local Asynchronous Communication
12 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Interfaces Transmission of data from the source to a device or from a device to the destination.
RS422, RS485, RS423, RS449 and V.35 Data Communications (E&T2760): RS422, RS485, RS423, RS449 and V.35.
INPUT-OUTPUT ORGANIZATION
University of Tehran 1 Interface Design Serial Communications Omid Fatemi.
Technology Training that Works Hands of Data Communications, Networking & TCP/IP Troubleshooting.
Transmission Modes Serial Transmission  One bit is transmitted on a circuit at a time  Usually there is one transmit circuit and one receive circuit.
Computers in Surveying SVY2301 / E4006 Automated Surveying.
The 8051 Microcontroller and Embedded Systems
Serial Port I/O Serial port sends and receives data one bit at a time. Serial communication devices are divided into: Data Communications Equipment (DCE),
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
1 Microprocessor-based Systems Course 9 Design of the input/output interfaces (continue)
Line Coding, Modem, RS232 interfacing sequences.
CSE466 Autumn ‘00- 1 Music Format if amp = 0, note is a command switch(note) 0: turn off specified channel 1: continue for specified tne w/ no change else.
“Describe the overview of hardware interfacing and the serial communication interface. Describe the PIC18 connections to RS232. Explain the serial port.
Universal Asynchronous Receiver/Transmitter (UART)
Microprocessors 2 lesson Subjects lesson 7 Planning Interrupts Serial communication /USART Questions.
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire conductors)
Advanced Embedded Systems Design Lecture 8 Serial I/O BAE Fall 2004 Instructor: Marvin Stone Biosystems and Agricultural Engineering Oklahoma.
Scott Baker Will Cross Belinda Frieri March 9 th, 2005 Serial Communication Overview ME4447/6405.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Universal Asynchronous Receiver/Transmitter (UART)
Interfaces and Synchronization Martin Weiss. EIA 232D Interface Standard u Synonymous with ITU V.24 u Asynchronous interface u Up to 19.2kbps u 50 foot.
1 Transmission of Digital Data : Interface and Modems.
1 Asynchronous voice band modem for IP data protocols overview features.
Digital Interfaces An interface links two devices Interface Standards define: – mechanical specifications - how many wires & connector type –electrical.
CSC 335 Data Communications and Networking Lecture 4b: Communication and Multiplexing Dr. Cheer-Sun Yang.
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
Example 1 Program the divisor Latch for 300 baud. Assume Xin=1.8432MHz The Base Address: 0x3F8 0RX_TX / Divisor.low 1IER: Interrupt Enable Reg. / Divisor.high.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
Ch. 6 Digital Data Communication Techniques. 6.1Asynchronous & Synchronous Transmission Asynchronous Transmission: transmission in which each information.
8251 USART.
BASICS OF SERIAL COMMUNICATIONS BIRLA VISHWKARMA MAHAVIDYALAYA ELECTRONICS & TELECOMMUNICATION DEPARTMENT PRESENTING BY: ABHISHEK SINGH AMANDEEP.
NARNARAYAN SHASTRI INSTITUTE OF TECHNOLOGY Prepared by: Wasu Ichcha kaur H Bhalani Nidhi M Dhakate Megha D MICROCONTROLLER.
Lecture # 14. RS – 232C Standard Standard for physical dimensions of the connectors. PC (DTE) Modem RS – 232C Cable Connected via serial port (DCE)
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
Chapter 6 Serial Communications
Serial mode of data transfer
UART Serial Port Programming
RS-232 Communications.
Homework Reading Continue mp1 Labs Tokheim, Section 13-6 Questions?
CS-401 Computer Architecture & Assembly Language Programming
SERIAL PORT PROGRAMMING
RS-232 Communications.
Serial Communication: RS-232 (IEEE Standard)
UART Serial Port Programming
Asynchronous Serial Communications
UART Serial Port Programming
Serial Communication Interface: Using 8251
Serial Communication Interface
UART PC16550 (Universal Asynchronous Receiver/Transmitter) By Derwyn Hollobaugh
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
Chapter 6 Transmission of Digital Data Interfaces and Modems
8051SERIAL PORT PROGRAMMING
Presentation transcript:

Serial Communications Introduction to UART and USART Intel 8250 and 8251

Outline Concept of serial communications Synchronous, Asynchronous RS-232 standard Hand shaking UART and USART chips 8250 and 8251 chips

What is Serial Communication

Serial Communication Types In Terms of Data on a Line Asynchronous Synchronous In Terms of Number of Senders Simplex Half duplex Full duplex

Transfer Types

Asynchronous Data Framing Sending Character ‘A’ = 0x41 on the Line Idle (high): Mark Low: Space Overhead? (parity, start, stop)

Vocabulary DTE DCE Data Transfer Rate data terminal equipment e.g. computer, terminal DCE data communication equipment connects DTE to communication lines e.g. modem Data Transfer Rate Baud Rate Baud (Symbol representing n bits) BPS Bit per second

RS-232 Standard EIA 232 = ITU-T V.24/V.28 Specifies the interface between DTE and DCE: V.28 : mechanical and electrical characteristics V.24 : functional and procedural characteristics Even used in applications where there is no DCE e.g. connecting computer to printer, magnetic card reader, robot, … etc. Introduced in 1962 but is still widely used Stand for Recommended Standard

DTE Connections

Mechanical Characteristics 25-pin connector 9-pin connector is more commonly found in IBM-PC but it covers signals for asynchronous serial communication only Use male connector on DTE and female connector on DCE Note: all signal names are viewed from DTE

25-Pin RS232 Connector

9-Pin RS232 Connector

Electrical Characteristics Single-ended one wire per signal, voltage levels are with respect to system common (i.e. signal ground) Mark: –3V to –15V represent Logic 1, Idle State (OFF) Space: +3 to +15V represent Logic 0, Active State (ON) Usually swing between –12V to +12V Recommended maximum cable length is 15m, at 20kbps

TTL to RS-232 Line drivers and line receivers

RS-232 Frame Format Example A 111101000001111 … Start bit ASCII Parity Stop bit 111101000001111 A Idle

RS232 Logic Waveform

Function of Signals TD: transmitted data RD: received data DSR: data set ready indicate whether DCE is powered on DTR: data terminal ready indicate whether DTR is powered on turning off DTR causes modem to hang up the line RI: ring indicator ON when modem detects phone call

Function of Signals DCD: data carrier detect RTS: request to send ON when two modems have negotiated successfully and the carrier signal is established on the phone line RTS: request to send ON when DTE wants to send data Used to turn on and off modem’s carrier signal in multi-point (i.e. multi-drop) lines Normally constantly ON in point-to-point lines CTS: clear to send ON when DCE is ready to receive data SG: signal ground

Flow Control Means to ask the transmitter to stop/resume sending in data Required when: DTE to DCE speed > DCE to DCE speed (e.g. terminal speed = 115.2kbps and line speed = 33.6kbps, in order to benefit from modem’s data compression protocol) without flow control, the buffer within modem will overflow – sooner or later the receiving end takes time to process the data and thus cannot be always ready to receive

Hardware Flow Control RTS/CTS the transmitting end activates RTS to inform the receiving end that it has data to send if the receiving end is ready to receive, it activates CTS normally used between computer and modem computer is always ready to receive data but modem is not, because terminal speed > link speed

Software Flow Control Xon/Xoff when the buffer within the receiving end is nearly full, Xoff is sent to the transmitting end to ask it to stop when data have been processed by the receiving end and the buffer has space again, Xon is sent to the transmitting end to notify it to resume advantage: only three wires are required (TD, RD and GND) disadvantage: confusion arises when the transmitted data (e.g. a graphics file) contains a byte equal to 13H (Xoff)

Are you ready to receive? RS-232 (con) Communication between two nodes Software Handshaking Hardware Handshaking data transmission Are you ready to receive? Software flow control uses special characters to control the flow of data when a device wishes to halt the flow it sends the XOFF character, when flow can resume it sends the XON character. The XOFF character is called DC3 or Device Code 3. It is decimal 19 or control S. The XON character is called DC1 or Device Code 1. It is decimal 17 or control Q. XOn / XOff is a software flow control mechanism. It can only be used in character oriented data transmissions (not binary transfer) as it relies on the use of a pre-determined XOn character and a pre-determined XOff character. The basic idea is simple, when the receiver buffer fills to the point it cannot receive anymore data it issues an XOff (Transmit Off) to the transmitter. When the transmitter sees the XOff character is stops transmitting. It will only resume once it sees a corresponding XOn. The disadvantage of such a system is that should an issued character become damaged in transit no action will be taken by the transmitter. RTS RTS CTS CTS No x-off receiver receiver transmitter transmitter x-on CTS CTS Yes TD RD data transmission Send character

Null Modem Cables Used to directly connect two DTEs together Many possibilities – depending on whether and how the two DTEs handshake (i.e. doing flow control)

Null Modem Cables Examples

Other Standards

UART in PC 115200*16=1843200

8250/16450/16550 UART

Registers Transmitter holding register Receiver buffer register Interrupt enable register

Registers Interrupt identification register

Line Control

Modem Registers Modem Control Register Modem Status Register

Line Status

Divisor Register

Example Program the divisor Latch for 300 baud. Assume Xin=1.8432MHz The Base Address: 0x3F8

Example 2 Program the divisor Latch for 2400 baud. Assume Xin=1.8432MHz The Base Address: 0x3F8

Example 3 Program 8250 for 2400 baud, 8 data bit, even parity and 1 stop bit. Assume Xin=1.8432MHz The Base Address: 0x3F8 MOV AL,80H ; Accessing DLAB MOV DX,3FBH ;Line Control Register Address OUT DX,AL MOV AX,48 ;baud=2400 115200:48=2400 MOV DX,3F8H ;Low byte of Divisor MOV AL,AH INC DX MOV AL,00011011 ; DLAB,Break,Even,1 stop, 8 data MOV DX,3FBH ;LCR

Synchronous Protocols BCC block check character STX start of text Control field contains info like the sequence of data

CRC In SDLC: G(X) = x**16 + x**12 + x**5 + 1

8251 Block Diagram

8251 Registers

Mode Register

Mode Instruction (Asynchronous)

Mode Instruction (Synchronous)

Command Register

Status Register

8251 Timing

8251 USART Interface A7 A6 A5 A4 A3 A2 A1 IO/M D[7:0] RD WR A0 C/D CLK TxC RxC TxD RxD 8251 RS232

Programming 8251 8251 mode register 7 6 5 4 3 2 1 Mode register Mode register Number of Stop bits 00: invalid 01: 1 bit 10: 1.5 bits 11: 2 bits Parity 0: odd 1: even Parity enable 0: disable 1: enable Character length 00: 5 bits 01: 6 bits 10: 7 bits 11: 8 bits Baud Rate 00: Syn. Mode 01: x1 clock 10: x16 clock 11: x64 clock

Programming 8251 8251 command register TxE: transmit enable EH IR RTS ER SBRK RxE DTR TxE command register TxE: transmit enable DTR: data terminal ready RxE: receiver enable SBPRK: send break character ER: error reset RTS: request to send IR: internal reset EH: enter hunt mode

Programming 8251 8251 status register TxRDY: transmit ready DSR SYNDET FE OE PE TxEMPTY RxRDY TxRDY status register TxRDY: transmit ready RxRDY: receiver ready TxEMPTY: transmitter empty PE: parity error OE: overrun error FE: framing error SYNDET: sync. character detected DSR: data set ready

Simple Serial I/O Procedures Read start Check RxRDY Is it logic 1? Read data register* end Yes No * This clears RxRDY Write Check TxRDY Write data register* * This clears TxRDY