Quick viewing(Text Mode)

Inter-Processor and Inter-Computer Communications

Inter-Processor and Inter-Computer Communications

Inter-processor and Inter-computer Communications

David Rye :: MTRX3700 Communications :: Slide 1 of 87 Classification

. Close-coupled . Loose-coupled . On-board busses . Serial . Backplanes . RS-232 . RS-422 . RS-485 . CAN .

David Rye :: MTRX3700 Communications :: Slide 2 of 87 Classification

. Interface standard: . Software protocol: physical definition of definition of . Connectors . Order and encoding of . Pin assignments the data words being . Voltage levels transmitted (logic encoding) . Flow control . Timing and handshaking . Error detection and correction

David Rye :: MTRX3700 Communications :: Slide 3 of 87 Parallel Busses

. Single processor . Multi-processor . mastering

. Always short – less than 5m, and often much less

David Rye :: MTRX3700 Communications :: Slide 4 of 87 Some Parallel Bus Standards

. IEEE-488 (HP-IB, GPIB)

. S-100 bus (Altair) . Multibus (Intel, Sun). Adopted as IEEE-765 bus . VMEbus (Motorola 68000). Adopted as IEEE-1014 bus

. ISA . PCI . PCIe . etc, etc, etc…

David Rye :: MTRX3700 Communications :: Slide 5 of 87 Backplanes, sub-racks and enclosures

. Backplanes provide electronic connection for bus signals between processor, memory and I/O boards

CAMAC VME Bus All are passive backplanes

PCIe

David Rye :: MTRX3700 Communications :: Slide 6 of 87 Backplanes, sub-racks and enclosures

. Sub-racks provide physical mounting and restraint for backplanes and plug-in cards

Eurocard subrack and cards 19” subrack

David Rye :: MTRX3700 Communications :: Slide 7 of 87 Backplanes, sub-racks and enclosures

. Enclosures and cases provide mounting and environmental protection

19” Rack Case

Enclosures

Floor-standing 19” rack enclosure 19” Desktop case (exploded view)

David Rye :: MTRX3700 Communications :: Slide 8 of 87 IEEE-488 Standard (HP-IB1 or GPIB)

. Developed in 1965 by HP as a standard for interconnecting “intelligent” test instruments . Adopted as IEEE-488.1 in 1975 . IEEE-488.1 defines mechanical, electrical and hardware specifications (≡ IEC2 625) . IEEE-488.2 defines software protocol

1HP-IB ≡ Hewlett Packard Instrument Bus 2IEC ≡ International Electrotechnical Commission

David Rye :: MTRX3700 Communications :: Slide 9 of 87 IEEE-488 Connector

. Mechanically robust stackable 24 pin connector . 8 data lines and 8 pairs of control lines . Bus managed by a GPIB chip

David Rye :: MTRX3700 Communications :: Slide 10 of 87 IEEE-488 Connection

. Can be star or chain connected

. Up to 15 instruments connected Total cable length < 20m . Cable length between instruments < 4m

David Rye :: MTRX3700 Communications :: Slide 11 of 87 IEEE-488

. Allows connection of up to 15 instruments on a common parallel bus (multicore wire) . 4 classes of instrument . Talker e.g. digital volt meter . Listener e.g. printer, plotter . Talker/listener e.g. programmable DVM . Controller . GP-IB controller coordinates activity by commanding instruments to listen or talk . One active controller

David Rye :: MTRX3700 Communications :: Slide 12 of 87 IEEE-488 Bus

Bus Control 

Handshaking  8-bit Data 

. Asynchronous communication . TTL logic levels, but negative logic . Each connected instrument has unique device address between 0 & 30 . Must be designed to recognise its own talk & listen addresses

David Rye :: MTRX3700 Communications :: Slide 13 of 87 IEEE 488 Bus Control

. Three interlocked handshaking lines for control of data transfer . DAV Data Available: asserted by talker when NDAC is false . NRFD Not Ready for Data: goes false (= ready for data) when all listeners are ready for data . NDAC Not Data Accepted: goes false (= data accepted) when last listener has read the data byte

David Rye :: MTRX3700 Communications :: Slide 14 of 87 IEEE 488 Bus Control

. Five general bus control lines for signalling . ATN Attention: asserted by controller when writing data lines . IFC Interface Clear: asserted by controller during bus initialisation . REN Remote Enable: controller selects remote program mode or local program mode . SRQ Service Request: asserted by device to request service by the controller . EOI End of Identity: used by talker to signal the end of a message string

David Rye :: MTRX3700 Communications :: Slide 15 of 87 IEEE 488.2 and SCPI

. IEEE-488.2 extends IEEE-488.1 by defining data formats, status reporting, error handling and common commands

. SCPI1 extends IEEE-488.2 by defining programming commands for measurement, signal generation, etc. :MEAS:VOLT:DC? 10,0.01

1Standard Commands for Programmable Instruments

David Rye :: MTRX3700 Communications :: Slide 16 of 87 Serial Data Communications

David Rye :: MTRX3700 Communications :: Slide 17 of 87 Basics: Logic Encoding

. Serial data transmission is always digital, for noise immunity . Logic levels may be encoded by (e.g.) . Voltage level . Frequency (FSK) . Manchester code . Current level . Phase (PSK) . 0 = transition . 1 = no transition . In digital communications . Logic 1 is termed “mark”, and . Logic 0 is termed “space”

David Rye :: MTRX3700 Communications :: Slide 18 of 87 Basics: Simplex and Duplex

. Simplex . Data transmitted in one direction only

. Full duplex . Data transmitted simultaneously in both directions

David Rye :: MTRX3700 Communications :: Slide 19 of 87 Basics: Coding of Messages

. Sender and receiver must agree on the codes for transmitting data words . Data words may be transmitted as . Binary numbers or . Character codes (e.g. ASCII) . 8 bits per data word means 28 = 256 different codes

. Often 7-bit ASCII is used – bit 7 is zero

David Rye :: MTRX3700 Communications :: Slide 20 of 87 Basics: Asynchronous & Synchronous Transmission

. Asynchronous . Receiver and transmitter have separate clocks, running at the same nominal frequency . Receiver synchronises with the transmitter by detecting the start of each data byte

. Synchronous . Receiver and transmitter synchronised by a common clock . Much faster than asynchronous communications

David Rye :: MTRX3700 Communications :: Slide 21 of 87 RS-232 Standard

. EIA1 standard RS-232C equivalent to ITU-T2 standard V.24 . Originally (1966) a standard for data communications through the Bell telephone system . Specifies interchange between DCE (e.g. computer) and DTE (e.g. modem) . Now seldom used with modems, but widely used for other short-range serial communications

1 Electronic Industries Association 2 International Telecommunications Union

David Rye :: MTRX3700 Communications :: Slide 22 of 87 RS-232 Standard

. RS-232C standard defines . Mechanical characteristics (connector and pin assignment) . Functions of signals . Electrical signal characteristics

. Does not define software protocol

David Rye :: MTRX3700 Communications :: Slide 23 of 87 RS-232 Capabilities (Limitations)

. Point-to-point communication . Maximum distance 15.2 m . 20 kbps maximum data rate

David Rye :: MTRX3700 Communications :: Slide 24 of 87 RS-232 Connector

. The standard specifies a D25 connector . D9 is often used, as now RS-232 applications use (at most) only 9 signals

. In fact, one can get away with only 3 signals: Rx, Tx and GND

David Rye :: MTRX3700 Communications :: Slide 25 of 87 RS-232 Pin D25 Signal Name Code D9 1 Frame Ground FG - Assignments 2 Transmit Data TD 3 3 Receive Data RD 2 4 Request to Send RTS 7 5 Clear to Send CTS 8 6 Data Set Ready DSR 6 7 Signal Ground SG 5 8 Data Carrier Detect DCD 1 9 +Voltage (test) - 10 -Voltage (test) - 11 Unassigned - 12 2nd Data Carrier Detect - 13 2nd Clear To Send - 14 2nd Transmitted Data - 15 Transmitter DCE Timing - 16 2nd Receive Data - 17 Receiver DCE Timing - 18 Local Loopback - 19 2nd Request To Send - 20 Data Terminal Ready DTR 4 21 Signal Quality Detect - 22 Ring Indicator RI 9 23 Data Signal Rate - 24 Transmitter DTE Timing - 25 Test Mode -

