Docstoc

3 The CAN Physical Layer

Document Sample
3 The CAN Physical Layer Powered By Docstoc
					3 The CAN Physical Layer
• the physical layer described in the
  reference document and in the ISO
  (International Standards Organization)
  standard,
• the properties of the bit,
• the types and structures of networks,
• the problems of signal propagation,
  distance and bit rate.
          3.1 Introduction
• What is the actual speed of the bit?
• At what moment can we say that it is a '1'
  or a '0'?
• What is the best physical medium for the
  protocol transport?
• Are ordinary wires good enough for
  carrying the data?
• Are optical fibres a 'must'?
          3.1 Introduction
• What is the optimum bit rate for a given
  application?
• What maximum operating distance can we
  expect?
• Are there one or more standard socket(s)?
• How do we 'drive' the line?
• How do we protect the line?
 3.1.1 The CAN and ISO physical
             layer
• CAN users often depict the physical layer in an
  (over-)simplified way, talking about its 'line'
  aspect only, because this is the feature we first
  notice.
• The ISO has issued documents describing the
  standardization of the data link layers and
  physical layers for specific applications
• These documents describe the CAN architecture
  in terms of hierarchical layers, according to the
  definitions of the 'Open Systems Interconnection
  (OSI) base reference model'
• Data link layer (layer 2), DLL,
• Logical link control sublayer, LLC,
• Medium access control sublayer, MAC, described in the
  preceding chapters, and
• Physical layer (layer 1), PL:
   -Physical signalling sublayer, PLS (bit coding, bit timing,
  synchronization),
   -Physical medium attachment sublayer, PMA
  (characteristics of the command stages (drivers) and
  reception stages),
   -Medium dependent interface sublayer, MDI
  (connectors);
• Transmission medium:
   -bus cable,
   -bus termination networks.
3.1.2 Basic and specific qualities
required in the physical support
           to be used
• the type of physical support used to carry the
  CAN frames is not explicitly defined
• medium in the CAN protocol (for example: wire, RF, IR,
   optical fibres, visible light, arm signals, semaphore,
   telegraph or maybe smoke signals)
• the chosen medium must conform to the CAN structure
   and architecture by
 - being capable of representing bits having dominant and
   recessive states on the transmission medium;
 - being in the recessive stage when a node sends a
   recessive bit or when no nodes are transmitting;
 - supporting the 'wired and' function, simply as a result of
   its implementation;
 - being in the dominant state if any of the nodes sends a
   dominant bit, thus suppressing the recessive bit.
          3.2 The 'CAN Bit'
• OSI concerned with the 'specification of
  the physical signalling sublayer' (PLS).
• consideration of the problems of the bit
  (coding, duration, synchronization, etc.)
  and the 'gross' and 'net' bit rates of the
  network.
  3.2.1 Coding of the CAN bit
• the bit is coded according to the non return
  to zero (NRZ) principle
                  3.2.2 Bit time
• The period of time for which the bit is actually present on
   the bus is called the bit time, tb.
• The bus management functions are responsible for
   managing the CAN protocol:
 - carried out within the period of duration of the bit (tb, or
   'bit time frame')
 - including the synchronization constraints of the stations
   present on the network,
 - compensation of propagation delays,
 - definition of the exact position of the sample point
• The bus management functions are defined by a bit
   timing programmable logic circuits.
        3.2.3 Nominal bit time
• The nominal bit time is identical to the nominal duration
  of a bit.
• By its nature, this value can only be an ideal and
  theoretical one.
• Each station in the network must be designed so that it
  'nominally' has this bit time tb,
• because of the real components (oscillators, tolerances,
  temperature and time fluctuations, etc.), the
  instantaneous value of the bit will never be the nominal
  value at any instant
• The nominal bit time is normally constructed from a
  specified number of 'system' cycle pulses, based on
  what should form the internal clock of each station.
• The official CAN protocol document indicates
  that the nominal bit time is divided into a number
  of time segments that cannot overlap.
• the synchronization segment,
• the propagation time segment,
• segment 1, called 'phase buffer 1',
• segment 2, called 'phase buffer 2'.
   Synchronization segment
• The 'synchronization segment' is the part
  of the bit time used to synchronize the
  various nodes present on the bus. By
  definition, the leading edge of an incoming
  bit should appear within this time segment.
  The propagation time segment
• This part of the nominal bit time is designed to
  allow for and compensate the delay time(s) due
  to the physical phenomenon of propagation of
  the signal on the medium used and the types of
  topology used to develop the geometrical
  configuration (topology) of networks.
• this value is approximately a time equal to twice
  (outgoing and return) the sum of the propagation
  times present due to the medium and the delays
  caused by the input and output stages of the
  participants which are also connected to the bus
 Phase buffer segments 1 and 2
• This pair of phase buffers1 (phase buffer
  segments 1 and 2) is used to compensate
  for the variations, errors or changes in the
  phase and/or position of the edges of the
  signals which may occur during an
  exchange on the medium
• These two segments are designed to be
  either extended or shortened by the
  resynchronization mechanism
3.2.4 Sampling, sample point and
         bit processing
• There is no point in carrying data unless they
  are to be correctly received, read and
  interpreted.
• define the precise instant when the incoming bit
  on the bus is sampled and is consequently read
  and interpreted and has its value defined.
• This instant - the 'sample point' - must occur not
  too soon and not too late during the period of
  duration of the bit.
• in order to overcome the constraints of the fundamental
  principles of the protocol (arbitration and
  acknowledgement phases), the problems due to the
  deformation of the signal representing the bit and delays
  due to the phenomena of signal propagation on the
  medium, the value of the bit should be read and
  interpreted as late as possible in the bit time to give us
  the maximum confidence in this value;
• not wait for the very last moment, for at least two
  reasons: firstly, because all the tolerances allowed for in
  the establishment of the bit time must be taken into
  account, and, secondly, because of the time required for
  calculating the value of the bit when it is sampled.
• the bit sampling should take place towards the end of the
  period of duration of the bit
• the 'sample point' - forms, by definition, the exact
  boundary between phase buffer segment 1 and
  phase buffer segment 2.
• A start of frame (SOF) obliges all the controllers
  present on the bus to carry out a 'hardware
  synchronization' on the first change from a
  recessive to a dominant level
• allow for any arbitration phases during which
  several controllers can transmit simultaneously.
• it is also necessary to include additional
  synchronization time buffers located on either
  side of this instant (phase buffers 1 and 2)
• a time buffer segment positioned after the
  sampling point, with the purpose of participating
  in any necessary (re)synchronization of the bit
• information processing time: located and starting
  immediately after the sample point is necessary
  for the calculation of the value of the bit
• bit calculation. To improve the quality of the
  capture and validation of the bit, it has always
  been permissible to carry out digital filtering by
  sampling the bit value several times following
  the sample point instant.
• SJA 1000: carry out a 'multiple sampling' of the
  bit value an odd number of times (3)
        3.3 Nominal Bit Time
• Each of these segments plays its part in
  determining the quality, the bit rate, the length,
  etc., of a CAN network
• showing how the bit time is made up,
• describing the role of the different segments,
• explaining how they are interwoven,
• and, finally, describing a way of determining
  their values in an example of application.
3.3.1 Constructing the bit time
• The nominal bit time of a CAN network is fixed
  and specified for a project, and each station
  must be able to construct its own nominal bit
  time locally using its own resources.
• Each local division of nominal bit time can be
  structurally different from one station to another.
• minimum time quantum: the definition of the
  base for the construction of the bit time of a local
  station as the smallest reference time element
  usable by this station
   Minimum time quantum of a
            station
• The minimum time quantum is generally
  derived from the station's clock
 Time quantum of the bit time
• The time quantum is a fixed unit of time, derived
  and obtained from the minimum time quantum
  from which the CAN bit is to be constructed.
• The actual construction of this time unit is
  carried out with the aid of programmable (pre-
  )dividers (by integers m), whose division range
  must extend from 1 to 32.
• Time quantum = m x Minimum time quantum
   where m is the division factor of the (pre-)divider.
    3.3.2 Dividing the bit time
• the values defined by the CAN protocol.
• Synchronization segment Propagation: 1 time quantum
  (this value is fixed)
• Propagation time segment: from 1 to 8 time quanta
• Segment 1 of the phase buffer: from 1 to 8 time quanta
• Information processing time : <2 time quanta
• Segment 2 of the phase buffer: equal to not more than
  the value of segment 1 + Information processing time
• The total number of time quanta cannot be less than 8 or
  more than 25
• SJA 1000 protocol: define a new time 'segment'
  - time segment 1 (TSEG 1) - characterizing the
  set of segments compensating for the
  'propagation times' and the synchronization
  buffer 'phase segment 1'- of the CAN protocol
• It is important for the oscillators of the different
  ECUs to be 'coordinated' or 'harmonized', so as
  to provide the system with a time quantum
  specified in the best possible way.
3.3.3 The sequence of events
• Our four segments are now in place, and
  we need only to define the number of
  quanta assigned to the propagation
  segments and to phase buffers 1 and 2.
• Synchronization segment
• The duration of this segment is no problem;
  it is permanently fixed at 1 quantum.
     The so-called propagation
             segment
• the medium (and its choice),
• the propagation speed of the signal on this
  medium,
• the maximum length of the network (medium),
• the topology of the network,
• the electrical input/output parameters of the line
  interface components,
