CAN is a serial bus, where bus access is handled by priority. All nodes on the network have to be synchronized to sample or transmit the same bit of a message at the same time. The logical levels are achieved by a pull-up structure. Therefore the idle state of the bus is a logical '1'. Any node transmitting a logical '0' will pull the bus to another level (Ground). In CAN lingo these two levels are called recessive ('1') and dominant ('0').
Arbitration is achieved by using this bus condition. All nodes start by transmitting their UID and sample the bus at the same time. As soon as they discover that there is a bit on the bus on another level than they are transmitting, they stop the transmission. Finally only the node with the lowest ID will be left an can transmitt it's message undisturbed.
CAN usually uses four wires: CAN-Low, CAN-High, Ground and Power.
There exists a Base and an Extended Frame format.
|SOF||Start Of Frame||1|
|ID||Bus unique IDentifier used for arbitration||11|
|RTR||Remote Transmission Request||1|
|DLC||Data Length Code (0-8)||4|
|DATA||0-8 bytes according to DLC||0-64|
|CRC||Cyclic Redundancy Check||15|
|CRCdel||CRC delimiter (always recessive)||1|
|ACKslot||TX sends recessive, RX acknowledges with dominant||1|
|EOF||End Of Frame (always recessive)||7|
With this format, different frames can be sent:
- Data Frame
- The RTR bit is dominant.
- Remote Frame
- The RTR bit is recessive, DLC = 0 and therefore no DATA field. The requested data frame with the same ID follows.
- Error Frame
- Error on the bus.
- Overload Frame
- Request a delay of the next data or remote frame.
The use of any other frame than Data Frames is not recommended.