Skip to content

CAN Bus

NeuralPlex utilizes systemd-networkd to configure the baud rate of each CAN bus, as well as other parameters. There are four CAN busses available on NeuralPlex: CAN0, CAN1, CAN2, CAN3. Three of the CAN busses (CAN0-2) are native on the NXP i.MX8QM. Each of these CAN busses are also connected internally to the Vehicle Interface Processor (VIP) CAN busses. The fourth CAN bus is connected to the SOC via the SPI bus.

To set the baud rate, modify the desired network file found at: /etc/systemd/network/. For example, to change the baud rate of CAN0 to 500k, use vi to edit the following file:

can0.network
root@neuralplex:~# vi /etc/systemd/network/can0.network
[Match]
Name=CAN0
[CAN]
BitRate=500000
RestartSec=500ms
TripleSampling=yes

Once you have made modifications to the can0.network file, you will need to reload the file for the changes to take effect.

Restart Networking
root@neuralplex:~# systemctl restart systemd-networkd

NeuralPlex includes can-utils which is useful for interfacing with the CAN bus from userspace.

candump lets you sniff CAN packets from one or more CAN interfaces with lots of other useful options to filter, redirect messages etc. Here just a small example:

can-utils
root@neuralplex:~# candump CAN0
CAN0 123 [4] 01 AA BB 22
CAN0 123 [4] 01 AA BB 23
CAN0 123 [4] 01 AA BB 24

cansend lets you manually send messages on the desired CAN interface. Here is just a small example:

can-utils
root@neuralplex:~# cansend CAN0 100#DEADBEEF