• the quality of the received signals, etc.
• All these parameters are based on concepts of
  the medium, topology, etc.
    Buffer segments 1 and 2
• The parameters used to determine the value of
  this segment:
• the nominal values of the clock frequencies of
  each node,
• the tolerances of these clocks,
• the temperature and time fluctuations of these
  clocks,
• the worst cases, etc.
• All these parameters affect the capacity to
  successfully synchronize or resynchronize the
  stream of incoming bits
3.4 CAN and Signal Propagation
• Whole volumes have been written on network
  theory.
• My aim is not to reproduce these but to cast
  some light on the properties of the CAN protocol
  in its applications to local networks.
• The concept of a network implies structure,
  topology and medium.
• We cannot diverge from these major standards
  and the commentaries on them.
3.4.1 Network type, topology and
           structure
• Regardless of the types of medium used
  to create networks, their topologies are
  largely dictated by the possibilities of the
  data transport protocol.
• In the case we have been describing over
  many pages, the topology can be varied,
  and I will give some examples.
                  Bus
• The 'bus' is the easiest topology to
  implement and the most widespread for
  this kind of protocol.
• the 'backbone' type: problems may arise unless
  you are careful and that you should think in
  terms of electrical lines with allowance for 'stubs'
  connected to these lines.
• for a bit rate (NRZ coded 'square' signal wave)
  of 1 Mbits-1 (i.e. an equivalent frequency of 500
  kHz for square signals), propagated for example
  in a differential pair at 200,000 km s-1, the
  fundamental (sinusoidal) frequency of the wave
  would be a wavelength of



• the other wavelengths of the base signal would
  be 400/3 m, 400/5 m and 400/7 m, i.e.
  approximately 133 m, 80 m and 56 m, which is
  often very short!
• recommendations for the CAN low speed
  mode (less than 125 kbit s-1) and CAN
  high speed mode (more than 125 kbit s-1
  and up to 1 Mbit s-1).
• operate on the boundary of the two modes:
  a kind of 'medium speed' (a non-standard
  term, invented for this occasion) of
  approximately 250 kbit s-1.
                   Star
• a network or partial network takes the
  topological form of a star
                          Ring
• When systems are required to have greater operating
  security and/or reliability in case of mechanical failure of
  the network, the bus between two or more stations is
  frequently doubled, or split
• it necessary to examine carefully the estimation and
  management of propagation time, especially for the
  resolution of the problem of the 'bit' arbitration phase.
         3.4.2 Propagation time
• If a line exists, there is
• a phenomenon of signal propagation on the line, a
  propagation speed, a delay due to the time taken for the
  propagation of the signal on the medium,
• a characteristic impedance, an impedance match,
  tnodes and antinodes, standing waves, line-termination
  rebound and possible collisions on the bus between
  incoming signals and reflected signals, etc.
• the choice of medium (for reasons of cost, EMC
  compatibility, etc.),
• the propagation speed of the signal in the chosen
  medium,
• the length of the medium (for application-specific
  reasons),
• the internal delay times of the transmission and
  reception circuit components.
3.4.3 Estimating the value of the
      propagation segment
• in the worst case, taking into account the paths
  followed, the signal propagation delays and the
  tolerances and fluctuations of the oscillators of
  each participant.
• In a single network, the longest distance
  between two CAN controllers determines the
  maximum 'outgoing' propagation delay time.
• to ensure the correct operation of the protocol
  during the arbitration and acknowledgement
  phases, a longer time interval must be provided
  to compensate for the total propagation delay
  times having an effect on an exchange on the
  network.
• total time represents the maximum necessary
  'propagation time' taken by the signal to travel
  from one controller to another and back again
•   A recessive bit is sent by node A, for example.
•   The signal from node A is propagated towards node B.
•   Some 'micro-instants' before the signal reaches its
    destination, node B, which has not yet noticed the
    presence of the incoming bit from A, starts to send a
    dominant bit, for example.
•   The signal sent from B is propagated towards A.
•   The collision occurs at a point very near B and makes
    the state of the line dominant (and wired) at this point.
•   The resulting signal (dominant) is then propagated
    towards A, taking a certain time, approximately equal
    to the time taken to travel from A, to arrive.
•   Station A, receiving a dominant bit while it is sending a
    recessive bit, can then determine, according to its
    instantaneous state, whether this represents a loss of
    arbitration for it (if the bit that it sent formed part of the
    identifier) or a bit error, etc.
   3.4.4 Precise definition of the
    propagation segment time
• for a given medium, the time interval to be
  assigned to the CAN bit propagation segment
  plays a considerable part in the evaluation of the
  maximum length of the network and vice versa
• To precisely define the minimum period to be
  assigned to the propagation segment
  (segTprop), we must consider the totality of the
  time contributions of all the elements in the
  network
• the delay time required by the transmission
  controller to output the signal on its terminals;
• the delay time required by the transmission
  interface to generate the signal on the medium;
• the time taken to transport the signal along the
  medium;
• the time taken by the reception interface for
  transferring the signal to the reception controller;
• the time taken by the reception controller to
  process the incoming signal.
• These parameters are frequently divided
  into two classes: those relating more
  specifically to the physical properties of
  the medium used (Tmed) and those
  concerned with the electronic
  characteristics found in the network (Telec)
• The sum of these two components (Tres)
  characterizes the total time taken by a bit
  to actually move from one station to the
  other
• Tmed represents the time required for transporting the
  signal along the medium, in the case of the greatest
  distance between two CAN controllers in the network.
• If we call this speed vprop, and if the length of the
  medium is L, this time will be
• a differential pair, the propagation speed is substantially
  equal to 0.2 mns-1, i.e. 200 m μs-1 (or, to put it another
  way, the medium has a propagation time of 5 ns m-1)
• Telec: This time interval is made up of three elements.
• Tsd represents the sum of the delay times due to the
  signal processing carried out in the output stages (on
  departure) and input stages (on arrival) of the CAN
  controllers of the departure and arrival stations.
• Ttx represents the delay time required by the
  transmission interface to generate the signal on the bus.
• Trx represents the time taken by the reception line
  interface to transfer the signal to the reception controller.
• T qual_sign: At the receiver, the input interface
  of an integrated circuit generally consists of a
  differential amplifier, provided, followed or
  associated with a comparator.
• this comparator has its own threshold and
  hyster-esis characteristics.
• These elements, plotted as voltages, must be
  translated into 'equivalent times' (Figure 3.14)
  according to the shape and quality of the
  incoming signals
• the asymmetry between the 'rise time' and the 'decay
  time remind you two problems which are sometimes
  completely distinct.
• These new electrical 'delay times' (Tqua]_sign) can
  then be considered equivalent to propagation or
  supplementary distances of the medium.
• In view of all these factors, the overall value of
  Telec can be fairly well estimated at about a 100
  ns.
• the required minimum total value for the duration
  of the 'propagation time segment':
• (segT-prop)min≧ 2(Tmed + TSd + Ttx + Trx + Tqual_Sign)
• When this value has been determined, it is easy
  to determine the minimum number of time
  quanta required to construct the 'propagation
  segment' (from 1 to 8) of the nominal bit time.
3.4.5 Corollaries: relations between
 the medium, bit rate and length of
            the network
• What is the maximum distance that can be
  covered by CAN for a bit rate X and a
  medium Y?
• What is the maximum bit rate that can be
  used for a network of length X using a
  medium Y?
           Maximum distance
• For a given bit rate and medium, CAN makes it clear that
  the distance between two nodes is largely dependent on
• the intrinsic propagation speed of the physical medium
  used to construct the line;
• the delay introduced by the output stage of the
  transmitting station;
• the delay introduced by the input stage of the receiving
  station;
• the desired nominal bit rate (and therefore the maximum
  value of the minimum duration of the propagation
  segment);
• the precise instant when the signal is sampled and the
  way in which the value of the bit is measured during its
  physical presence;
• the frequencies and tolerances of the various
  oscillators of the CAN controllers
  (micro-controllers or 'stand-alone' devices)
  present on the network;
• the quality of the signals, etc.
• 'The maximum distance of a CAN network is
  primarily determined by the time characteristics
  of the medium used and the consequences of
  the principle adopted for the operation of the
  arbitration procedure defined in the non-
  destructive protocol (at the bit level) present on
  the line (and see all the preceding sections)'.
 Relationship between bit rate
and maximum length for a given
           medium
• The value called the 'propagation time segment' of the
  nominal bit time of a CAN network must therefore be
  greater than (or at least equal to) approximately twice
  Tres:
• segT_prog ≧ 2 Tres
• If x is the percentage represented by this segment,
• segT_prog = x . Tbit
• Telec = 100 ns, vprop = 0.2 m ns-1 (wire and optical
  medium), x = 0.66 = 66%.
Example SJA 1000 circuit
      Bit rate   Maximum             Bus timing
                   distance     BTR0        BTR1
1.6 Mbit s-1           10m     00h                11h
1 Mbit s-1             40 m    00h                14h
500 kbit s-1          130 m    00h                1Ch
250 kbit s-1          270 m    01h                1Ch
125 kbit s-1          530 m    03h                1Ch
100 kbit s-1          620 m    43h                2Fh
50 kbit s-1           1.3 km   47h                2Fh
20 kbit s-1           3.3 km   53h                2Fh
10 kbit s-1           6.7 km   67h                2Fh
5 kbit s-1            10 km    7Fh                7Fh

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:4
posted:1/7/2012
language:English
pages:61
jianghongl jianghongl http://
About