Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross Overview • Communications overview • Overview: UART (RS-232) • Brief overview: – I2C – SPI – 1-Wire 2 Digital Communications • Different types of communication: – Serial – data only transmitted one bit at a time on one lane (per direction) (differential pairs of signals are referred to as a lane) – Parallel – data transmitted typically words at a time (on different lines) with additional lines for parity and control (Typically doesn’t use lanes) • Different types of signals: – Data – The message which is to be sent – Control – Signals used to ensure to control the flow of data, eg. Clock, start of frame, end of frame 3 Universal Asynchronous Receiver/Transmitter UART • Common standard: RS-232 • Three wires used: – Transmit – Receive – Ground • Data encapsulated as 7 or 8 bit chunks • Optional Parity – monitor data integrity • Allow serial communication between devices 4 Asynchronous • Signals are self clocking – no separate clock is transmitted with data • Receiver must lock onto data and decode individual bits without using a specific receive clock 5 Operation • UARTs have two sectors: – Receive (RX): read the incoming serial bitstream, converts to parallel data (Serial to Parallel Conversion) – Transmit (TX): converts parallel data from the microprocessor registers into a serial bitstream to transmit (Parallel to Serial Conversion) • Receiver has to detect phase of incoming data and phase lock it’s local clock to the data pattern 6 Parity Bit • Parity is a simple check to verify data integrity • An extra bit is added to each byte (or a defined chunk of data) called a parity bit • 4 different cases: – Even Parity: Even number of bits in total – Odd Parity: Odd number of bits in total – Mark Parity: Parity bit is always ‘1’ – Space Parity: Parity bit is always ‘0’ 7 Parity Bit • For each byte the number of ‘1’s is summed • In even parity this sum should be even (parity bit is set to make it even) • In odd parity this sum should be odd (parity bit is set to make it odd) • Example: – 10010111 (5 ‘1’s present) • If even parity: parity bit should be ‘1’ • If odd parity: parity bit should be ‘0’ 8 Parity Bit • Receiver performs same parity count – if it doesn’t match the receiver knows that the data wasn’t received correctly • What is a problem with Parity? – Only detects odd numbers of bit errors effectively 9 UART interfacing UART device Microprocessor TX RX Examples: GPS Receiver Bluetooth Transceiver RX TX 10 UART RS-232 interfacing • RS-232 is the serial standard used on PC serial ports • The voltage levels are inverted and have a larger swing than most microprocessors provide • Use a specialised IC to convert: eg. MAX232 PC Microprocessor TX RX MAX232 RX TX 11 I2C • • • • Inter-Integrated Circuit Developed by Philips Multi-master serial computer bus Two wires – configured as open drain lines, pulled up with resistors – SDA: Serial Data – SCL: Serial Clock 12 I2C • Master sends Start bit, followed by address of desired slave followed by read/write bit • Slave sends acknowledgement • Master continues in requested mode (read or write), slave continues in complementary mode (write or read) until stop bit is sent • Communications are in Big Endian bit format – most significant bit first • Start bit: high->low transition of SDA with SCL high • Stop bit: low->high transition of SDA with SCL high 13 SPI • Serial Peripheral Interface Bus • Developed by Motorola • 4 signals used: – SCLK: Serial Clock (from master) – MOSI: (Master Output, Slave Input) – MISO: (Master Input, Slave Output) – SS: (Slave Select) (one pin for each slave device) – http://en.wikipedia.org/wiki/Serial_Peripheral_I 14 nterface_Bus SPI • Allows full duplex (bi-directional at the same time) communication • Higher throughput than I2C • No flow control • Short distance communication • Applications: – – – – SD Memory cards Sensors Memory IC communications 15 Summary • Digital communications is the process where digital devices exchange data encoded in a bit format • Communications can occur in two forms (with various adaptations of each) – serial or parallel • UART, I2C and SPI are common methods used for serial communications 16