Docstoc

Synchronization

Document Sample
Synchronization Powered By Docstoc
					     packet transmission


            A.J. Han Vinck

           January 19, 2010

Institute for Experimental Mathematics
            Ellernstrasse 29
        45326 Essen - Germany
     University Duisburg-Essen                       digital communications group



                                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 )

A.J. Han Vinck
     University Duisburg-Essen           digital communications group



                      Start of packets

                                  flag
         Flag              data


        1 0 1 1 0 1 0 1***


       Flag
                 may not occur in other positions
                 chosen according to some rule




A.J. Han Vinck
     University Duisburg-Essen                      digital communications group



                                  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>110  fixed
                       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 01k-1

     Homework: proof that this is a correct way



A.J. Han Vinck
     University Duisburg-Essen          digital communications group



                                 detection

• After k-1 1‘s check next bit(s)

          If 0 remove it (stuffed bit)
          If 10, end of frame marker (011...10)
          If 11, error detected ( k 1‘s not allowed )




A.J. Han Vinck
      University Duisburg-Essen            digital communications group



                        Some standards
CAN               after 00000 insert 1
                  after 11111 insert 0

HDLC              01111110 as flag
                  after 5 1‘s insert a 0

X25               111111 may not occur in frame
                  insert 0 after 5 1‘s

802.11            80 bits: 010101...
                  16 bits start of frame: 0000 1100 1011 1101



 A.J. Han Vinck
     University Duisburg-Essen   digital communications group



        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 Rmin  2N.

     Example: for N = 1024, K = 23; Rmin = 64

A.J. Han Vinck
     University Duisburg-Essen       digital communications group



                 Variable length packets

• Rule: stuffing only when necessary!

• For FLAG: 01k0 and Random data P(0) = P(1) = ½

    the redundancy R  k+2 + (N-(k+2)) / 2k is minimized

    for k  log2N  log2N + 1    stuff bits per packet!

    Ex: 01110|1011101011100|:= 01110|101101010110110|

Homework: use a Markov state diagram to find R

A.J. Han Vinck
         University Duisburg-Essen               digital communications group



             Calculations of average length

• Generate 0 and 1 with probability ½


                     1           1           1
             0               1           2            k-1


                         0           0            0


•    average redundancy = P(k-1)=1/(2k –1)

Very important for practical applications: how far away from optimal?


    A.J. Han Vinck
     University Duisburg-Essen          digital communications group



                           At receiver

• LOOK for FLAG in BITSTREAM

     – For fixed length: remove stuffed bits
     – For variable length, parse for 1k-10, remove the 0


     – due to transmission errors
          • Flag may appear in packet
          • Flag may disappear
          • CRC might be correct!



A.J. Han Vinck
     University Duisburg-Essen         digital communications group



       Synchronization with correlation

• Strategy: locate a flag in the data stream

     – Pass the received digits through a „correlator“



                             compare
                                            Test N positions
                            1110010
                                            One must be the correct one
–Example: ESA uses 11101011100100000



A.J. Han Vinck
     University Duisburg-Essen    digital communications group



                    What can happen?

• Errors may distroy the flag

     – 01111110  01101110

• Errors may cause a flag to appear in the packet
   – 01111100  01111110

• Errors may increase or decrease the packet length (this
  has a strong influence on the CRC)
   – 01111000  01111100  0111110               -1
   – 01111100  01011100                         +1


A.J. Han Vinck
         University Duisburg-Essen            digital communications group



                                     A rule

Packets consist of : k+2 flag-digits and N-(k+2) random data

RULE: -for N subsequent possible starting positions,

           find the position m = u; 1  u  N which maximizes

           the number of agreements with the flag




    A.J. Han Vinck
        University Duisburg-Essen               digital communications group



                               An example:
• Calculate # of agreements = minimize Hamming distance

   Example: Barker 7 = 1110010
     + + 1 1 1 0 0 1 0 + + + + worst case   best case
         1110010                    7            7
           1110010                  4            3        Best position
             111 0010               4            2
               11 10010             5            2
                    1 110010        5            1
                    etc


   In sync we expect k+2 agreements; out-of-sync we expect (k+2)/2 agreements


   A.J. Han Vinck
     University Duisburg-Essen                 digital communications group



                         Barker codes
      length
      2          10                            Property:
      3          110                           Barker codes exist of lengths
                                               2, 3, 4, 5, 7, 11, and 13.
      4          1011
                                         .
      5          11101
      7          1110010
      11         11100010010                 1 1 1 0 0 1 0                     7
      13         1111100110101                 1 1 1 0 0 1 0                   0
                                                 1 1 1 0 0 1 0                 1
                                                   1 1 1 0 0 1 0               0
                                                     1 1 1 0 0 1 0             1
                                                        1 1 1 0 0 1 0          0
                                                           1 1 1 0 0 1 0       1

A.J. Han Vinck                   |# of agreements - # disagreements|  1
     University Duisburg-Essen                digital communications group

          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.




A.J. Han Vinck
      University Duisburg-Essen                     digital communications group
                           HDLC Byte Stuffing


             DLE       STX        Transparent Data              DLE      ETX

                                          Before


        DLE       STX        A       B      DLE           H       W      DLE       ETX

                                          Stuffed


DLE      STX       A         B     DLE DLE                H       W      DLE       ETX

                                         Unstuffed


         DLE      STX        A       B       DLE           H       W      DLE      ETX

 A.J. Han Vinck
     University Duisburg-Essen                        digital communications group



                       ppp stuffing example
        PPP is character-oriented version of HDLC
        ����   Flag is                0x7E (01111110)
        ����   Control escape         0x7D (01111101)
        ����   replace
                           0x7E ���� by        0x7D 0x5E
                           0x7D ���� by        0x7D 0x5D

      Example:         Data to be sent
                                            41 7D 42 7E 50 70 46
                       After stuffing and framing
                                         7E 41 7D 5D 42 7D 5E 50 70 46 7E


      PPP also provides the framing in Packet-over-SONET

A.J. Han Vinck
     University Duisburg-Essen       digital communications group



                            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




A.J. Han Vinck
     University Duisburg-Essen          digital communications group



                    Comma free codes

• A set code words is called comma-free if for every pair


     C = (c0,c1,,cN-1 ) and C‘ = (c‘0,c‘1, ,c‘N-1)

     the N tuple


                   (ci,,cN-1,c‘0,  c‘i-1)

     is not a code word for any 1  i  N-1

A.J. Han Vinck
     University Duisburg-Essen       digital communications group



                  Example Comma free

{ 00001 00101 00110 11001 11010 11110 }

    A concatenation is uniquely decodable!



    Thus  010010100110110011101011110 

    is decoded as

             01,00101,00110,11001,11010,11110 


A.J. Han Vinck
           University Duisburg-Essen            digital communications group



                       Comma free: efficiency

•   The # of code words in a comma free code of length N

    – M  2N/N

    Reason:                every code word eliminates (N-1) shifts

       example for two shifted codewords: 010011 and 100110
         the two codewords         100110-100110
        can be synchronized as          0-10011

    Redundancy:             R  log2N     (look at variable stuffing)


    Check!


      A.J. Han Vinck
     University Duisburg-Essen         digital communications group



                                 Packets

• Synchronous arrivals:
     – accuracy in clock 0.0000001% (may be atom-clock)


• A-synchronous arrivals:
     – clock derived from received signals
         • needs special regeneration of clock




A.J. Han Vinck
     University Duisburg-Essen         digital communications group



    Asynchronous Transmission (example)




   •overhead is 20% ;(8 bits of data, 2 bits for start/stop)

A.J. Han Vinck
     University Duisburg-Essen       digital communications group



             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. 1010101010 before start
  of packet

A.J. Han Vinck
     University Duisburg-Essen               digital communications group



                 Ethernet/IEEE 802.3


 Bytes     7                 1   2/6   2/6      2      46-1500              4
 field Preamble            SFD DA      SA      L       Data             FCS

Preamble: 56 bits alternating 10 used to synchronize the receiver
SFD:      Start Frame Delimiter. 10101011 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


A.J. Han Vinck

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:0
posted:4/6/2013
language:Unknown
pages:26
dominic.cecilia dominic.cecilia http://
About