UART Deta ls. Background. Interface. Data Transm ss on Control

Similar documents
PC16552D Dual Universal Asynchronous Receiver Transmitter with FIFOs

Benchmark Evolut on - D End Panel

SC16C550B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V UART with 16-byte FIFOs

ASYNCHRONOUS COMMUNICATIONS ELEMENT

SC16C750B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V UART with 64-byte FIFOs

SC16C550 Rev June 2003 Product data General description Features

TL16C550A ASYNCHRONOUS COMMUNICATIONS ELEMENT

SC16IS General description. 2. Features

SC16C650B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V UART with 32-byte FIFOs and infrared (IrDA) encoder/decoder

ST16C450 UNIVERSAL ASYNCHRONOUS RECEIVER/TRANSMITTER (UART) GENERAL DESCRIPTION. PLCC Package FEATURES ORDERING INFORMATION.

TL16C552A, TL16C552AM DUAL ASYNCHRONOUS COMMUNICATIONS ELEMENT WITH FIFO

PC16550D Universal Asynchronous Receiver Transmitter with FIFOs. Features Y. Basic Configuration. June 1995

SC16C2552B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V dual UART, 5 Mbit/s (max.), with 16-byte FIFOs

TL16C550A ASYNCHRONOUS COMMUNICATIONS ELEMENT

RCLK N.C. CS0 CS1 -CS2 -BAUDOUT

TL16C554A, TL16C554AI ASYNCHRONOUS-COMMUNICATIONS ELEMENT

ST16C550. UART WITH 16-BYTE FIFO s GENERAL DESCRIPTION. PLCC Package FEATURES ORDERING INFORMATION

SLLS177H MARCH 1994 REVISED JANUARY 2006

XR16L570 GENERAL DESCRIPTION FEATURES APPLICATIONS FIGURE 1. BLOCK DIAGRAM. *5 V Tolerant Inputs (Except for CLK) PwrSave. Data Bus Interface

FEATURES PLCC Package RXB RXA -TXRDYB TXA TXB -OPB -CSA -CSB

D16550 IP Core. Configurable UART with FIFO v. 2.25

SC16C Description. 2. Features. Dual UART with 32 bytes of transmit and receive FIFOs

C16450 Universal Asynchronous Receiver/Transmitter. Function Description. Features. Symbol

SC16C652B. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V dual UART, 5 Mbit/s (max.) with 32-byte FIFOs and infrared (IrDA) encoder/decoder

ST16C554/554D 2.97V TO 5.5V QUAD UART WITH 16-BYTE FIFO

XR16V554/554D 2.25V TO 3.6V QUAD UART WITH 16-BYTE FIFO

SC16C General description. 2. Features and benefits

XR19L400 SINGLE CHANNEL INTEGRATED UART AND RS-485 TRANSCEIVER

PERIPHERAL INTERFACING Rev. 1.0

XR16M V TO 3.63V UART WITH 64-BYTE FIFO AND VLIO INTERFACE

XR16M V TO 3.63V HIGH PERFORMANCE UART WITH 64-BYTE FIFO

XR20M1280 I2C/SPI UART WITH 128-BYTE FIFO AND INTEGRATED LEVEL SHIFTERS

IMP16C554 IMP 16C554. Quad Universal Asynchronous Receiver/Transmitter (UART) with FIFO's. Data Communications. Description.

ST16C V TO 5.5V DUART WITH 16-BYTE FIFO

Fanuc Serial (RS232) Communications Information

D5 D6 D7 RCLK SIN SOUT CS0 CS1 CS2 BAUDOUT

SC16C554B/554DB. 1. General description. 2. Features. 5 V, 3.3 V and 2.5 V quad UART, 5 Mbit/s (max.) with 16-byte FIFOs

V62/03626 REVISIONS LTR DESCRIPTION DATE APPROVED REV PAGE REV PAGE REV REV STATUS OF PAGES PAGE

XR18W750 WIRELESS UART CONTROLLER

Serial Input/Output. Lecturer: Sri Parameswaran Notes by: Annie Guo

Description PKG. NO. TRC NC EPE GND CLS1 RRD CLS2 RBR8 SBS RBR7 PI RBR6 CRL RBR5 TBR8 RBR4 TBR7 RBR3 TBR6 RBR2 TBR5 RBR1 TBR4 PE TBR3 FE TBR2 OE