David Rye :: MTRX3700 Communications :: Slide 26 of 87 RS-232 Signal Functions

(DCE is computer, DTE is modem) . SG Signal ground . TD Transmit Data – data sent from DTE to DCE on TD . RD Receive Data – data received at DTE from DCE on RD

. RTS Request To Send – asserted when DTE ready to send data . CTS Clear To Send – DCE responds with CTS if it is ready to receive data

. DTR Data Terminal Ready – asserted when DTE powered & ready . DSR Data Set Ready – asserted when DCE is powered & ready

. DCD Data Carrier Detect – asserted by DCE when connection is made

David Rye :: MTRX3700 Communications :: Slide 27 of 87 RS-232 Cables

. To connect DTE to DCE, just . Loopback can be used to use a pin-to-pin connection reduce the number of wires:

David Rye :: MTRX3700 Communications :: Slide 28 of 87 RS-232 Null Modem

. What if we want to connect a DCE to another DCE (computer to computer)? . Use a null modem connection:

David Rye :: MTRX3700 Communications :: Slide 29 of 87 RS-232 Electrical Levels

. Logic 1 (“mark”) is a voltage between -5V and -15V (transmitter) or -3V and -25V (receiver) . Logic 0 (“space”) is a voltage between +5V and +15V (transmitter) or +3V and +25V (receiver)

. Often ±7V or ±10V is used

. Not compatible with TTL levels  use an RS-232 driver (e.g. MC1488, MC1489, MAX232, MAX202)

David Rye :: MTRX3700 Communications :: Slide 30 of 87 RS-232 Electrical Levels

. Data transmitted asynchronously, least significant bit first. For example, here is ASCII ‘Q’:

. Line idles at “mark” (logic 1 or negative voltage) . Byte framed by a logic 0 start bit & a logic 1 stop bit . Bit 0 transmitted first

David Rye :: MTRX3700 Communications :: Slide 31 of 87 RS-232 Electrical Levels

. Before transmission begins, transmitter and receiver must agree on: . baud rate (1200, 2400, 4800, 9600, 19200, etc) . 1, 1.5 or 2 stop bits . 5, 6, 7 or 8 data bits . even, odd or no parity . This is done by programming the serial IC (a UART or USART) . A frame can be anywhere from 7 to 12 bits long

David Rye :: MTRX3700 Communications :: Slide 32 of 87 Parity

. Parity is a simple means of error detection . A parity bit is an extra bit between the last data bit and the stop bit

. Even parity means that there is an even number of 1s in the data bits plus parity bit . Odd parity means that there is an odd number of 1s . The parity bit is adjusted to achieve the required parity

David Rye :: MTRX3700 Communications :: Slide 33 of 87 Baud Rate vs. Data Rate

. Baud rate is the number of bits per second . Data rate is the number of useful data bits per second . Consider transmission at 7 data bits, 2 stop bits, no parity, 1200 baud: . Baud rate = 1200 bits/sec . Data rate = 1200 *7/(7+2+1) = 840 bits/sec (70% “useful” data)

David Rye :: MTRX3700 Communications :: Slide 34 of 87 Unbalanced and Balanced Transmission

. An RS-232 receiver compares the voltage to ground (0V). This is unbalanced transmission. . If > +3V  ‘space’ (logic 0) . If < -3V  ‘mark’ (logic 1) . If ground potential varies along long line, errors can be introduced

. Solution: send the data on two wires and ground neither of them. This is balanced (differential) transmission

David Rye :: MTRX3700 Communications :: Slide 35 of 87 Balanced Data Transmission

. Higher data rates (10+ Mbps) over much longer lines (1,200 m) . Far less susceptible to stray fields and noise pickup . Generate less electrical noise . Often use (shielded) twisted pair or coaxial cable

David Rye :: MTRX3700 Communications :: Slide 36 of 87 RS-422 Standard

. One differential line driver, up to 10 differential receivers

