lecture-week6

lecture-week6 - 1 CprE 288: Introduction to Embedded...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CprE 288: Introduction to Embedded Systems Zhao Zhang Spring 2009 Iowa State University What to Learn? We will learn USART bottom-up: How USART works USART programming interface How to write useful USART functions How to program SPI 3 Serial Communication Transfer data bit by bit Extensively used in embedded systems Simple programming interface Low cost, low power: compared with parallel communication Can also provide high performance Many protocols: RS-232, SPI, I 2 C; USB, SATA Easy data conversion between different physical medias 4 Lab Connection Learning Objective: Make VORTEX talks with PC! Use one USART unit of ATmega128 Use the RS-232 port of PC Can also help future debugging: send printf() output to PC 5 ATmega128 USART USART Universal Synchronous and Asynchronous Receiver Transmitter Each of the two ATmega128 USART units has A transmit (send) pin A receive pin An external clock pin 6 ATmega128 USART UART: Universal Asynchronous Receiver and Transmitter Asynchronous: without a clock vs. Synchronous: with a lock USART is UART plus synchronous communication 7 Frame Format How a n-bit datum is transferred n can be from 5 to 8 ST Start bit : Tells where a frame starts P Parity bit : For error detection SP Stop bit : Tells where a frame ends 8 Example: Sending Binary 01000001 9 Logic and Physical Signals What are logic one and zero? Can be 5V and 0V in TTL logic Can be +12V and -12V in RS-232 Can be active and inactive periods in IR (Infrared) We dont care at this moment Bit can be converted easily at physical level 10 Start and Stop Bits Idle period: logic high Start bit: logic low , 1 bit Stop bit: logic high , 1 bit or 2 bits 11 Parity Bit Three choices: even, odd, or none If one bit is flipped, how to detect it? 12 Baud Rate How to define communication speed? Baud rate : Number of symbols transferred per second Same as bit rate (bps) for USART Baud rate is not data rate With 56,000 bps, 8-bit frame, two stop bits and parity bit used, what is the maximum data rate? 13 Programming USART Both sides of communication should use the same frame format and baud rate Additional handshaking method may be used in a particular implementation, e.g....
View Full Document

Page1 / 8

lecture-week6 - 1 CprE 288: Introduction to Embedded...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online