CAN on the Raspberry Pi

This post walks through setting up a CAN controller on the Raspberry Pi. My goal is to help demystify the process, and provide simple instructions that a relative beginner should be able to follow. Particularly, including information that I wish was more readily available when I started with the project.

By the end of this tutorial you should have a working CAN controller connected to the Raspberry Pi via the SPI bus. Using SocketCAN it will be possible to send and receive CAN packets through the Linux IP stack. This means you can analyse CAN packets just as you would with TCP/IP, using standard utilities like tcpdump and Wireshark. Additionally, using utilities like candump/cansend provided by Can-utils, you can remove an extra layer of abstraction, and focus purely on the CAN data layer.

[Read more]