Selecting a CAN Controller, 2023 Update

By Olaf Pfeiffer

UpdateThe original article was written in 2003, when CAN (Controller Area Network) interfaces were also still available in 8-bit microcontrollers and an efficient CAN core implementation was essential to the overall performance. It is time to give this an update as with the evolution of technology and the proliferation of microcontrollers, there's an ever-expanding range of options when it comes to selecting a CAN controller. With so many choices available, how do we make an informed decision?

Introduction

CAN has been a reliable communication protocol since the late 1980s. The adoption and use of CAN devices have surged, reflecting its reliability and robustness in various applications. With the introduction of CAN FD (supporting higher data bitrates and larger frames), the overall CAN lifetime has been further extended, as systems can grow, even if they now must communicate more data or add security protocols.

Though many semiconductor manufacturers offer microcontrollers with CAN or CAN FD interfaces, the performance and efficiency of the implementations vary significantly across devices. It's essential to understand these differences and their implications on the performance of the processes handling the CAN communication.

This article aims to highlight these distinctions and assist in making an informed choice.

Informed choices

Classical CAN or CAN FD?

Unfortunately, CAN FD is not fully backward compatible with classical CAN implementations. While a CAN FD controller can handle both classical and CAN FD communication, a pure classical CAN controller will produce error frames (as it does not recognize the FD frame) and disrupt communication when it encounters CAN FD frames. Therefore, you can only activate CAN FD communication when ALL active devices connected support it. Keep this in mind when making your choices.

CAN and Higher-Layer Protocol Processing – What Happens Where?

What all CAN controllers have in common is the build-in process of transmitting and receiving CAN frames, including error checking and re-transmission on error detection. In addition, all CAN controllers provide some filtering and buffering. Hardware filters in many CAN devices allow incoming CAN messages to be compared to a pre-configured filter, ensuring only relevant messages get stored in a receive buffer. The filter's width and its compatibility with match or mask functionalities are primary differentiators. However, the number of filters and buffers or how much memory is usable for buffering both incoming and outgoing frames can greatly differ between devices.

Typical CAN controller selection options are:

The benefit of such a system is that the host processor connected does not need to deal with individual CAN frames, their reception, or even their transmittal. The main data exchanged between the host processor and the CAN coprocessor is application data – there is no overhead for handling segmented data or network management protocols.

Controller choices

What is Right for Me?

Go through this list to get closer to a decision as to which specific CAN controller to use:

  1. Do I need CAN FD or do I want my hardware to be future-proof? If yes, select a CAN controller that is CAN FD capable.
  2. Review the amount of data that you expect your node to transmit and receive. If your node is a simple sensor or actuator with a limited amount of digital and analog data communicated, consider a stand-alone solution (device or SoM implementing what you need, such as CANopenIA). Otherwise, your choices are “almost unlimited”, even a CAN controller with a limited number of filters and buffers will be usable.
  3. Review the number of other CAN devices that your node needs to communicate with. If this is 8 or more, the number of filters/buffers of the CAN controller should preferably be 16, better 32 or even more.
  4. Which Higher Layer Protocol will you be running? Most standardized higher-layer protocols like CANopen or J1939 require adequate resources in both processing time as well as code and additional buffer memory. Again, the size of the memory and buffers increases with the number of other nodes your node needs to communicate with. While for any 32-bit processor running at 40 or more MHz, the processing time should not be a relevant factor, the embedded code size requirements can be anywhere from 10 to 24kb and RAM requirements from 1k to 8k. While these numbers by themselves look small, for optimized embedded systems, you might need to carefully select an MCU derivative with enough resources for this – and everything else that needs to run on this MCU.
  5. How can I reduce complexity while increasing security? Applications that combine many modern technologies and use a number of different communication channels tend to reach a complexity level where development, debug, and test times explode. Coprocessor solutions providing not only a CAN interface but also implementing a higher-layer protocol like CANopen or CANopen FD help to not only reduce the overall complexity by offloading the task of handling CANopen to an extra CANopen dedicated processor. Even without applying any specific security measures, such a solution already increases the overall security of the system. If your node gets compromised, it can still only produce the defined CANopen communication and could not be used for attacking other systems on the CANopen network. Vice versa, your node is automatically protected from the most common CAN hacks as your node does not directly participate in the CAN communication.

Summary and Conclusions

Apart from the features highlighted, many CAN controllers provide advanced functionalities like extended error reporting or auto-baud detection. However, when considering a CAN interface, the most vital aspect remains its ability to receive messages efficiently and possibly limiting the resources needed for processing them, thereby enhancing overall system performance.