. Line voltages are . Logic 0: -0.2V to -6V . Logic 1: +0.2V to +6V . Distance up to 1,200m, data rates to 10Mbps (but not at same time) . Mechanical layer not specified David Rye :: MTRX3700 Communications :: Slide 37 of 87 Transmission Lines

. When long lines operate at high speed, the wave behaviour of signals can become significant . If the input impedance of the receiver does not match the line impedance, partial reflection can occur. The wave front can propagate backwards and forwards along the line, creating noise and errors

. Solution: terminate the line at the characteristic impedance of the line

David Rye :: MTRX3700 Communications :: Slide 38 of 87 Line Drivers & Receivers

. Matched drivers and receivers manufactured – e.g. . DS34C86 RS-422 receiver and DS34C87 driver from National Semiconductor . 75S110 differential current driver and 75107 receiver from TI . May have . Built-in termination resistor . Fail-safe operation (output goes to known state if line goes open-circuit or short-circuit) . Controllable slew rate (reducing slew rate decreases noise)

David Rye :: MTRX3700 Communications :: Slide 39 of 87 Differential Driver/Receiver Pairs

. Example: Differential current driver (75S110) and correctly terminated receiver (75107)

+ Input - Input Output

(from Horowitz & Hill 2ed)

David Rye :: MTRX3700 Communications :: Slide 40 of 87 RS-485 Standard

. Expansion of RS-422 standard . Same data rate and distance . Same differential ±5V voltage but... . Permits multi-drop network communications with up to 32 line drivers and line receivers

David Rye :: MTRX3700 Communications :: Slide 41 of 87 RS-485 Standard

. Multi-drop communications requires tri-state line drivers: logic 0 or logic 1 or high Z

. Messages are addressed to destination receiver . Master allows a slave to talk

David Rye :: MTRX3700 Communications :: Slide 42 of 87 Synchronous Serial Transmission

. Asynchronous communication requires synchronisation at every byte, start and stop bits, and so “wastes” time transmitting non-data . Synchronous communication locks the transmitter and receiver together with a common clock signal . (Almost) every bit can be a data bit . Much faster clocks can be used (data itself can be the clock) . Send long blocks of data to maximise data rate . But: A software protocol is now needed to define the start of a message (Where does a message start? Where does a byte start?)

David Rye :: MTRX3700 Communications :: Slide 43 of 87 Software Protocols

David Rye :: MTRX3700 Communications :: Slide 44 of 87 Software Protocols

. A protocol is a set of rules governing the exchange of data between a transmitter and a receiver on a network . It is associated with the packaging of the data transmitted

. More sophisticated protocols use error checking to assure data integrity

David Rye :: MTRX3700 Communications :: Slide 45 of 87 XON/XOFF Flow Control

. A Character-Based Flow Control Protocol . Full-duplex communication, receivers always enabled . When receive buffer nearly full, receiver transmits XOFF . When transmitter receives XOFF, it pauses until it receives XON

. XON character is usually ASCII DC1 – Direct Control 1 (DC1 is 0x11, usually mapped to q) . XOFF character is usually ASCII DC3 – Direct Control 3 (DC3 is 0x13 , usually mapped to s)

David Rye :: MTRX3700 Communications :: Slide 46 of 87 ASCII-based Protocols

. Simple user-defined command-and-response sequence using ASCII characters . Example: Read from Transmitter 1: . Command from host: $ 1 R . Response from Tx 1: $ + 0 0 2 7 3 . 0 0 . Could replace sentinels $ and and command R with non-printing ASCII control characters  “Bisync” . Could add error checking

David Rye :: MTRX3700 Communications :: Slide 47 of 87 Binary Synchronous Comms. Protocol

. IBM System/360, 1967. Still in use for cash ATMs. . Known as BSC or “Bisync” . Character-based protocol for transmitting 256-byte blocks of data encoded as ASCII or EBCDIC . Uses non-printing ASCII control bytes (0x00–0x1F) to separate the different fields in a BSC message

. Half-duplex protocol requiring receiver to acknowledge each message  slow turnaround . Normally point-to-point, can be multi-point

David Rye :: MTRX3700 Communications :: Slide 48 of 87 BSC (ASCII) Control Characters

