Chapter 2.2 La 2 Data Link La Technologies 1 Content Introduction La 2: Frames Error Handling 2 Media Access Control General approaches and terms Aloha Principles CSMA, CSMA/CD, CSMA / CA Master-Slave Approaches (Polling) Token based solutions Time based solutions Examples Bluetooth CAN Ethernet 1
Protocol aspect of the OSI-Model Endsystem 1 La 7 protocol Endsystem 2 7 La 6 protocol 7 6 6 Transitsystem 5 5 4 4 3 3 3 2 2 2 1 1 1 transmission-system Protocols are defined between the same las of two systems. They define rules and formats of message/information exchange. 3 Data Link La Consits of two sublas Has to be defined for each communication system Technologies depend on Network- Structures LLC MAC Media Access Control Multiplexing protocols transmitted over the MAC la (when transmitting) and demultiplexing them (when receiving). Providing flow and error control Frames (Addressing, Error Control) Multiple Access Control to share media 4 2
Frames Start Addressing / ID Control Data FCS End Elements of a Frame Start: Special Sequence to describe the start of a frame Adressing / ID: Information to handle a frame in a network. For a point to point communication it is not necessary Control: Additioal infroamtion, like number of Data-Byte Data: The Information transported in the Frame FCS: Frame Check Sequence, to detect transmission errors End: special sequence to describe the end of a frame Frame-structure has to be defined for each technologie 5 Frame-Example RS 232 (no Adress) 6 3
Frame Example CAN (Identifier: Information-based) 7 Frame Example: Ethernet (Adress- based) 8 4
Structure of a Frame Flexray (Frame ID + Message ID) Bigger Frame - Including more Messages Also used in Ethercat (Ethernet-Frame transports different smaller messages) Discussed for Profinet IO als dynamic solution 9 Checksum (practical approach) Parity-Bits Building the real sum of Information Bytes Number of Bits in Addition ( overflow is just cancelled) Same sum for different information easy to realize Not the best error detection behaviour 10 Division of message (Dividend) by a fixed value (Divisor) Calculation of quotient and remainder Add remainder as checksum Check at receiver-side: Doing the same division, and you should get the same remainder 5
Stuff-Bits: Timing and Rules for Error detection NRZ 0 1 t t Manchester t t 0 1 2 3 4 5 6 0 1 2 3 4 5 S 7 8 9 10 11 12 13 6 7 8 9 S 10 11 NRZ-Coding with Bit-Stuffing (CAN) 11 La 2 Build the Frame Get Data from upper la Calculate l Checksum 12 Organize the media access Synchronisation Elements Media Access (Transmission allowed) Error / collision detection Retransmission / error handling Transfer Frame (Bitstream) to physical la Receive Frame Check Frame / acknowledgement Transfer Data to upper la 6
Content Introduction La 2: Frames Error Handling Media Access Control General approaches and terms Network Topologies Media Access Principles (Random) Aloha Principles CSMA, CSMA/CD, CSMA / CA, CSMA / BA Media Access Principles i (Determined) Master-Slave Approaches (Polling) Token based solutions Time based solutions 13 Point to Point Communication simplex: communication into one direction half duplex: communication in both directions, but not at the same time Full duplex: communication into both directions at the same time (2 simplex channels) Uplink, reverse channel talk 14 listen Downlink, forward channel 7
Duplexing reverse Channel forward Channel Lines / cables seperation by lines Frequency division duplexing (FDD) reverse Channel forward Channel frequency frequency- separation Time division duplexing (TDD) reverse Channel forward Channel time 15 time- separation Line-Seperation: Point to Point TX TX RX RX Pure Point to Point connection no network no media access control (only synchronisation) 16 8
Network-Topologies 17 Source: http://en.wikipedia.org/wiki/image:networktopologies.png Network-Topologies (seperated media, full duplex ) Network based on point to point links: needs active elements to communicate between nodes (e.g. switch or nodes are active) needs addressing scheme needs error handling (only LLC elements are required) Link star topology ring topology line structure 18 9
Principles for media seperation Communication link due to seperated media: Different messages can be exchanged at the same time in the Network. Independant access for the communication nodes (no MAC necessary) Wired: (SDMA: different cables for different links, no sharing) FDMA: different frequency-bands for different links CDMA: different orthogonal codes for different links Wireless: FDMA: different frequency-bands for different links CDMA: different codes for different links (FHSS, DSSS) SDMA: different RF-Field for different links SDMA: Space Division Multiple Access FDMA: Frequency Division Multiple Access CDMA: Code Division Multiple access 19 Network-Topologies (Shared Media) Network based on shared media needs passive elements to communicate between nodes (e.g. hub or just shared cable) needs addressing scheme needs error handling (only LLC elements) Needs MAC: Media Access Control: Link 20 How to share the Media? 10
Principles for media sharing Communication link due to shared media: Only one message can be exchanged at the same time in the network. Access for the communication nodes to media has to be solved (MAC necessary) Wired: TDMA different messages at different times on the cabel Wireless: TDMA: different messages at different times in the air TDMA: Time Division Multiple Access 21 FDMA (1) Code B t N = B 2B t guard B c Channel 1 Gurard Channel 2 Channel 3... Channel N Gurard frequency time Individual channels to individual users FDD: one Channel as a pair of frequencies B c 22 11
FDMA/FDD Code Uplink downlink Gurard Channel N... Channel 3 Channel 2 Channel 1 Gurard Gurard Channel N... Channel 3 Channel 2 Channel 1 Gurard time frequency 23 FDMA (2) If a channel is not used it can not be used by other users to increase or share capacity Bandwidth of FDMA channels relatively narrow Complexity low Not much overhead for framing and synchronization FDMA devices need duplexers Requires tight filtering to minimize influence of adjacent channel 24 12
CDMA code Channel N orthogonal or approximately orthogonal codes... Channel 3 Channel 2 Channel 1 frequency time 25 CDMA /TDD code Uplink downlink Channel N Channel N...... Channel 3 Channel 2 Channel 1 Channel 3 Channel 2 Channel 1 time frequency 26 13
CDMA /FDD code Uplink downlink Channel N Channel N...... Channel 3 Channel 2 Channel 1 Channel 3 Channel 2 Channel 1 frequency time 27 CDMA: DSSS Direct Sequence Spread Spectrum (DSSS) x Modulation Carrier frequency channel Demodulation x Codeword Codeword 28 14
CDMA: FHSS Frequency Hopping Spread Spectrum (FHSS) Data Modulation at fh channel Demodulation Data Codeword 1 Define carrier fh Define carrier fh Codeword 1 29 CDMA Transmission bandwidth several order of magnitude higher than minimum required RF bandwidth Pseudo Noise is used to convert a narrow band signal into a wideband signal Main types: Frequency hopping spread spectrum (FHSS) Direct sequence spread spectrum (DSSS) 30 15
CDMA (features) Many users share same frequency-band at the same time TDD or FDD may be used CDMA has a soft capacity limit Increasing number of users increase the noise floor Channel data rates are very high Self jamming (PN sequences are not exactly orthogonal) Hybrid technologies are possible 31 SDMA Wireless SDMA: Space division multiple access Serving users by spot-beam antennas Wired Star-topology with differtnt cables 32 16
TDMA (1) Time Slots code... Channel N Channel 3 Channel 2 Channel 1 frequency time In each time slot one user is allowed to transmit Transmission: buffer and burst 33 TDMA (2) TDMA / FDD Uplink code downlink Time Slots... Channel N Channel 3 Channel 2 Channel 1... Channel N Channel 3 Channel 2 Channel 1 time frequency 34 17
TDMA (3) TDMA shares a single frequency-band with several users (wireless and wired). Data transmission is not continuous Different Time-Slots for transmission and reception TDMA/FDD: Different TDMA frames for each direction (frequency) High synchronisation overhead 35 Content Introduction La 2: Frames Error Handling Media Access Control General approaches and terms Network Topologies Media Access Principles (Random) Aloha Principles CSMA, CSMA/CD, CSMA / CA Media Access Principles i ( Deterministic) i i Master-Slave Approaches (Polling) Token based solutions Time based solutions 36 18
Principles for media access control access communication media deterministic random Central control decentral control No collission collission 37 Random Access Technologies Access ist based on random principles Often a Broadcast environment, were each node in the network can receive the message Aim: only one node shall transmit otherwise a collision will destroy the message 38 19
ALOHA Pure ALOHA Started for a wireless approach (1970, University of Hawaii) If you have data to send, than send If messages collides with another message, than send later again (wait a random time) collision Re-scheduled Problem: maximum throughput 18.4 % 39 ALOHA Slotted ALOHA Time is divided in equal time slots greater than packet duration Systems are synchronized Transmission only at the beginning of a time slot collision Re-scheduled Today used on low bandwidth tactical Satellite communications networks by the US Military, subscriber based Satellite communications networks, and contactless RFID technologies. maximal Throughput: 36,8 % 40 20
CSMA CSMA: carrier sense multiple access Listen to the channel, before transmitting If channel is free (no carrier detected) than transmit Propagation delay and detection delay are important parameters There exist several variation CSMA /CD (e.g. Ethernet) CSMA/CA (e.g. WLAN) CSMA/BA (e.g. CAN) 41 CSMA/CD (Ethernet) 42 Used on shared Coax-Cable Main procedure 10 Base T (Hubs produce jam signal) Frame ready for transmission. Is medium idle? If not, wait until it becomes ready and wait the interframe gap period (9.6 µs in 10 Mbit/s Ethernet). Start transmitting. Did a collision occur? If so, go to collision detected procedure. Reset retransmission counters and end frame transmission. Collision detected procedure Continue transmission until minimum packet time is reached (jam signal) to ensure that all receivers detect the collision. Increment retransmission counter. Was the maximum number of transmission attempts reached? If so, abort transmission. Calculate and wait random backoff period based on number of collisions. Re-enter main procedure at stage 1. 21
CSMA /CA DCF (Wireless LAN, IEEE 802.11) 43 Distributed coordination function CSMA/CA (collision avoidance) Wait until the channel is free (more useres would start at the same time) Wait a random time (number of slots) before start to transmit. If still free than transmit optional virtual carrier sense mechanism that exchanges short Request-to-send (RTS) and Clear-to-send (CTS) frames between source and destination during the intervals between the data frame transmissions. includes a positive acknowledge scheme. Wireless problems: Collision detection is not possible (no transmit and receive at the same time Hidden Node Problem CSMA / BA CAN Simultaneous access and Bit Arbitration Transmission is organised by priorities Needs dominant and recessive state on the channel tranmitted and received values has must me accessed at the same time. 44 22
CSMA/BA CAN Basic Concepts (3) Consumer Producer Consumer Consumer CAN Node 1 CAN Node 2 CAN Node 3 CAN Node 4 Local intelligence Local intelligence Local intelligence Local intelligence Frame 2 Filter Frame 1 Filter Filter Frame 3 Filter Bus lines Bit rate May be different in different systems, but uniform and fixed in one system Multiple Bus Access When bus is free any node may start to transmit a message. Highest priority will win Broadcast-Communication in the Network 45 Basic Concepts (5) Single channel Single bi-directional channel, that carries bits Resynchronization information can be derived Different physical implementation ti are allowed Bus values The Bus has two complementary values: dominant or recessive physical la (e.g. optical) dominant recessive dominant Node 1 Node 2 Node 2 46 23
Dominant Values 5V Pegel S1 0 1 0 1 0 1 0 1 S2 0 0 1 1 0 0 1 1 S3 0 0 0 0 1 1 1 1 Bus 0 0 0 0 0 0 0 1 Busleitung S1 E1 S2 E2 S3 E3 47 CAN- Data Frame (2) Arbitration (2) Arbitration Field Identifier SOF RTR 10 9 8 7 6 5 4 3 2 1 0 Control Node 1 Node 2 Node 3 Bus 48 24
CAN- Data Frame (2) Arbitration (3) Node wants to transmit a message Wait until End of Intermission Field End of Intermissions field (Bus idle) Message received Send SOF Next Bit time Send next arbitration Bit Mode Receive Lost Arbitration (send recessive, received dominant) Bus level = send level Compare: bus level with send level Arbitration done Error-mode send dominant, received recessive Send control and data-field 49 25