Firestone Building Products UC-6RS

D16950 IP Core. Configurable UART with FIFO v. 1.03

xr XR16L2750 GENERAL DESCRIPTION 2.25V TO 5.5V DUART WITH 64-BYTE FIFO

Electronics / Water analogy. Resistor. Inductance. Capacitor. Water Electronics Energy - Energy Pressure - Voltage Flow - Current Volume - Charge

XR16V2750 HIGH PERFORMANCE DUART WITH 64-BYTE FIFO

Features. TEMP RANGE ( C) PACKAGE PKG. DWG. # CP82C52 (No longer available or supported Recommended Replacement: CP82C52Z)

Semiconductor MSM82C51A-2RS/GS/JS UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER

Programmable communications interface (PCI)

EE 314 Spring 2003 Microprocessor Systems

Chapter 12: Digital Modulation and Modems

ECE 4510/5530 Microcontroller Applications Week 6 Lab 5

a6850 Features General Description Asynchronous Communications Interface Adapter

Industrial and HVAC Flow Measurement Product Catalog

Lecture #3 RS232 & 485 protocols

XR16M564/564D 1.62V TO 3.63V QUAD UART WITH 32-BYTE FIFO

PN PACKAGE (TOP VIEW) INTSEL GND TL16C754BPN DTRB CTSB DSRB NC A0 D3 RESET RXB CLKSEL XTAL1 XTAL2 RXRDY

Concept of Serial Communication

EEL 4744C: Microprocessor Applications. Lecture 9. Part 2. M68HC12 Serial I/O. Dr. Tao Li 1

1.8 V dual UART, 5 Mbit/s (max.) with 128-byte FIFOs, infrared (IrDA) and XScale VLIO bus interface

6551 ASYNCHRONOUS COMMUNICATION INTERFACE ADAPTER

XR19L202 TWO CHANNEL INTEGRATED UART AND RS-232 TRANSCEIVER

EIA-232 Information. DTE Signal Direction. DCE Signal Direction. Signal EIA

XR16M752/XR68M752 HIGH PERFORMANCE DUART WITH 64-BYTE FIFO

Chapter 9: Serial Communication Interface SCI. The HCS12 Microcontroller. Han-Way Huang. September 2009

Description TRC NC EPE GND CLS1 RRD CLS2 RBR8 SBS RBR7 PI RBR6 CRL RBR5 TBR8 RBR4 TBR7 RBR3 TBR6 RBR2 TBR5 RBR1 TBR4 PE TBR3 FE TBR2 OE TBR1 SFD

Unit D. Serial Interfaces. Serial vs. Parallel. Serial Interfaces. Serial Communications

Arduino Arduino RF Shield. Zulu 2km Radio Link.

73M2901CE AT Command User Guide

Microcontrollers. Serial Communication Interface. EECE 218 Microcontrollers 1

Lesson UART. Clock Systems and Timing UART (Universal Asynchronous Receiver-Transmitter) Queues Lab Assignment: UART

OP ERA TIONS MANUAL MCM/LPM- COM4A

Seaml ess Val ue and I nt egr at i on: Sony Medi a Backbone Conduct or and Di gi t al Backbone. Apr i l 2011, v2

DigiPoints Volume 1. Student Workbook. Module 2 Modem Overview

APPLICATION NOTE ANI6. Connecting the SP504 Multiprotocol Transceiver to the 85C30 Universal Enhanced Serial Communications Controller (ESCC)

HD Features. CMOS Universal Asynchronous Receiver Transmitter (UART) Ordering Information. Pinout

Asynchronous Serial Communications The MC9S12 Serial Communications Interface (SCI) Asynchronous Data Transfer

Stat-4 Stat-8 Stat-24

TCSS 372 Laboratory Project 2 RS 232 Serial I/O Interface

SC28L General description. 3.3 V, 5 V UART, Mbit/s, with 256-byte FIFO

JUMP MATH GR2 NUMBER SENCE. Circle the Numbers B-109. Blackline Master Number Sense Teacher s Guide for Workbook 2.1

USER'S MANUAL. Model : K

KAPPA M. Radio Modem Module. Features. Applications

Instruction Sheet UPS SERIES. Serial Control Protocol. I Rev E

