2
\$\begingroup\$

I have a few questions regarding CAN bus load

  1. Is there any derived equation/formula to calculate the bus load?

  2. I need transmit below frames(Assume Standard frame format) at baud rate 500 kbps on the bus

    5ms ----- 50 frames.

    10ms ----- 10 frames.

    100ms ---- 30 frmaes.

    Event messages ---- 10 frames.

How to calculate bus load, does anyone knows kindly illustrate the same?

  1. What is the maximum bus load on CAN bus?
\$\endgroup\$
4
\$\begingroup\$

Bus load = Used capacity / Max capacity. In practice this means how much of the possible bandwidth that was used over a certain period of time.

Assuming standard identifier, a CAN frame consists of:

  • 1 bit start bit.
  • 11 bit identifier
  • 1 bit RTR
  • 6 bit control field
  • 0 to 64 bit data field
  • 15 bit CRC
  • Bit stuffing is possible in the above, for every sequence of 5 consecutive bits of same level. Somewhere around 19 bits worst case.
  • 3 bit delimiter, ack etc.
  • 7 bit end of frame
  • 3 bit intermission field after frame. You need to count these for the purpose of bus load.

So the amount of bits is variable depending on how much data there is and also on how many stuffing bits you end up with. Ignoring stuffing, you have an overhead of 47 bits/frame. The maximum frame size with 8 bit data with worst-case stuffing is something like 47+64+19=130.

Lets say you use 250kbps and measure bus load over 10ms intervals. The theoretical maximum amount of bits is then 10ms / (1/250kbps) = 2500 bits. But this is of course not necessarily divisible by full CAN frames.

If you send 10 frames with 250kbps during 10ms, each frame being 11 bit identifier, no data and no stuffing, then you end up with 47*10 = 470 bits, out of the theoretical maximum 2500. 470/2500 = 18.8% bus load.

Whereas 10 of my standard id rough worst-case 130 bits/frame, would give 1300/2500 = 52% bus load.

In practice, tools that measure bus load just clock the time after the end of each intermission field, until the next dominant start bit of another frame appears, then sum all such time periods.

\$\endgroup\$
1
\$\begingroup\$
  1. Afaik, bus load is a percentage.

    • bus load = #bytes send / speed

    • e.g. 1000 bytes (to be send in a second) * 8 (bits/byte / 500,000 (baudrate bps) * 100% = 1.6 %

  2. In your case you are sending per second:

    • 1 / 0.005 * 50 * 76 = 760,000
    • 1 / 0.010 * 10 * 76 = 76,000
    • 1 / 0.100 * 30 * 76 = 22,800

note: 76 is assumed the average bits per message (32 bit data), this depends on what you define, so it can vary. See the CAN bus message in Wikipedia.

Total: 760,000 + 76,000 + 22,800 = 858,800

Bus load = 858,000 / 500,000 * 100% = 171,76%

This already is too much.

  1. See below.

ID allocation

In the early 1990s, the choice of IDs for messages was done simply on the basis of identifying the type of data and the sending node; however, as the ID is also used as the message priority, this led to poor real-time performance. In those scenarios, a low CAN bus use of circa 30% was commonly required to ensure that all messages would meet their deadlines. However, if IDs are instead determined based on the deadline of the message, the lower the numerical ID and hence the higher the message priority, then bus use of 70 to 80% can typically be achieved before any message deadlines are missed.

So if you are using IDs based on priority, 70-80% is ok, and you are well below that number.

\$\endgroup\$
  • \$\begingroup\$ " messages might interfere (collide), and need to be resent. This is not taken into account, and can also increase the bus load" Sorry, but you've misunderstood the CANBus protocol. Messages do not collide in the sense that they need to be resent - the arbitration process selects a single transmission at a time. The sources which are suppressed are aware of the fact. At 21% you get frequent collisions, but the overall throughput of system remains unchanged. As you stated, you can get missed deadlines by low-priority sources, but that's not the same thing. \$\endgroup\$ – WhatRoughBeast Feb 18 '19 at 17:38
  • \$\begingroup\$ @WhatRoughBeast You are right, I meant it the way you wrote in your comment, if the user wants to have a message always being sent (ok), a resending mechanism is needed (to be implemented manually). I updated my answer better. \$\endgroup\$ – Michel Keijzers Feb 18 '19 at 17:42
  • \$\begingroup\$ Resending of frames that were arbitrated out (or not acknowledged) is usually a standard feature of a CAN controller. No need for much coding here (unless a single shot transmission mode is configured). \$\endgroup\$ – filo Feb 18 '19 at 17:44
  • 1
    \$\begingroup\$ @filo changed again ... :-) thanks for the remark. \$\endgroup\$ – Michel Keijzers Feb 18 '19 at 17:48
  • \$\begingroup\$ Not bytes, bits. Bus load isn't related to payload but to total traffic. There's nothing called "collision" in CAN either, only starvation. \$\endgroup\$ – Lundin Feb 20 '19 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.