ASCII Meaning Description ACK0 Acknowledgement Received block is OK ACK1 Acknowledgement 1 Received odd block is OK ACK2 Acknowledgement 2 Received even block is OK DLE Data Link Escape Control character follows ENQ Enquiry Please respond with data EOT End of Transmitted Data The transmission is over ETB End of Transmission Block End of block ETX End of Text End of data text ITB End of Intermediate Block More blocks coming NAK No Acknowledgement Problem with received block SOH Start of Header Routing information STX Start of Text Message data text begins SYN Synchronous Idle Allows receiver to synchronise BCC CRC Block Check Char Contains block CRC

The SYN character in ASCII is 00010110B = 0x16

David Rye :: MTRX3700 Communications :: Slide 49 of 87 BSC Messages

. Message is just a bit stream . No rotation of SYN equals the original . First SYN gives tentative byte synch . Second SYN gives bit synchronisation . Optional header could proceed data . BCC = block check character (checksum)

David Rye :: MTRX3700 Communications :: Slide 50 of 87 Checking for Random Errors

Three popular forms: 1. Byte redundancy checks . Check the parity of each byte received (parity = CRC-1) 2. Block redundancy check . Additional block check character added to each block of characters . Block redundancy check: calculate parity of each character and then all characters in block . Arithmetic checksum: calculate parity of each character and then an arithmetic checksum

David Rye :: MTRX3700 Communications :: Slide 51 of 87 Error Checking (ctd)

3. Cyclic redundancy check (CRC) . Worst-case failure rate of (e.g. CRC-16) 0.0031% . CRC mechanism (typical – many algorithms exist): . Repeatedly divide the entire message by a special number (e.g. 1000 100 00001 00 001) to get a quotient and a remainder. The remainder is the CRC checksum . The number is referred to as a (binary) ‘polynomial’ . The division is done by XORing any 1 bit in the message with each 1 in the polynomial. Start at the left of the message and right-shift the polynomial by 1 bit each time until reach the right . Append the CRC checksum to the message . Algorithm is a balance between . Maximising error detection capability and . Minimising collisions (different data but same checksum)

David Rye :: MTRX3700 Communications :: Slide 52 of 87 High-level Data Link Control Protocol (HDLC)

. First created ~1984, now defined by ISO 13239 . Bit-based synchronous binary data link protocol . Meaning is determined by the number and position of bits in the message . Messages are sent in frames that consist of fields . Predecessor to protocols used in Local Area Networks – related to the LAPB, LAPD (ISDN), Frame Relay data link control protocols . Basis for IEEE 802.2 LLC protocol . Basis for PPP (Point-to-Point Protocol)

David Rye :: MTRX3700 Communications :: Slide 53 of 87 HDLC Frame Format (Sync or Async)

. Line idles with constant 1s . Message (frame) consists of: . 8-bit start flag (01111110) – guaranteed not to be in a frame . 8-bit address of the receiving station comes next . 8-bit control word is sent; each bit has a specific meaning . Information field, with any number of bits - maybe 10,000 or 20,000 . 16-bit CRC frame checksum . 8-bit end flag (01111110) (same as start flag) . Transmitter inserts 0 after any 5 successive 1s in the data (only); the 0 is automatically removed by receiver. This is called ‘bit stuffing’, and allows . 01111110 to be present in data . Receive and transmit clocks to be trained (synchronised)

David Rye :: MTRX3700 Communications :: Slide 54 of 87 HDLC Frame Format

. “Un-numbered” frame (U-frame) is used to manage link . Supervisory frames (S-frames) are used for flow control and error control . Information frames (I-frames) carry user data. Can also carry flow and error control information. . Two forms of error control: . Selective re-transmit on error . Request to transmit a number of previous frames . Link is full duplex . When data is not being transmitted, start flags transmitted continuously for clock synchronisation

David Rye :: MTRX3700 Communications :: Slide 55 of 87 HDLC Frame Format

(numbers are bits) . 8-bit control field has different form for I, S and U-frames . Start and end of frame (‘Flag’ in figure) is 01111110 . FCS is a 16-bit CRC

David Rye :: MTRX3700 Communications :: Slide 56 of 87 Layered Communications Models and Protocol Suites

OSI and the Internet Suite

