DOC PREVIEW
UNCC ECGR 4101 - Serial Communications

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Serial Communications10-1Embedded SystemsLecture 11In these notes . . . General CommunicationsSerial Communications– RS232 standard– UART operation– Polled Code– Interrupt Driven CodeRead M16C/62 Hardware Manual pp. 137-182UART 0:RS-232Cto 50-pinconnectorto 50-pinconnectorUP = IODOWN = RS232P6_3P6_2P6_3MP6_2MVCCC140.1uF1 2C170.1uF12C130.1uF1 2C160.1uF12Vcc V+C1+ C2+C2-C1-GND V-TRTRU4MAX202/3232123456789101112 13141516P1747250-4594837261C150.1uF12TB3HOLE1TB4HOLE1TB5HOLE1TB6HOLE1S6ACT204222ST1 16153 141324Embedded Systems 11-2SP SPPAR2SP1SPUARTUART (7 bits)UART (8 bits)UART (7 bits)UART (9 bits)Clock synchronous type Clock synchronous type TxDiUARTi transmit registerPAR enabledPAR disabledD8D7D6D5D4D3D2D1D0SP: Stop bitPAR: Parity bitUARTi†transmit buffer registerMSB/LSB conversion circuitUART (8 bits)UART (9 bits)Clock synchronous type UARTi receive buffer registerUARTi receive register2SP1SPPAR enabledPAR disabledUARTUART (7 bits)UART (9 bits)Clock synchronous type Clock synchronous typeUART (7 bits)UART (8 bits)RxDiClock synchronous type UART (8 bits)UART (9 bits)Address 03A616Address 03A716Address 03AE16Address 03AF16Address 03A216Address 03A316Address 03AA16Address 03AB16Data bus low-order bitsMSB/LSB conversion circuitD7D6D5D4D3D2D1D0D80000000SP SPPAR0Data bus high-order bitsThere was no standard for networks in the early days and as a result it was difficult for networks to communicate with each other.The International Organization for Standardization (ISO) recognized this and in 1984 introduced the Open Systems Interconnection (OSI) reference model. The OSI reference model organizes network functions into seven numbered layers.Each layer provides a service to the layer above it in the protocol specification and communicates with the same layer’s software or hardware on other computers. Layers 5-7 are concerned Data CommunicationsEmbedded Systems 11-3Layers 5-7 are concerned with services for the applications. Layers 1-4 are concerned with the flow of data from end to end through the networkPhysical Layer (1) – Serial CommunicationsThe basic premise of serial communications is that one or two wires are used to transmit digital data.– Of course, ground reference is also needed (extra wire)Can be one way or two way, usually two way, hence two communications wires.Often other wires are used for other aspects of the communications (ground, “clear-to-send”, “data terminal Embedded Systems 11-4communications (ground, “clear-to-send”, “data terminal ready”, etc).TxTxRxRxMachine 1Machine 2101101100111001101101111Serial Communication BasicsSend one bit of the message at a timeMessage fields– Start bit (one bit)– Data (LSB first or MSB, and size – 7, 8, 9 bits)– Optional parity bit is used to make total number of ones in data even or odd–Stop bit (one or two bits) MessageDatabitsEmbedded Systems 11-5–Stop bit (one or two bits) All devices on network or link must use same communications parameters – The speed of communication must be the same as well (300, 600, 1200, 2400, 9600, 14400, 19200, etc.)More sophisticated network protocols have more information in each message– Medium access control – when multiple nodes are on bus, they must arbitrate for permission to transmit– Addressing information – for which node is this message intended?– Larger data payload– Stronger error detection or error correction information– Request for immediate response (“in-frame”)Bit Rate vs. Baud RateBit Rate: how many data bits are transmitted per second?Baud Rate: how many symbols are transmitted per second? – == How many times does the communication channel change state per second?– A symbol may be represented by a voltage level, a sine wave’s frequency or phase, etc.These may be differentEmbedded Systems 11-6These may be different– Extra symbols (channel changes) may be inserted for framing, error detection, acknowledgment, etc. These reduce the bit rate– A single symbol might encode more than one bit. This increases the bit rate.• E.g. multilevel signaling, quadrature amplitude modulation, phase amplitude modulation, etc.Serial Communication BasicsRS232: rules on connector, signals/pins, voltage levels, handshaking, etc.RS232: Fulfilling All Your Communication Needs, Robert AshbyQuick Reference for RS485, RS422, RS232 and RS423Not so quick reference:The RS232 Standard: A Tutorial with Signal Names and Definitions, Christopher E. StrangioBit vs Baud rates: http://www.totse.com/en/technology/telecommunications/bits.htmlEmbedded Systems 11-7UART ConceptsUART– Universal – configurable to fit protocol requirements– Asynchronous – no clock line needed to deserialize bits – Receiver/TransmitterM30626 has three– UART0, 1, and 2– UART1 talks to USBMon board, enables us to do in-circuit debugging–Can operate in asynchronous or synchronous (not used here) modesEmbedded Systems 11-8–Can operate in asynchronous or synchronous (not used here) modes– See MCU Hardware Manual for details, or else the remaining slides might be confusingRS232 Communications CircuitExample RS-232 buffer (level-shifting) circuit– Not included on SKP16C62Max202/3232 includescharge pump to generate+10 V and -10V from single 5V supplyEmbedded Systems 11-9Logic-level signals(Vcc or Ground)RS232-level signals(> 3 V or < -3 V)UART ConceptsUART subsystems–Two fancy shift registers• Parallel to serial for transmit• Serial to parallel for receive–Programmable clock source• Clock must run at 16x desired bit rateEmbedded Systems 11-10desired bit rate–Error detection• Detect bad stop or parity bits• Detect receive buffer overwrite–Interrupt generators• Character received• Character transmitted, ready to send anotherSetting up the Serial PortWe will use UART 0, so all of the references to a UART will have “u0” in them.There are several “control” registers you need to set up before you can communicate.– First, you need to set up the speed of your port.– Select 8 data bits, no parity, one stop bit (8N1)–Enable transmitter and receiverEmbedded Systems 11-11–Enable transmitter and receiverCode examples:– main_uart.c/skp_bsp.h in the SKPTest application– serial_poll_demo.c/serial_poll_includes on notes pageSetting up Speed of the Serial PortBaud rate = 19,200 baud– 12 MHz/(16*19,200 baud) = 39.1– Load u0brg with 39-1 = 38– Actual baud rate = 12 MHz/(16*39) = 19230.8 baud = 0.16% error– If error is too


View Full Document

UNCC ECGR 4101 - Serial Communications

Documents in this Course
Load more
Download Serial Communications
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Serial Communications and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Serial Communications 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?