Institute for Experimental Mathematics Ellernstrasse Essen - Germany packet transmission A.J. Han Vinck January 19, 2010
University Duisburg-Essendigital communications group A.J. Han Vinck Packets (1) Information is often transmitted in packets –Fixed or variable length bursty continuous Important to know time interval : – for an information symbol on bit level – for an information symbol on character level – block or message level (start of frame or packet )
University Duisburg-Essendigital communications group A.J. Han Vinck Start of packets flag Flag data * * * Flag may not may not occur in other positions chosen according to some rule
University Duisburg-Essendigital communications group A.J. Han Vinck Bit stuffing Avoid flag in the packet: –Insert stuffing bit at fixed positions in packet –Insert stuffing bit if necessary only k+2 Example:01110>101>0>111>1>000>0>110fixed 01110>1011>0>11>0>00011>0>0 variable Fixed: after every k data bits insert stuffing bit Redundancy = 1/(k+1) Variable: After observing 011 insert 0 In general, insert 0 after observing 01 k-1 Homework: proof that this is a correct way
University Duisburg-Essendigital communications group A.J. Han Vinck detection After k-1 1‘s check next bit(s) If 0 remove it (stuffed bit) If 10, end of frame marker ( ) If 11, error detected ( k 1‘s not allowed )
University Duisburg-Essendigital communications group A.J. Han Vinck Some standards CANafter insert 1 after insert 0 HDLC as flag after 5 1‘s insert a 0 X may not occur in frame insert 0 after 5 1‘s bits: bits start of frame:
University Duisburg-Essendigital communications group A.J. Han Vinck Efficiency fixed length packets Packet of length N has –k+2 + (N-(k+2))/(k+1) stuffing bits Minimizing with respect to redundancy gives k N, minimum redundancy R min 2 N. Example: for N = 1024, K = 23; R min = 64
University Duisburg-Essendigital communications group A.J. Han Vinck Variable length packets Rule: stuffing only when necessary! For FLAG: 01 k 0 and Random data P(0) = P(1) = ½ the redundancy R k+2 + (N-(k+2)) / 2 k is minimized for k log 2 N log 2 N + 1 stuff bits per packet! 00 Ex: 01110| |:= 01110| | Homework: use a Markov state diagram to find R
University Duisburg-Essendigital communications group A.J. Han Vinck Calculations of average length Generate 0 and 1 with probability ½ average redundancy = P(k-1)=1/(2 k –1) Very important for practical applications: how far away from optimal? k-1
University Duisburg-Essendigital communications group A.J. Han Vinck At receiver LOOK for FLAG in BITSTREAM –For fixed length: remove stuffed bits –For variable length, parse for 1 k-1 0, remove the 0 –due to transmission errors Flag may appear in packet Flag may disappear CRC might be correct!
University Duisburg-Essendigital communications group A.J. Han Vinck Synchronization with correlation Strategy: locate a flag in the data stream –Pass the received digits through a „correlator“ compare –Example: ESA uses Test N positions One must be the correct one
University Duisburg-Essendigital communications group A.J. Han Vinck What can happen? Errors may distroy the flag – Errors may cause a flag to appear in the packet – Errors may increase or decrease the packet length (this has a strong influence on the CRC) – –
University Duisburg-Essendigital communications group A.J. Han Vinck A rule Packets consist of : k+2 flag-digits and N-(k+2) random data RULE RULE: -for N subsequent possible starting positions, find the position m = u; 1 u N which maximizes the number of agreements with the flag
University Duisburg-Essendigital communications group A.J. Han Vinck An example: Calculate # of agreements = minimize Hamming distance Example:Barker 7 = worst case best case etc In sync we expect k+2 agreements; out-of-sync we expect (k+2)/2 agreements Best position
University Duisburg-Essendigital communications group A.J. Han Vinck Barker codes exist of lengths 2, 3, 4, 5, 7, 11, and 13. Barker codes length Property:. |# of agreements - # disagreements|
University Duisburg-Essendigital communications group A.J. Han Vinck Byte or character Stuffing [HDLC Example] ASCII characters are used as framing delimiters (e.g. DLE STX and DLE ETX) The problem occurs when these character patterns occur within the “transparent” data. Solution: sender stuffs an extra DLE into the data stream just before each occurrence of an “accidental” DLE in the data stream.
University Duisburg-Essendigital communications group A.J. Han Vinck HDLC Byte Stuffing DLESTXDLEETXTransparent Data DLESTXDLEETXABDLEHW STXDLEETXABDLEHW STXDLEETXABDLEHW Stuffed Unstuffed Before
University Duisburg-Essendigital communications group A.J. Han Vinck ppp stuffing example Example: Data to be sent 41 7D 42 7E After stuffing and framing 7E 41 7D 5D 42 7D 5E E PPP also provides the framing in Packet-over-SONET PPP is character-oriented version of HDLC Flag is 0x7E ( ) Control escape 0x7D ( ) replace 0x7E by0x7D 0x5E 0x7D by0x7D 0x5D
University Duisburg-Essendigital communications group A.J. Han Vinck Conclusion: Structure of flag is of great importance –Several classes designed: Barker, Gold, Kasami, etc flag should not appear in data – bit stuffing can be used
University Duisburg-Essendigital communications group A.J. Han Vinck Comma free codes A set code words is called comma-free if for every pair C = (c 0,c 1, ,c N-1 ) and C‘ = (c‘ 0,c‘ 1, ,c‘ N-1 ) the N tuple (c i, ,c N-1,c‘ 0, c‘ i-1 ) is not a code word for any 1 i N-1
University Duisburg-Essendigital communications group A.J. Han Vinck Example Comma free { } A concatenation is uniquely decodable! Thus is decoded as 01,00101,00110,11001,11010,11110
University Duisburg-Essendigital communications group A.J. Han Vinck Comma free: efficiency The # of code words in a comma free code of length N –M 2 N /N Reason: every code word eliminates (N-1) shifts example for two shifted codewords: and the two codewords can be synchronized as Redundancy: R log 2 N (look at variable stuffing) Check!
University Duisburg-Essendigital communications group A.J. Han Vinck Packets Synchronous arrivals: –accuracy in clock % (may be atom-clock) A-synchronous arrivals: –clock derived from received signals needs special regeneration of clock
University Duisburg-Essendigital communications group A.J. Han Vinck Asynchronous Transmission (example) overhead is 20% ; (8 bits of data, 2 bits for start/stop)
University Duisburg-Essendigital communications group A.J. Han Vinck Support of timing recovery Use of special symbols, e.g. Manchester code 1 0 Prevent long runs of ones and zeros in data by precoding Insert preamble, e.g before start of packet
University Duisburg-Essendigital communications group A.J. Han Vinck Ethernet/IEEE /6 2/ Preamble SFD DA SA L Data FCS Bytes field Preamble: 56 bits alternating 10 used to synchronize the receiver SFD: Start Frame Delimiter to signal beginning of the transmission DA/SA: Destination and Source Addresses L: Length of the data part Data: Minimum length required for proper operation. Padding used if needed FCS: Extra bits appended for error checking: the CRC