UART and UART Driver B. Ramamurthy.

Slides:



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

INPUT-OUTPUT ORGANIZATION
Review: Interrupts & Timers
ECT 357 Ch 18 UART. Today’s Quote: Be careful that your marriage doesn’t become a duel instead of a duet. Be careful that your marriage doesn’t become.
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Chapter 10 Input/Output Organization. Connections between a CPU and an I/O device Types of bus (Figure 10.1) –Address bus –Data bus –Control bus.
Serial I/O - Programmable Communication Interface
Spring EE 316 Computer Engineering Junior Lab Serial Ports.
Presented by: Reshef Schreiber Itay Leibovich Instructed by: Eran Segev.
Eng. Husam Alzaq The Islamic Uni. Of Gaza
Input-Output Problems L1 Prof. Sin-Min Lee Department of Mathematics and Computer Science.
COMP3221: Microprocessors and Embedded Systems
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Input/Output and Communication
Interface circuits I/O interface consists of the circuitry required to connect an I/O device to a computer bus. Side of the interface which connects to.
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.
Unit-5 CO-MPI autonomous
Microcontroller: Introduction
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
INPUT-OUTPUT ORGANIZATION
University of Tehran 1 Interface Design Serial Communications Omid Fatemi.
Transmission Modes Serial Transmission  One bit is transmitted on a circuit at a time  Usually there is one transmit circuit and one receive circuit.
EET 2261 Unit 11 Serial Communications Interface  Read Almy, Chapter 24.  Homework #11 and Lab #11 due next week.  Quiz next week.
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),
Input/Output mechanisms
Software; Nature, Capabilities and Limitations: describe the need for interfacing with peripherals storage devices, input and output devices and display.
MICROPROCESSOR INPUT/OUTPUT
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
“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.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
Images courtesy of Addison Wesley Longman, Inc. Copyright © 2001 Chapter 10 Input/Output Organization.
Example. SBUF Register SCON Register(1) SCON Register(2)
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Universal Asynchronous Receiver/Transmitter (UART)
8051 Micro controller. Architecture of 8051 Features of 8051.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
CIT 673 Created by Suriyong1 Micro controller hardware architechture.
B. RAMAMURTHY 6/13/ Device Drivers. Introduction 6/13/  A device driver is computer program that allows a system to interface with hardware.
B. Ramamurthy 2/28/ Copyright 2009 B. Ramamurthy.
Networked Embedded Systems Pengyu Zhang EE107 Spring 2016 Lecture 8 Serial Buses.
8251 USART.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
BASICS OF SERIAL COMMUNICATIONS BIRLA VISHWKARMA MAHAVIDYALAYA ELECTRONICS & TELECOMMUNICATION DEPARTMENT PRESENTING BY: ABHISHEK SINGH AMANDEEP.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Modem. Introduction: A modem [Modulator -Demodulator] is a device. Data communication means transmitting digital information form one computer to other.
Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:
Serial mode of data transfer
Linux Details: Device Drivers
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
Input/Output and Communication
Diagram of microprocessor interface with IO devices
SERIAL PORT PROGRAMMING
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
UART and UART Driver B. Ramamurthy.
Computer Organization and Design
UART and UART Driver B. Ramamurthy.
UART Serial Port Programming
Serial Communication Interface: Using 8251
Serial Communication Interface
Hardware Source: ttp:// under
Linux Details: Device Drivers
8051 Micro Controller.
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
PIC Serial Port Interfacing
PIC Serial Port Interfacing
Presentation transcript:

UART and UART Driver B. Ramamurthy

UART UART: Universal Asynchronous Receiver/Transmitter device Device connected to the system bus; it takes parallel data converts into RS232C serial format and transmits it; and receives data in serial format and converts it to parallel format for CPU bus -- parallel byte is converted into start bit, 8 bits, parity bit and stop bit serial form and vice versa Asynchronous transmission allows data to be transmitted without the sender having to send a clock signal to the receiver. Instead, the sender and receiver must agree on timing parameters in advance and special bits are added to each word which are used to synchronize the sending and receiving units. -- That’s why you set the baud rate in your xinu environment

16550 UART Chip Lets study the layout and operation of 16550 UART chip. Page 1: The features Page 2: Basic chip configuration Page 6 …: RD and WR cycle timing Page 11: Pin descriptions Page 14: Register summary Page 15…: Register explanation

RS 232C Standard Serial communication standard. See the DE-9 pin configuration: G (5), TxD (3), RxD(2), DTR(4), DSR(6), RTS(7), CTS(8), DCD(1), RI (9)

XINU UART Driver xinu_mips-1.0/include/uart.h xinu_mips-1.0/uart/* Map all that you learned in the last few slides to the code in uart.h and the driver implementation in uart directory

References http://www.freebsd.org/doc/en/articles/serial-uart/ http://cache.national.com/ds/NS/NS16C552.pdf http://xinu.mscs.mu.edu/National_Semiconductor_ 16550_UART#Physical_UART http://en.wikipedia.org/wiki/RS-232 Linux device-driver: http://www.networkcomputing.com/unixworld/tut orial/010/010.txt.html

Operating System: dev/xyz Device driver context User process Operating System: dev/xyz Device driver Physical Device hardware

UART Driver in EXINU General device driver related files: device.h, devtable.c Uart files: uart.h defining the physical features of the uart All the files in the uart directory that implement the operations related to the uart. uartControl.c uartInit.c uartIntr.c uartPutChar.c uartWrite.c uartGetChar.c uartRead.c

Device Drivers Chapter 7 of programming embedded systems (available on Safari) On board devices are called internal peripherals and one outside are called external peripherals UART Chip (internal) TTY (external) UART transceiverRS232D-9 connector  laptop serial socket WRT54GL board and modifications

Serial Port Block Diagram (general) Processor UART Peripheral RS-232 Transceiver COM1 DB-9 connector

Our Setup WRT54GL Processor: BCM5353 COM1 DB-9 connector UART Peripheral TI 16552 RS-232 Transceiver AMD202 COM1 DB-9 connector To do: Read the book Chapter 7

Device drivers Embedded processor interacts with a peripheral device through a set of control and status registers. Registers are part of the peripheral device. Registers within a serial controller are different from those in a timer. These devices are located in the memory space of the processor or I/O space of the processor- - two types: memory-mapped or I/O mapped respectively.

Device driver (contd.) The keyword volatile should be used when declaring pointers to device drivers. Our text goes on to discuss bit manipulation: please read it) Bit patterns for testing, setting, clearing, toggling, shifting bits, bitmasks, and bitfields. Struct overlays: In embedded systems featuring memory mapped IO devices, it is common to overlay a C struct on to each peripheral’s control and status registers. This will provide the offsets for the various registers from the base address of the device.

Device Driver Philosophy Hide the hardware completely: hardware abstraction If the device generates any interrupts include interrupt controllers. Device driver presents a generic interface for applications at higher level to access the devices: device.h Device drivers in embedded systems are different from general purpose operating systems: See diagram in slide #7 Applications in general purpose systems accesses OS (Operating Systems) which in turn accesses device drivers. Applications in embedded systems can directly access device drivers.

General Purpose OS vs. Embedded System Application process Operating System: dev/xyz Device driver Physical Device hardware Application process Device driver Physical Device hardware

Device Driver development steps An interface to the control and status registers. Variables to track the current state of the physical and logical devices -- Major and minor device number, device name A routine to initialize the hardware to known state An API for users of the device driver -- Read, write, seek Interrupts service routines

Example: A serial device driver Read the text for explanation and general example of a timer Now lets look at the UARTdriver of the embedded xinu and WRT54GL. Study the tty driver that is a logical device that is layered on top of the UART driver. In our Project 3 you will write a device driver for a logical device.

Summary We studied the design and development of device drivers. We analyzed the code for a sample UART driver. To do: read chapter 7 from embedded system book; read the UART device driver exinu and wrt54gl.