Back to ESAcademy Home Page


Microcontroller
Peripheral Timing
Calculator

Worst and best case calculations for CAN frame transmission times and interrupt response times

 

Home

News

Training Classes

Products

Consulting

Technical Library

Contact Us

Recommended books:

CAN System Engineering

CANopen

Enter the CAN baud rate in kBit and the shortest and longest message (in data bytes) used in your application, then click on the "Calculate" button

Used CAN baud rate (in kBit): (kbps)
Shortest data message (0-8): (bytes)
Longest data message (0-8): (bytes)

NOTE:
A CAN data frame consists of the following bits (including end-of-frame and minimum intermission):

Start Standard ID Ctrl Extended ID Ctrl Data Fields Checksum Ctrl, End
1 11 3 0 or 18 4 0, 8, 16, 24, 32, 40, 48, 56 or 64 15 13

Bit Time, Message Length, Bandwidth

  11-bit ID 29-bit ID
Bit time: (us) (same as 11-bit ID)
Length of shortest message:
(highest frequency of messages on the bus)
(bit) (us)
zero stuff bits
(bit) (us)
zero stuff bits
Length of longest message:
(worst case delay before next arbitration can start)
(bit) (us)
max stuff bits
(bit) (us)
max stuff bits
Best case data bandwidth:
(using longest data message)
(kbps) (kbps)

NOTES:

  1. The max number of stuff bits used is a theoretical value representing an upper worst case boundry. See the last NOTE at the end of this page for an "average worst case".
  2. If a CAN controller receives an internal transmit request while a CAN message is in progess, it has to wait until the end of the message before it can try to arbitrate for the bus. In worst case, a low priority message might be currently on the bus while a high priority message needs to wait until the lower priority message is completed.

Required Interrupt Response Time

The message lengths give us a good idea about how often CAN messages occur and can trigger a receive interrupt at receiving nodes. However, that does not say anything about the receive buffering and the required interrupt response time.

Example: a CAN controller just issued a receive interrupt, because it received a frame with 8 data bytes that matched an acceptance mask/filter. Assuming the worst case, that back-to-back messages follow and are matching the same mask/filter - how much time is there to pick up the original received data, before it gets overwritten?

This table shows the worst case - how fast a message in the receive buffer can get overwritten by the next one. This time depends on how many buffers a CAN controller has.

Bit times until buffer
gets overwritten
11-bit ID 29-bit ID Worst case scenario
Controller with 2 rcv. buffers
(regular BASIC CAN)

(15 + los)

(36 + los)
longest msg. in rcv. buffer,
followed by shortest msgs
(los = length of shortest)
Controller with 3 rcv. buffers
(15 + 2 * los)

(36 + 2 * los)
longest msg. in rcv. buffer,
followed by shortest msgs
(los = length of shortest)
Philips SJA1000, 8xC591
(has 64 byte buffer)

(500 bits)

(500 bits)
longest msg. in rcv. buffer,
followed by longest msgs
conservative estimate

NOTE:
Depending on specific implementations the values above may vary. If an application's interrupt response time gets anywhere near to the values above, try to optimize the system.

Data Frame Transmission Times

NOTE:
The following calculated values are all in microseconds, calculated by multiplying the bit time with the number of bits in the frame. The values do NOT include any stuff bits!

Total length of message 11-bit ID 29-bit ID
Frame with 0 data bytes (47 bits) (65 bits)
Frame with 1 data byte (55 bits) (73 bits)
Frame with 2 data bytes (63 bits) (81 bits)
Frame with 3 data bytes (71 bits) (89 bits)
Frame with 4 data bytes (79 bits) (97 bits)
Frame with 5 data bytes (87 bits) (105 bits)
Frame with 6 data bytes (95 bits) (113 bits)
Frame with 7 data bytes (103 bits) (121 bits)
Frame with 8 data bytes (111 bits) (129 bits)

NOTE:
The number of stuff bits inserted depends on the data transmitted. A conservative estimate is, that in average, the number of stuff bits will be below the following values:
1.) For 11-bit IDs: 3 + number of data bytes
2.) For 29-bit IDs: 5 + number of data bytes

Upcoming Classes
   

© ESAcademy, 2000
Author: Olaf Pfeiffer

All materials
provided 'as is'
see Disclaimer

www.esacademy.com
info@esacademy.com