Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2:

Slides:



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

EUSART Serial Communication.
INPUT-OUTPUT ORGANIZATION
Serial Communications Interface (SCI) Michael LennardZachary PetersBao Nguyen.
11-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL I/O System Design.
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.
SCI: Serial Communications Interface Presented by: Sean Kline Chad Smith Jamie Cruce.
COMP3221: Microprocessors and Embedded Systems Lecture 22: Serial Input/Output (II) Lecturer: Hui Wu Session 1, 2005.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Unit-5 CO-MPI autonomous
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 13.
1 SCI Serial Communication Interface Gerrit Becker James McClearen Charlie Hagadorn October 21, 2004.
INPUT-OUTPUT ORGANIZATION
Serial Communication Interface (SCI) Kevin Stuart Matt Betts March 27, 2007 ME 6405, Sp 07.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
Digilent System Board Capabilities Serial Port (RS-232) Parallel Port 1 Pushbutton Hint: Good for a reset button Connected to a clock input. See Digilent.
SC200x Peripherals Broadband Entertainment Division DTV Source Applications July 2001.
Lecture 26: LM3S9B96 Microcontroller – Universal Asynchronous Receivers/Transmitters.
UART and UART Driver B. Ramamurthy.
Lecture 7 Universal Asynchronous Receiver/Transmitter (UART) NCHUEE 720A Lab Prof. Jichiang Tsai.
Modems Chapter 17. Basic Knowledge  Modems are little devices to use the telephone to talk to other computers.  Modem is an abbreviation for Modulator/
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Universal Asynchronous Receiver/Transmitter (UART)
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 13.
Serial Communications
Embedded System Design Laboratory October 4, 2002Stanford University - EE281 Lecture #3#1 Lecture #3 Outline Announcements AVR Processor Resources –UART.
Scott Baker Will Cross Belinda Frieri March 9 th, 2005 Serial Communication Overview ME4447/6405.
The Cortex-M3 Embedded Systems: LM3S9B96 Microcontroller – Universal Asynchronous Receivers/Transmitters Refer to Chapter 13 in the reference book “Stellaris®
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.
NS Training Hardware. Serial Controller - UART.
MCS51 - lecture 4. Lecture 3 1/27 Serial ports MCS51 Standard SIO Some extensions and modifications.
Universal Asynchronous Receiver/Transmitter (UART)
CE-2810 Dr. Mark L. Hornick 1 Using the USART Configuration and Programming.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
1 October 26, 2006ME 6405 MechatronicsSerial Communication Interface Brian Guerriero Jon Rogers Robert Thiets.
RX Serial Peripheral Interface (RSPI)
Serial Communications Interface Module Slide #1 of 19 MC68HC908GP20 Training PURPOSE -To explain how to configure and use the Serial Communications Interface.
Extended Uart The High Speed Digital Systems Laboratory, Electrical Engineering Faculty, Technion By: Marganit Fina Supervisor: Rivkin Ina Winter 2007/8.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
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.
8255:Programmable Peripheral Interface
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
8251 USART.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
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.
Serial mode of data transfer
CS-401 Computer Architecture & Assembly Language Programming
Refer to Chapter 16 in the reference book
Source: Serial Port Source:
Serial I/O and Data Communication.
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
Source: Serial Port Source:
UART Serial Port Programming
UART and UART Driver B. Ramamurthy.
Serial Communication Interface: Using 8251
UART Protocol Chapter 11 Sepehr Naimi
Configuration and Programming
NS Training Hardware.
Programmable Data Communication Blocks
Source: Serial Port Source:
EUSART Serial Communication.
Serial Communication 19th Han Seung Uk.
Source: Serial Port Source:
Presentation transcript:

Tiva C TM4C123GH6PM UART Embedded Systems ECE 4437 Fall 2015 Team 2: Don Nguyen Phat Nguyen Trung Ngo

What is a UART? UART stand for Universal Asynchronous Receiver/Transmitter. It is a device that is used for serial communication. The synchronized is by software, but it's called Asynchronous since it exists synchronized by hardware. You can see in the figure that the UART has 2 signals (TX and RX). TX is the transmit signal and RX is the receive signal from which the UART sends and receives data. This is a basic UART configuration. You will see that the TivaC has more I/Os in its UART.

Still confused? Take this workshop (ONLY 10 Mins) https://training.ti.com/tm4c123g-launchpad-workshop-series-12-15- uart

UART Features Separate 16x8 bit transmit and receive FIFOs Programmable baud rate generator Auto generation and stripping of start, stop, and parity bits Line break generation and detection Programmable serial interface 5, 6, 7, or 8 data bits even, odd, stick, or no parity bits 1 or 2 stop bits baud rate generation, from DC to processor clock/16 Modem flow control on UART1 (RTS/CTS) The TM4C123GH6PM includes 8 UART ports. Each of these ports features: Separate 16 x 8-bit transmit and receive FIFOs A programmable baud rate generator Automatic generation and removal of the start, stop and parity bits Line break generation and detection A choice of 5 to 8 data bits, multiple parity types and 1 or 2 stop bits Modem and flow control IrDA and EIA-495 9-bit protocols DMA support with separate transmit and receive channels

Block Diagram Note the two external pins on the right. Tiva C Series pins are highly multiplexed with other functions. Also note the transmit and receive FIFOs are integral to the module itself.

