Calculating CAN Traffic
In order to calculate the CAN load, we must define a few variables related to the CAN protocol.
Baud
The baud rate is the rate at which data is transfered in a communication channel (like CAN). For example, 9600 Baud rate is 9600 bits per second
Frequency
The frequency of a message, expressed in (Hz), is how often a message is transmitted per second. Different messages can have different frequencies.
This variation affects the total bits transmitted and, in turn, the bus load. To calculate bits per second, consider each message’s frequency and whether their lengths differ.
Message Length
The message length in a CAN frame can be calculated as a function of the data length. This calculation includes several fixed fields and a variable data field, which changes based on the message's data content.
Each CAN frame consists of several fields with fixed bit lengths, plus a variable-length data field. Let \(x\) be the number of bytes. Here’s the breakdown:
Frame Element | Length (bits) |
---|---|
Start of Frame (SOF) | 1 |
Identifier (ID) | 11 |
Remote Transmission Request (RTR) | 1 |
Control (DLC) | 6 |
Data | 8 bits per byte with 20% bit stuffing = 9.6x |
Cyclic Redundancy Check (CRC) | 16 |
Acknowledgement (ACK) | 2 |
End of Frame (EOF) | 7 |
Final Formula
The maximum total frame length is:
where \(x\) represents the number of bytes in the variable data field.
Total CAN Traffic
Total Bus Load
Sample calculation
Given:
Baud Rate: 500 kbaud (500,000 bits transferred per second)
Message Type | Data Length | Frequency (Hz) | Message Length (Bits) |
---|---|---|---|
Battery Status | 8 | 100 | 44 + 9.6 x 8 = 121 |
Motor Control | 5 | 50 | 44 + 9.6 x 5 = 92 |
The bus load is the previous example can be calculated as: