Wednesday 8 November 2017

CAN FAQ

Bus Arbitration And Message Priority

Any CAN controller may start a transmission when it has detected an idle bus.This may result in two or more controllers starting a message (almost) at the same time. The conflict is resolved in the following way.

The transmitting nodes monitor the bus while they are sending. If a node detects a dominant level when it is sending a recessive level itself, it will immediately quit the arbitration process and become a receiver instead. exactly one transmitter is left on the bus.

An important condition for this bit-wise arbitration to succeed is that no two nodes may transmit the same Arbitration Field. There is one exception to this rule: if the message contains no data, then any node may transmit that message.

What happens if a node is alone on the bus and tries to transmit?
A: The node will, of course, win the arbitration and happily proceeds with the message transmission. But when the time comes for acknowledging… no node will send a dominant bit during the ACK slot, so the transmitter will sense an ACK error, send an error flag, increase its transmit error counter by 8 and start a retransmission. This will happen 16 times; then the transmitter will go error passive. By a special rule in the error confinement algorithm, the transmit error counter is not further increased if the node is error passive and the error is an ACK error. So the node will continue to transmit forever, at least until someone acknowledges the message

Message Addressing And Identification


 In fact, there is no notion of message addresses in CAN. Instead, the contents of the messages is identified by an identifier which is present somewhere in the message. CAN messages are said to be “contents-addressed”.

All CAN controllers will also use the whole (some will use just a part) of the Arbitration Field as a key in the hardware filtration process.

The CAN Bus

There are two different signaling states: dominant (logically 0) and recessive (logically 1). These correspond to certain electrical levels which depend on the physical layer used (there are several.) The modules are connected to the bus in a wired-and fashion: if just one node is driving the bus to the dominant state, then the whole bus is in that state regardless of the number of nodes transmitting a recessive state.

Maximum Bus Speed

The maximum speed of a CAN bus, according to the standard, is 1 Mbit/second. Some CAN controllers will nevertheless handle higher speeds than 1Mbit/s and may be considered for special applications.
Low-speed CAN  can go up to 125 kbit/s.
Single-wire CAN can go up to around 50 kbit/s in its standard mode and, using a special high-speed mode used e.g. for ECU programming, up to around 100 kbit/s.

CAN connectors

There is no standard at all for CAN bus connectors! Usually, each Higher Layer Protocol(!) defines one or a few preferred connector types. Common types include
  • 9-pin DSUB, proposed by CiA.(Indestrial standard)
  • 1 - Reserved
    2 CAN_L CAN_L bus line (dominant low)
    3 CAN_GND CAN Ground
    4 - Reserved
    5 (CAN_SHLD) Optional CAN shield
    6 (GND) Optional CAN ground
    7 CAN_H CAN_H bus line (dominant high)
    8 - Reserved (error line)
    9 CAN_V+ Optional power
  • 5-pin Mini-C and/or Micro-C, used by DeviceNet and SDS.
  • 6-pin Deutch connector, proposed by CANHUG for mobile hydraulics.

Error Detection Mechanisms:


  1. Bit Monitoring.
  2. Bit Stuffing.: When five consecutive bits of the same level have been transmitted by a node, it will add a sixth bit of the opposite level to the outgoing bit stream. The receivers will remove this extra bit. if more than five consecutive bits of the same level occurs on the bus, a Stuff Error is signaled.
  3. Frame Check: If a CAN controller detects an invalid value in one of these fixed fields, a Form Error is signaled.
  4. Acknowledgement Check: The transmitter will transmit a recessive level here. If the transmitter can’t detect a dominant level in the ACK slot, an Acknowledgement Error is signaled.
  5. Cyclic Redundancy Check:

No comments:

Post a Comment