The CAN bus reduced the wiring cost, weight & complexity and also energetic
features for the safety.
1 byte = 8 bits
0 – Dominant
1 – Recessive
Hexa decimal format
Four Frame Types
- Data Frame (RTR=0)
- Remote Frame (RTR=1 and no data field)
- Error Frame (after violation frame format)
- Overload Frame (Not really used)
1. Data Frame is of 2 types: Standard and Extended
Standard Frame consists of 7 fields
1. Start Of Frame (SOF) – 1bit
2. Arbitration Field -> Identifier + RTR
3. Control Field -> IDE + Reserved bit + DLC
4. Data Field -> 0-8 bytes of data
5. CRC Field -> CRC + Delimiter
6. ACK Field -> ACK + Delimiter
7. End Of Frame (EOF) – 7 recessive bits
// Intermission Field (ITM) – 3 recessive bits
Arbitration: IDE + RTR
11-bit identifier (Hold the ID of message. E.g.: 0x647, 0x4A, 0x785)
RTR: Remote Transmission Request – 1 bit (0: Data; 1-Remote)
Lowest bit will have the highest priority - CSMA/CD with AMP (Arbitration by Message Priority)
//Carrier-sense multiple access with collision detection
Control Field
- The first bit is an IDE bit i.e., Identifier Extension bit
0 – Standard Frame
1 – Extended Frame
- The second bit r0 has been reserved for future use and its status is of no use to us
- DLC: Data Length Code is 4bits wide and indicates no. of bytes in data field
Data Field: Actual data will be sent here (Max: 8bytes)
Polynomial equation will be calculated by the CAN controller automatically. We have nothing to do
here.
SOF- Start of Frame. The message starts from this point. Always dominant.
Identifier: It decides the priority of the message. Lower the binary value, higher is the
priority. It is 11bit.
RTR– Remote Transmission Request. It is dominant when information is required from
another node. Each node receives the request, but only that node whose identifier matches
that of the message is the required node. Each node receives the response as well.
IDE– Single Identification Extension. If it is dominant, it means a standard CAN identifier and
if it is recessive, it means a extended CAN
R0– reserved bit.
DLC– Data Length Code. It defines the length of the data being sent. It is 4bit
Data– Up to 64bit (8bytes) of data can be transmitted.
CRC– Cyclic Redundancy Check. It contains the checksum (number of bits transmitted) of the
preceding application data for error detection.
ACK– Acknowledge. It is 2bit. It is dominant if an accurate message is received.
EOF– end of frame. It marks end of can frame and disables bit stuffing.
Extended CAN Frame Format:
1. SOF: 1bit => Start of Frame. The message starts from this point. Always dominant
2. Arbitration Field: 32 bits
- 29bit identifier
- RTR– Remote Transmission Request – 1bit
0: Data Frame
1: Remote Frame
- IDE – 1bit
0: Standard Frame
1: Extended Frame
- SRR – Substitute Remote Request – 1bit
Must be recessive
3. Control Field: 6 bits
r0, r1: Reserved 2 bits
DLC: 4 bits
4. Data Field: 0-8 bytes (64bits)
5. CRC: 16 bits
15bits -> CRC polynomial
1bit -> CRC delimiter (Recessive bit)
6. ACK: 2 bits
1bit -> ACK slot (Dominant)
1bit -> ACK Delimiter (Recessive bit)
7. EOF – 7 recessive bits
2. The Remote Frame
The Remote Frame is just like the Data Frame, with only 2 differences:
1. It is explicitly marked as a Remote Frame (the RTR bit in the Arbitration Field is recessive)
2. There is no Data Field
3. Error Frames: It is transmitted by either receiver node or transmitter node by detecting error
on the BUS
Error Types
Acknowledgment error
Bit error
CRC error
Form Error
Bit-stuffing error
Categorized into 2 types:
Tx errors -> Ack, Bit
Rx errors -> CRC, Form, Bit-stuff
Acknowledgement error:
An Acknowledgement error must be detected by a transmitter whenever it does not monitor a
dominant bit during ACK Slot
Bit error:
A node which is sending a bit on the bus also monitors the bus. Bit error forms in a situation where
the bit value monitored is different from the bit value being sent. The data transferred by
transmitter should be same until it reaches the receiver.
For example, if dominant bit is sent by transmitter and receiver receives recessive then it’s called a
BIT error.
CRC error:
The CRC sequence will be having the result of the CRC calculation by the transmitter.
The receivers calculate the CRC in the same way as the transmitter. A CRC error must be
recognized if the calculated result is not the same as that received in the CRC sequence.
Form error:
A FORM error must be detected when a fixed-form bit field contains one or more illegal bits.
As per ISO, CAN frame format is having some standard formats like CRC delimiter, ACK delimiter and
EOF is fixed to have recessive bits. If in any case, these standards are changed to dominant then it is
a FORM error.
Bit-stuffing error:
CAN uses a Non-Return-to-Zero protocol, NRZ-5, with bit stuffing. After five bits with the same value
(zero or one), the transmitter inserts a stuff bit with the opposite state.
Bit stuffing concept comes into picture when we are sending more than 5 bits with same polarity on
bus. After 5 consecutive bits, the 6th bit should be inverse of 5th bit polarity.
Data to transmit: 11111111
Data the control will transmit using stuffing concept: 111110111
Data to transmit: 000000
Data the control will transmit using stuffing concept: 0000010
If 6 consecutive dominant or 6 consecutive recessive levels are observed on the BUS then it will be
termed as BIT STUFF error
__________________________________________________________________________________
Whenever FAULT occurs, it will reside in any one of the below 3 states:
a) Error Active
b) Error Passive
c) BUS OFF
TEC: Transmitter Error Count
For one Tx error, the TEC will increment with 8
REC: Receiver Error Count
For one Rx error, the REC will increment with 1
Transreceiver Error count value: 0-127 => Error Active
Transreceiver Error count value: 128 – 255 => Error Passive (>127 and <=255)
Transreceiver Error count value: >255 => Bus OFF
4. Over load Frame
An overload frame is generated by a node when it’s too busy and not ready to receive any messages.
It is similar to error frame and used to provide extra delays between the messages.
The Overload Frame is not used very often, and no need to learn much about this.
- The CAN Controller is an interface between the Application and the CAN bus.
The function of the CAN Controller is to convert the data provided by the application into a
CAN message frame fit to be transmitted across the bus
- Asynchronous protocol: Instead of clock it based on time quanta (TQ)
- CAN is a 2-wire interface. Both the ends are connected with 120-ohm (in parallel) resistors
to oppose the signal reflection or noise distortions from the both ends and also match the
impedance.
Every CAN Transreceiver is having internal resistance of 60 ohms. Normally the source
impedance should be equal to load impedance. To satisfy this, we will be connecting 120-
ohm resistors.
To minimize the reflection reference, to reduce noise. To ensure that reflection does not cause
communication failure, the transmission line must be terminated with the 120 ohms.
As per maximum power transfer theorem, load imp = source imp
CAN internal resistance = 60ohms
- It consists of a pair of twisted wires that are shielded to reduce electromagnetic interference
caused due to noise
- Hard Synchronization: Hard Synchronization to be performed at every edge from recessive-
to-dominant edge during Bus Idle.
Additionally, Hard Synchronization is required for each received SOF bit.