advanced embedded systems design lecture 8 serial i/o bae 5030 - 003 fall 2004 instructor: marvin...
TRANSCRIPT
Advanced Embedded Systems Design
Lecture 8 Serial I/O BAE 5030 - 003
Fall 2004Instructor: Marvin Stone
Biosystems and Agricultural EngineeringOklahoma State University
Goals for Class Today
• Questions over reading (Chapter 18, PC-Link)
• Student presentation??• Serial I/O• Demo Keil Compiler
– Watch windows– Breakpoints– Code browser
• Review Target Hardware– Circuitry / cabling– Demo
• Set assignment
Serial I/O (RS 232) - Pont• History
– Serial communications needed as an efficient low speed data exchange between data terminal devices (teletype) and data communications equipment (modems)
– EIA (telephone industries) standardized the interface in the early 1960s (RS-232-C in 1969) and the CCITT (Comite Consultatif Internatinale de Telegraphie et Telephonie) later standardized V.24 (functional description) and V.28 (electrical specifications).
• Application– Effective for low data rate communications (<10 kbaud)
over short distances (<15 m)
– Higher data rates may be used over short distances
– Limited to Point-to-point applications
– Few number of conductors required (minimum=3 for no handshaking duplex)
– http://www.techtutorials.info/serial.html
Characteristics
• Point to point– Single receiver and single
transmitter
• Direction– Simplex – single direction– Duplex – two directions
• Half duplex – one direction at a time
• Full duplex – both directions simultaneously
• Synchronous vs asynchronous– Synchronous – bit stream is
transmitted with a clock synchronised at both ends of communication
– Asychronous – Frames (characters) are sent as necessary without synchronization, bits are sent with an understood clock rate
– DCE = Data Communications Equipment eg. Modem
– DTE = Data Terminal Equipment eg. Computer
DCE(Modem)
DTE(Teletype)
DCE(Computer)
DTE(GPS)
Packet structure amd baud rate
• Packet consists of:– Start bit (=1)
– Data, 7 or 8, LSB first
– May have a parity bit (Even, Odd, Mark or Space)
– Stop bits, 1 or 2 (=0)
• Baud rate– Baud – State changes per second
– Common baud rates:• 300, 1200, 2400, 9600, 19,200, 38400, and 57,600 baud
7 or 8 data bits
Sto
p bi
t1
or 2
Par
ity b
it
Sta
rt b
it
1-LS
B
8-M
SB
Data Word(8 bits shown)
Flow control
• Hardware– RTS/CTS
• Sender asserts Request to Send (RTS), Receiver asserts Clear to Send (CTS), Sender receives CTS and sends unless CTS is dropped.
• Software– Xon/Xoff
• Receiver signaled flow control through the data stream (needs full-duplex)
• The Xon character [0x11 (decimal 17)] is sent by the receiver to signal the sender to send
• The Xoff character [0x13 (decimal 19)] is send by the receiver to signal the sender to stop sending
RS 232 pin definitions
• DTE (computer) device has a male connector (socket with pins)
Pin Number Signal Description Direction
1 Carrier Detect (CD) In
2 Received Data (RD) In
3 Transmitted Data (TD) Out
4 Data Terminal Ready (DTR) handshaking signal Out
5 Signal Ground Common reference voltage
6 Data Set Ready (DSR) handshaking signal In
7 Request To Send (RTS) flow control signal Out
8 Clear To Send (CTS) flow control signal In
9 Ring Indicator (RI) In
9-Pin DB9-M male Connector on a DTE device(Looking into the connector)
1 2 3 4 5
6 7 8 9
RS 232 Voltage Levels
• Signal logic– > +3v = 0 = space
– < -3v = 1 = mark
Space Mark Space
Vol
tage3
25-3
Logic “1"
Logic “0"
InputLevels
15-5
Logic “1"
Logic “0"
-25
-15
5OutputLevels
USB – Universal serial bus
• Next generation of serial I/O for PC to device• Bus oriented (127 devices)• Connector provides power• Uses enumeration to ID devices• High data rates
– USB 1.1 - 12Mb/s or 1.5Mb/s
– USB 2.0 - 480Mb/s
• Isocronous communications capability – “music”• Excellent material on web
– http://www.usb.org/developers/whitepapers/usb_20t.pdf
• Development effort– Very significant effort to provide interface on embedded device.
– Serial to USB devices attractive – use built in driver on host
Assignment
• Assemble target hardware / cabling• Demo “Hello World”• Read Pont, Chapter 19,20,21,22• Tutorial – 30 min
– Review USB from a developers perspective