David Rye :: MTRX3700 Communications :: Slide 57 of 87 OSI Model (ISO/ITU-T)

. Open Systems Interconnection Reference Model . Abstract layered computer communications / network model . OSI Seven Layer Model: . 7 – Application Layer (user data) – e.g. FTP, HTTP . 6 – Presentation Layer – e.g. MIME, SSL . 5 – Session Layer – e.g. NetBIOS, Named Pipes . 4 – Transport Layer – e.g. TCP, UDP, PPTP . 3 – Network Layer – e.g. IP, IPv6, IPSec . 2 – Data Link Layer – e.g. SLIP, Frame Relay . 1 – Physical Layer (transmission medium) – e.g. RS-232, V.34, DSL, Ethernet, etc...

David Rye :: MTRX3700 Communications :: Slide 58 of 87 Internet Protocol Suite

. Application Layer . Higher-level protocol at the application level – e.g. DHCP, DNS, FTP, HTTP, IMAP, IRC, LDAP, NTP, POP, RIP, RPC, RTP, SIP, SMTP, SNMP, SSH, Telnet, TLS/SSL, XMPP… . Transport Layer . End-to-end message transfer, including error/flow control and application addressing (port numbers) – e.g. TCP, UDP, DCCP, SCTP, RSVP, ECN . Internet Layer (“Layer 3”) . Routes packets from a source network to a destination network – e.g. IP (IPv4, IPv6), ICMP, IGMP, IPsec, OSPF . Link Layer (“Layer 2”) . Moves packets between 2 hosts (computers) on the same link (network) – e.g. ARP/RARP, L2TP, PPP, MAC (Ethernet, DSL, ISDN, FDDI)

David Rye :: MTRX3700 Communications :: Slide 59 of 87 Ethernet, IEEE 802.x and TCP/IP

Ubiquitous CSMA/CD link layer control and Internetworking protocols

David Rye :: MTRX3700 Communications :: Slide 60 of 87 Ethernet

. Defined by DEC and Xerox in 1982 . Operates at 10 Mbit/sec . Uses 48-bit hardware addresses (MAC address) . Predominant physical layer (OSI layer 1) and data link layer (OSI layer 2 – LLC + MAC) in LANs today . LLC: Logical Link Control sublayer (flow/error control) . MAC: Media Access Control sublayer (hardware address) . Uses CSMA/CD – Carrier Sense Multiple Access with Collision Detection

David Rye :: MTRX3700 Communications :: Slide 61 of 87 CSMA/CD

Carrier Sense Multiple Access with Collision Detection 1. If the medium is idle, transmit (carrier sense) 2. If the medium is busy, listen until it becomes idle, then transmit immediately 3. If a collision detected during transmission, transmit a brief jamming signal and stop transmission 4. Wait a random amount of time, then go to 1

David Rye :: MTRX3700 Communications :: Slide 62 of 87 IEEE 802.x (Fast Ethernet)

. Defined by IEEE in 1985 and later . 100 Mbit/sec . Now standardised as IEEE Standard 802: . 802.1 defines network Bridging and Management . 802.2 defines Logical Link Control (LLC) (inspired by HDLC) . 802.3 defines a set of CSMA/CD networks (Ethernet) . 802.4 defines Token Bus networks . … . 802.11 defines Wireless Ethernet . ... Now up to 802.25 . Combination of 802.2 and 802.3 define a frame format slightly different from Ethernet

David Rye :: MTRX3700 Communications :: Slide 63 of 87 TCP/IP Encapsulation

. TCP is a common transport layer (OSI layer 4) protocol . IP is common Internetwork layer (OSI layer 3) protocol

. IP information (“IP datagram”) is commonly transported inside (“encapsulated within”) an Ethernet or Fast Ethernet frame . Encapsulation is slightly different between these two types of Ethernet frame

David Rye :: MTRX3700 Communications :: Slide 64 of 87 Ethernet (10 Mbps) Frame

(MAC)

ARP: MAC (layer 2) address given IP (layer 3) address

RARP: IP (layer 3) address given MAC (layer 2) address

(numbers are bytes)

David Rye :: MTRX3700 Communications :: Slide 65 of 87 IEEE 802.2/3 Frame (‘Fast Ethernet’)

