16. Controller Area Network - CAN
The controller area network (CAN) protocol is a real-time, serial, broadcast protocol with a very high level of security. The
ATmega16/32/64/M1/C1 CAN controller is fully compatible with the CAN Specification 2.0 Part A and Part B. It delivers the
features required to implement the kernel of the CAN bus protocol according to the ISO/OSI reference model:
●
The data link layer
●
●
the logical link control (LLC) sublayer
the medium access control (MAC) sublayer
●
The physical layer
●
●
●
the physical signalling (PLS) sublayer
not supported - the physical medium attach (PMA)
not supported - the medium dependent interface (MDI)
The CAN controller is able to handle all types of frames (data, remote, error and overload) and achieves a bitrate of 1Mbit/s.
16.1 Features
●
Full can controller
●
●
Fully compliant with CAN standard rev 2.0 A and rev 2.0 B
6 MOb (message object) with their own:
●
●
●
●
●
11 bits of identifier tag (rev 2.0 A), 29 bits of identifier tag (rev 2.0 B)
11 bits of identifier mask (rev 2.0 A), 29 bits of identifier mask (rev 2.0 B)
8 bytes data buffer (static allocation)
Tx, Rx, frame buffer or automatic reply configuration
Time stamping
●
●
●
1Mbit/s maximum transfer rate at 8MHz
TTC timer
Listening mode (for spying or autobaud)
16.2 CAN Protocol
The CAN protocol is an international standard defined in the ISO 11898 for high speed and ISO 11519-2 for low speed.
16.2.1 Principles
CAN is based on a broadcast communication mechanism. This broadcast communication is achieved by using a message
oriented transmission protocol. These messages are identified by using a message identifier. Such a message identifier has
to be unique within the whole network and it defines not only the content but also the priority of the message.
The priority at which a message is transmitted compared to another less urgent message is specified by the identifier of each
message. The priorities are laid down during system design in the form of corresponding binary values and cannot be
changed dynamically. The identifier with the lowest binary number has the highest priority.
Bus access conflicts are resolved by bit-wise arbitration on the identifiers involved by each node observing the bus level bit
for bit. This happens in accordance with the “wired and” mechanism, by which the dominant state overwrites the recessive
state. The competition for bus allocation is lost by all nodes with recessive transmission and dominant observation. All the
“losers” automatically become receivers of the message with the highest priority and do not re-attempt transmission until the
bus is available again.
16.2.2 Message Formats
The CAN protocol supports two message frame formats, the only essential difference being in the length of the identifier.
The CAN standard frame, also known as CAN 2.0 A, supports a length of 11 bits for the identifier, and the CAN extended
frame, also known as CAN 2.0 B, supports a length of 29 bits for the identifier.
ATmega16/32/64/M1/C1 [DATASHEET]
141
7647O–AVR–01/15