UART Signals

UART API & Operation The UART API is broken into three groups of functions: those that deal with configuration and control of the UART modules those used to send and receive data those that deal with interrupt handling.

Basic Operation Initialize the UART Enable the UART peripheral, e.g. SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // Enable UART0 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Enable GPIOA Set the Rx/Tx pins as UART pins GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); Configure the UART baud rate, data configuration ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); Configure other UART features (e.g. interrupts, FIFO) Send/receive a character Single register used for transmit/receive Blocking/non-blocking functions in driverlib: UARTCharPut(UART0_BASE, ‘a’); newchar = UARTCharGet(UART0_BASE); UARTCharPutNonBlocking(UART0_BASE, ‘a’); newchar = UARTCharGetNonBlocking(UART0_BASE); The basic steps for initializing the UART are as follows: Enable the UART peripheral Configure the transmit and receive pins for the UART function Configure the baud rate and data set up of the UART Configure any other UART features like interrupt generation and FIFO usage Now the port is ready to send and receive characters. In this UART design, a single data register is used for both the transmit and receive function. The peripheral driver library supports both blocking and non blocking APIs for writing and reading the data register.

UART Interrupts Single interrupt per module, cleared automatically Instead of constantly polling for characters from the UART, we can use interrupts to receive and transmit data Single interrupt per module, cleared automatically Interrupt conditions: Overrun error Break error Parity error Framing error Receive timeout – when FIFO is not empty and no further data is received over a 32-bit period Transmit – generated when no data present (if FIFO enabled, see next slide) Receive – generated when character is received (if FIFO enabled, see next slide) Interrupts on these conditions can be enabled individually Your handler code must check to determine the source of the UART interrupt and clear the flag(s) Each UART module can provide an interrupt to the CPU. Since this is a single source interrupt, it will be cleared automatically . Conditions under which an interrupt can be generated are: An overrun error A break error An incorrect parity A framing error A receive timeout when the fifo is not empty and no data is received during 32 bit times When a transmit is attempted and no data is present to be transmitted When a character is received Interrupts on all these conditions can be enabled individually. Since these conditions are OR’d into a single interrupt to the CPU , the handler code must check to determine which of these conditions triggered the interrupt and clear the appropriate flags .

Using UART Interrupts on Launchpad Header files #include "inc/hw_ints.h" #include "driverlib/interrupt.h" Enable Interrupts First we enable all interrupts, then the interrupts on a particular UART, then the individual interrupts to use on that UART IntMasterEnable(); IntEnable(INT_UART0); UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); Each UART module can provide an interrupt to the CPU. Since this is a single source interrupt, it will be cleared automatically . Conditions under which an interrupt can be generated are: An overrun error A break error An incorrect parity A framing error A receive timeout when the fifo is not empty and no data is received during 32 bit times When a transmit is attempted and no data is present to be transmitted When a character is received Interrupts on all these conditions can be enabled individually. Since these conditions are OR’d into a single interrupt to the CPU , the handler code must check to determine which of these conditions triggered the interrupt and clear the appropriate flags .

Using the UART FIFOs Transmit FIFO FIFO Level Select Both FIFOs are accessed via the UART Data register (UARTDR) After reset, the FIFOs are enabled*, you can disable by resetting the FEN bit in UARTLCRH, e.g. UARTFIFODisable(UART0_BASE); Trigger points for FIFO interrupts can be set at 1/8, 1/4, 1/2,3/4, 7/8 full, e.g. UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8); UART_FIFO_TX1_8 UART_FIFO_TX2_8 UART_FIFO_TX4_8 UART_FIFO_TX6_8 Both the transmit and receive fifo’s are accessed through the UART Data register . While the datasheet indicates that the UART fifo’s are disabled at reset, basic configuration of the UART module re-enables this feature by default. They can easily be disabled if necessary. Trigger points for the generation of UART interrupt can be set at the 1/8th, 1/4th, ½, ¾, 7/8 and full points. UART_FIFO_TX7_8 * Note: the datasheet says FIFOs are disabled at reset

UART “stdio” Functions TivaWare “utils” folder contains functions for C stdio console functions: c:\TivaWare\utils\uartstdio.h c:\TivaWare\utils\uartstdio.c Usage example: UARTStdioInit(0); //use UART0, 115200 UARTprintf(“Enter text: “); See uartstdio.h for other functions Notes: Use the provided interrupt handler UARTStdioIntHandler() code in uartstdio.c Buffering is provided if you define UART_BUFFERED symbol Receive buffer is 128 bytes Transmit buffer is 1024 bytes   TivaWare’s UART library includes standard I/O console functions for initialization, printf, get, flushing the FIFOs and others. To use the functions you should use the interrupt handler provided in uartstdio.c

Demo Objective In this lab you will send data through the UART. The UART is connected to the emulator’s virtual serial port that runs over the debug USB cable.

Terminal Program You can download PuTTY from the address below. http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

References http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf http://www.ti.com/lit/ug/spmu298a/spmu298a.pdf http://users.ece.utexas.edu/~valvano/Volume1/E- Book/C11_SerialInterface.htm https://training.ti.com/tm4c123g-launchpad-workshop-series- 12-15-uart

Thanks for Listening