Friday, May 15, 2009


Here I have found a good introduction to the CAN bus.
It is a link level protocol, similar to ethernet, with CDMA (Collision Detect, Multiple Access) policy.
Every CAN bus peripheral can receive and send data on the same bus and has the capabilities to recognize where someone else is using the bus at the same time. A priority mechanism ensures that in this case only one transmission is completed.
Unlike ethernet, this protocol is content oriented, that means the each message does not have destination and source fields, but just an identifier that specifies the meaning of the data associated to the message. The meaning of the identifier is not specified in this standard as it is choosen by higher level applications.

Each message consists of an identifier, some flags and crc and the payload.
The identifier is 11bit wide in CAN bus version 2.0A and 29bits wide in version 2.0B

There are four different message types:
  • Data frame: a frame containing node data for transmission
  • Remote frame: a frame requesting the transmission of a specific identifier
  • Error frame: a frame transmitted by any node detecting an error
  • Overload frame: a frame to inject a delay between data and/or remote frames
The arbitration on the bus is based on the identifier. As the bus is AND wired, each time two components send a signal on the bus, the result on the bus is the logical AND between the two signals. This means that when collision happen, only one of the identifiers of the messages gets trasmitted to the bus (the one with most zeros); the transmitter can simultaneously read what is on the bus and if the identifier coincides they proceed to transmit the complete message.

This info on Wikipedia will probably be very useful to get data structures written in C or any other language I might choose for this adventure.

No comments:

Post a Comment