Subnetwork Access Protocol

(numbers are bytes)

David Rye :: MTRX3700 Communications :: Slide 66 of 87 TCP/IP

Transmission Control Protocol / Internetworking Protocol

David Rye :: MTRX3700 Communications :: Slide 67 of 87 IP – Internetworking Protocol

. A network level protocol (OSI layer 3) – delivers a packet from one computer in a network to another computer in a network

. Sits on top of a . Data Link Layer (OSI layer 2) – e.g. LLC + MAC and a . Physical Layer (OSI layer 1) – e.g. Ethernet . Defined by RFC 791 (plus 13 others)

RFC = (Internet) Request For Comments – see www.faqs.org/rfcs

David Rye :: MTRX3700 Communications :: Slide 68 of 87 IP Datagrams

. IP is an unreliable and connectionless datagram protocol . Unreliable – Makes a best effort at delivery . No acknowledgement or error checking . No guarantee of delivery or timing . Connectionless – No guarantee of start-to-end connection

. IP transports data in packets called IP datagrams . Each IP datagram transported separately . IP Datagrams can travel on different routes . Can arrive out of sequence, duplicated or not at all

David Rye :: MTRX3700 Communications :: Slide 69 of 87 IP Datagram

(“octets”)

David Rye :: MTRX3700 Communications :: Slide 70 of 87 (A very few of the) Protocols within the IP Suite

. ARP – Address Resolution Protocol: discovers the IP address associated with a physical (MAC) address . RARP – Reverse Address Resolution Protocol: allows discovery of an IP address from a physical (MAC) address . ICMP – Internet Control Message Protocol: used to report datagram errors and queries back to sender . IGMP – Internet Group Message Protocol: facilitates sending messages simultaneously to group of recipients

David Rye :: MTRX3700 Communications :: Slide 71 of 87 TCP – Transmission Control Protocol

. A transport level protocol (OSI layer 4) – delivers a message from one process to another . Sits on top of a network layer– e.g. IP . Defined by RFC 793 (plus 16 others)

David Rye :: MTRX3700 Communications :: Slide 72 of 87 TCP – Transmission Control Protocol

. TCP is a reliable stream transport protocol . ‘Stream’ means connection oriented – a connection must be established (e.g. using IP) between both ends of a transmission before either can transmit data

. TCP divides transmitted data stream into segments . Each segment has . Sequence number for re-ordering . Acknowledgement number . Segments are transmitted inside (‘encapsulated in’) IP datagrams

David Rye :: MTRX3700 Communications :: Slide 73 of 87 CAN and CANopen Protocols

An example of multi-layered protocols

David Rye :: MTRX3700 Communications :: Slide 74 of 87 CAN – Controller Area Network

. Invented by Robert Bosch GmbH for use in cars . Dominant in car, truck, off-road industry – first in Europe, now USA, Japan . Moving to factory (DeviceNet) and domestic automation . Supported by more than 50 microcontroller families

. Hardware link layer protocol . Message-based multi-master, multi-drop 2-wire (+power) serial bus for connecting “smart” devices with very high integrity and guaranteed low latency. . Best for short, high integrity, low latency messaging.

David Rye :: MTRX3700 Communications :: Slide 75 of 87 CAN Performance

. Differential 2-wire interface, twisted pair cable . Maximum data rate 1Mbps (to 40m) . Minimum required rate 20kbps . Maximum line length 1km (1kbps); 500m at 125kbps

. Standardised by ISO11898 which defines the 2 lowest layers of the ISO/OSI reference model . 2 – Data Link Layer – implemented by CAN chips . 1 – Physical Layer – electrical specs, connectors, etc . See also CAN in Automation (CiA) http://www.can-cia.org/

David Rye :: MTRX3700 Communications :: Slide 76 of 87 CAN Messaging

Broadcast messaging . Transmitter sends message to all nodes . Message contains 0 to 8 bytes of user data . Message also contains node identifier (is it for me?) . Prioritisation built into identifiers  lower identifier is higher priority . This prioritisation enables guaranteed latency

. Error detection and re-transmission in hardware (by CAN chip)