RTM Baud Radio Data Modem

M7 Series Modems for SCADA Applications

SMARTALPHA RF TRANSCEIVER

DIRIS Ap RS485 JBUS/MODBUS COM. Systèmes de Coupure et de Protection Industrial Switching and Protection Systems ON 1

Know your energy. Modbus Register Map EB etactica Power Bar

Online Signature Verification by Using FPGA

DV-72 / DV6-72 DA-72 / DA-96

Universal Converter Covers All the Bases- RS-232 to 4-wire RS-422, 2-wire or 4-wire RS-485

Project Final Report: Directional Remote Control

PART 4 DIGITAL METHODS. Chapter 13 Digital Fundamentals. Parallel Data Transfer. Fig Parallel data handshaking

APPLICATION BULLETIN. SERIAL BACKGROUNDER (Serial 101) AB23-1. ICS ICS ELECTRONICS division of Systems West Inc. INTRODUCTION CHAPTER 2 - DATA FORMAT

HR1200. Version 1.00 ATIM RADIOCOMMUNICATION 1/11

Installation and Operation Manual HS-R. 4-Channel Low Speed Data Module with V.110 Rate Adaptation MEGAPLEX-2100 MODULE

Technical Note #15. Radio Frequency Modems. GE ED&C Home Search ED&C GE ED&C Power Management Home GE ED&C PMCS Home

MULTI-DROPS DIGITAL MODEM FOR PRIVATE LINE

MODEL: DLS. Telemetering System

Transcription:

Background UART Deta ls A Un versal Asynchronous Rece ver/transm tter (UART) s used to mplement ser al commun cat on. It s a standard p ece of hardware, although manufacturers make sl ghtly d fferent vers ons that may have some funct onal ty beyond the standard UART funct onal ty descr bed below. A data sheet for the UART ch p we are us ng can be found on the support ng mater als page. The data sheet prov des a more deta led and lengthy descr pt on than that prov ded below. F nally, a word about term nology. When talk ng about ser al transm ss on, a log cal "1" on the l ne s called a mark state (or cond t on) wh le a log cal "0" on the l ne s called a space state (or cond t on). Interface The CPU commun cates w th the UART by read ng or wr t ng one of e ght bytes called ports. A computer system normally has more than one UART, so the port addresses depend on the part cular UART be ng accessed. Each UART s assoc ated w th a d fferent base address, and a part cular port s spec f ed by add ng a spec f c ndex to that base address. The ndex for a part cular port s ndependent of the UART, so we can character ze the ports by nd ces 0 through 7. A program s more understandable f t uses symbols rather than ``mag c numbers'' for th ngs l ke port addresses and b ts w th n a reg ster. F le uart.ah def nes such symbols, and we w ll use them throughout th s document. You should nclude f le uart.ah n any assembly language program access ng the UART, and use the names t def nes to refer to the ports and b ts w th n the ports. Some of the UART ports can only be read, others can only be wr tten, and both accesses are poss ble on some. Even when both accesses are allowed, however, they may be unrelated. For example, the UART has a data- n buffer reg ster and a data-out buffer reg ster. Both of these reg sters, each of wh ch holds one byte, are accessed v a port 0. If the UART has assembled a byte from the b ts t has rece ved, then the CPU can get that byte by read ng port 0. S m larly, f the UART has completely d sposed of a byte then the CPU can output another byte by wr t ng t to port 0. Not ce that read ng and wr t ng are totally unrelated -- f the CPU wr tes a byte to port 0 and then mmed ately reads from that port, t w ll not get the byte t wrote. F le uart.ah g ves d fferent names to the same port when that port can be used for d fferent purposes. Thus both RBR (Read Buffer Reg ster) and THR (Transm t Hold ng Reg ster) are names for port 0. You should essent ally gnore the port numbers, and th nk of the UART only n terms of the symbols descr b ng ts funct onal ty. In add t on to the data buffers, the UART's ports allow you to access three control reg sters and three status reg sters. Each control reg ster s pa red w th one status reg ster to deal w th a d fferent aspect of the UART: ts data transm ss on (both d rect ons), ts handshak ng w th a modem, and ts nterrupt behav or. Port 7, named SCR n f le uart.ah, accesses a ``scratch reg ster'' that acts exactly l ke a memory locat on. It has no control, status, or data funct on related to the UART. Data Transm ss on Control The controllable character st cs of the data transm ss on are: http://ecee.colorado.edu/~ecen2120/manual/uart/uart.html 1/6

Baud rate Number of nformat on b ts per character Type of par ty check ng Number of stop b ts Break ng the transm ss on These character st cs are controlled by the l ne control reg ster (LCR, accessed v a port 3). Baud rate The baud rate s establ shed by stor ng the value 115200/(baud rate) nto a 16-b t reg ster ns de the UART. When the DLAB b t of LCR s 1, the least-s gn f cant byte of th s reg ster can be accessed v a port 0 (us ng symbol DLL), and the most-s gn f cant byte can be accessed v a port 1 (us ng symbol DLM). When DLAB b t of LCR s 0, the data- n and data-out buffer reg sters are accessed v a port 0 (us ng symbols RBR and THR as d scussed above) and the nterrupt enable reg ster IER s accessed v a port 1. Number of nformat on b ts per character CLEN encodes the number of nformat on b ts n each character: CLEN=0 for 5 nformat on b ts CLEN=1 for 6 nformat on b ts CLEN=2 for 7 nformat on b ts CLEN=3 for 8 nformat on b ts Type of par ty check ng If PEN=0 then the UART ne ther generates a par ty b t for outgo ng characters nor checks par ty on ncom ng characters. If PEN=1 and FP=0 then even par ty s generated and checked f EP=1, and odd par ty s generated f EP=0. F nally, f PEN=1 and FP=1 then the generated par ty b t s equal to EP, and the par ty b t of an ncom ng character must be equal to EP. Number of stop b ts XSB spec f es the number of stop b ts transm tted w th each ser al character. If XSB=0 then one stop b t s generated n the transm tted data. Otherw se 1.5 stop b ts are generated for characters w th 5 nformat on b ts and 2 stop b ts are generated for all other characters. The rece ver checks the f rst stop b t only, regardless of the number of stop b ts selected. Break ng the transm ss on When SBRK=1, the ser al output l ne s held n the spac ng state; no characters are transm tted. Th s cond t on s detected by the UART at the other end of the l ne, and causes BKD=1 n the l ne status reg ster port 5 of that UART. Data Transm ss on Status http://ecee.colorado.edu/~ecen2120/manual/uart/uart.html 2/6

The status of the data transm ss on nvolves Ava lab l ty of an nput character Complet on of character output Errors Break detect on Th s status s reported n the l ne status reg ster (LSR, accessed v a port 5). All b ts n th s reg ster are reset to 0 when the reg ster s read, except as noted below. Ava lab l ty of an nput character RxDA=1 when a character s ava lable n the data- n buffer reg ster. Complet on of character output TxRA=1 when the data-out buffer reg ster does not conta n a character, and TxST=1 when transm ss on of all characters s complete. These b ts rema n 1 f no transm ss on s n progress when the l ne status reg ster s read. Errors PE=1 nd cates a par ty error, OE=1 an overrun error, and FE=1 a fram ng error. Break detect on BKD=1 f the nput l ne has been held n a spac ng cond t on for two or more character t mes. Modem Handshak ng Control An protocol called RS-232C descr bes how a computer and a modem should nteract to ensure that they agree on who s ready to do what. The modem control reg ster (MCR, accessed v a port 4), s used to control the outgo ng s gnals used for th s protocol. It also allows the mach ne to perform self-tests w thout us ng the modem at all. Handshak ng protocol http://ecee.colorado.edu/~ecen2120/manual/uart/uart.html 3/6

The computer should set DTR=1 when t s ready for commun cat on. (Sett ng DTR=0, for example, w ll cause a modem to hang up the telephone l ne at the end of a transm ss on.) RTS=1 nd cates that the computer des res to transm t nformat on. Sett ng RTS=0 would nd cate that the modem should turn the l ne around when us ng half-duplex mode. For full-duplex mode, RTS should be permanently 1. Loopback control It s useful to be able to test commun cat on software w thout hav ng to have another dev ce to commun cate w th. If LC=1 then transm tted characters are sent d rectly to the rece ver -- they ``loop back'' w th n the UART tself. When LC=0, characters are transm tted normally over the ser al l ne. M scellaneous control b ts OUT1 s used only by spec al zed hardware (l ke the Hayes SmartModem nternal board). The mean ng of th s b t s determ ned by the hardware us ng t. For example, f the computer has a Hayes SmartModem board then OUT1=1 resets the modem. OUT2 controls nterrupt serv c ng for the UART: OUT2=0 blocks the nterrupt generated by the UART. Th s allows the user to prevent UART nterrupts from reach ng the computer's pr or ty nterrupt controller, wh le st ll generat ng them w th n the UART. Modem Handshak ng Status The modem status reg ster (MSR, accessed v a port 6), s used to sense ncom ng s gnals used for the handshak ng RS-232C protocol. All b ts n th s reg ster are reset to 0 when the reg ster s read, except as noted below. Current State DSR=1 nd cates that the modem s ready for commun cat on. Th s b t rema ns 1 after the reg ster s read f the modem rema ns ready. CTS=1 nd cates that the computer s allowed to transm t nformat on. In half-duplex mode (Sect on 9-1), the modem responds to a s gnal RTS=1 from the computer by turn ng the l ne around and then sett ng CTS=1. Th s b t rema ns 1 after the reg ster s read f the computer s st ll allowed to transm t nformat on. CD=1 f the modem bel eves that there actually s an ncom ng s gnal. For example, f a computer s commun cat ng w th a remote term nal over a telephone l ne, and the modem detects that the other party has hung up, t w ll set CD=0. Th s b t rema ns 1 after the reg ster s read f the modem st ll bel eves that there actually s an ncom ng s gnal. The modem sets RI=1 when t detects a r ng ng s gnal on the telephone l ne. Thus RI=1 s a request for serv ce from a remote s te. State Changes http://ecee.colorado.edu/~ecen2120/manual/uart/uart.html 4/6

The rema n ng b ts n the reg ster are set to 1 when a state change s detected. Each of these b ts s assoc ated w th one of the state b ts ment oned above, and becomes 1 when that state b t changes. Thus these b ts allow the computer to determ ne wh ch state b ts have changed s nce the last t me the reg ster was read, w thout hav ng to keep the old values and compare them. Interrupt Behav or The UART s capable of generat ng an nterrupt when any one of a number of s tuat ons ar ses. These s tuat ons are grouped nto four classes: 1. Rece ve mach ne error or break cond t on 2. Rece ve data reg ster full 3. Transm t data reg ster empty 4. Change n the state of the modem nput p ns Interrupts n each of these classes must be expl c tly enabled by wr t ng a 1 to the appropr ate b t n the nterrupt enable reg ster (IER, accessed v a port 1). In add t on to enabl ng the part cular k nd of nterrupt, nterrupt serv c ng for the UART must be requested by sett ng b t OUT2 n the modem control reg ster (MCR, accessed v a port 4). If an nterrupt occurs, the class of nterrupt can be determ ned by read ng the nterrupt dent f cat on reg ster (IIR, accessed v a port 2). IPN=0 f an nterrupt s pend ng. Thus the AI f eld of the nterrupt dent f cat on reg ster s relevant only f IPN=0. The nterrupt classes are pr or t zed, w th AI=0 be ng the lowest and AI=3 the h ghest pr or ty: AI=3 for a rece ve mach ne error or break cond t on AI=2 when rece ved data s ava lable AI=1 when the transm t reg ster s empty AI=0 when there s a change n the state of the modem nput p ns If the nterrupt dent f cat on reg ster nd cates that there was a rece ve mach ne error or break cond t on then the program must exam ne the l ne status reg ster to determ ne the prec se cond t on. S m larly, f the nterrupt dent f cat on reg ster nd cates that there was a change n the state of the modem nput p ns the program must determ ne the change by read ng the modem status reg ster. Only the h ghest pr or ty nterrupt appears n the nterrupt dent f cat on reg ster at any t me. After deal ng w th a UART nterrupt, therefore, the program must read the nterrupt dent f cat on reg ster aga n n order to http://ecee.colorado.edu/~ecen2120/manual/uart/uart.html 5/6

determ ne whether a lower-pr or ty nterrupt also occurred. Th s cycle stops when IPN=1. Instructor Rev s on 1.13 (2004/02/11 20:18:36) http://ecee.colorado.edu/~ecen2120/manual/uart/uart.html 6/6