David Rye :: MTRX3700 Communications :: Slide 77 of 87 CAN Frame Formats

Two frame formats: . CAN 2.0A – “CAN Standard Frame” has 11-bit identifier (address) . CAN 2.0B – “CAN Extended Frame” has 29-bit address

David Rye :: MTRX3700 Communications :: Slide 78 of 87 CAN 2.0A Frame Format

. Start bit, “Start Of Frame” (SOF; 1 bit) . “Arbitration field” . Identifier (11-bit address) and . "Remote Transmission Request Bit” (RTR; 1 bit) – distinguishes between the data frame and the data request frame called remote frame. . “Control field” contains . "Identifier Extension bit” (IDE) – distinguishes between CAN 2.0A and 2.0B frames (r0 is a reserved bit) . "Data Length Code” (DLC; 4 bits) – number of bytes in the data field

David Rye :: MTRX3700 Communications :: Slide 79 of 87 CAN 2.0A Frame Format (ctd)

. “Data field” of 0 to 8 bytes. . “Cyclic Redundancy Checksum” (15-bit CRC + 1 bit . “ACKnowledge field” (ACK; 2 bits) delimiter) . Bit 1: ACK slot. The bit in the ACK slot is sent as a recessive bit (1) and is overwritten (using a wired-AND) as a dominant bit (0) by those receivers which have at this time received the data correctly. . Bit 2: ACK delimiter. . “End Of Frame” (EOF; 7 bits) – end of the message . “Intermission Frame Space” (IFS; 7 bits) – minimum number of bits between messages.

David Rye :: MTRX3700 Communications :: Slide 80 of 87 CAN Recessive and Dominant Bits

The CAN specification describes “dominant” and “recessive” bits . Dominant bit is logic 0, actively driven by a transmitter . Recessive bit is logic 1, passively pulled up

This provides a mechanism to resolve bus collisions: if dominant and recessive bits are transmitted the dominant bit “wins” because the pull-up resistor is overdriven.

David Rye :: MTRX3700 Communications :: Slide 81 of 87 CAN Frame Error Detection

Three mechanisms at the message level: . Cyclic Redundancy Check (CRC). Add redundant check bits at the transmission end. Check bits are recalculated and tested by the receiver

. Frame check. Checks the bit fields against the fixed format and the frame size.

. ACK errors. Received frames are acknowledged by all receivers. No acknowledgement indicates an ACK error.

David Rye :: MTRX3700 Communications :: Slide 82 of 87 CAN Bit Error Detection

Two mechanisms at the bit level . Monitoring. Transmitter monitors bus signal levels, and can detect errors by comparing the bit value transmitted and the value on the bus. . Bit stuffing. Coding of the individual bits is tested at bit level. Synchronization edges are generated by means of bit stuffing – after five consecutive equal bits the Tx inserts a “stuff bit” of complementary value. These are automatically removed by receivers. . Note that bit stuffing is also required to provide sufficient edges to maintain synchronisation since data is encoded using NRZ encoding.

David Rye :: MTRX3700 Communications :: Slide 83 of 87 CAN Transmission Abort

If one or more errors are detected by any mechanism . Transmission aborted via receiver sending an “error flag” . Sender automatically attempts re-transmission

David Rye :: MTRX3700 Communications :: Slide 84 of 87 CAN Statistical Error Detection

Statistical assessment of node errors: . Each node aims to self-diagnose its own defects . If defective, will enter a mode where it does not degrade the rest of the CAN network . Defective node may even power itself down.

David Rye :: MTRX3700 Communications :: Slide 85 of 87 References

—. Internet RFC/STD/FYI/BCP Archives. www.faqs.org/rfcs —. CAN in Automation (CiA). http://www.can-cia.org/ Forouzan. TCP/IP Protocol Suite. 4 ed., McGraw-Hill, 2010. Horowitz & Hill. The Art of Electronics. 2 ed., Cambridge University Press, 1989. ISO 11898-1994 Controller Area Network [ISO Standard] Stallings. Data and Computer Communications. 10 ed., Pearson Education, 2013.

David Rye :: MTRX3700 Communications :: Slide 86 of 87 the end

David Rye :: MTRX3700 Communications :: Slide 87 of 87