CAN bus
Depending on the controller, GOcontroll Moduline controllers have up to 4 CAN busses. When CAN communication is used in an application, a change of bitrate is quite common.
Note: In Simulink blocks and Node-RED nodes, CAN 1 and 2 in case of Moduline Mini 1 and Display 1 or CAN 1,2,3 and 4 in case of the Moduline IV can be selected. In Linux the index start at 0 this means the CAN 1,2,3,4 corresponds with can0, can1, can2, can3.
Change bitrate of the CAN interface
To change the bitrate of the CAN busses, a configuration file needs to be edited. This can be done on the controller using a file editor in the terminal or it can be done offline using FileZilla. A wired ethernet and/or Wi-Fi connection is mandatory.
When changing the file on the controller, nano is the editor that is installed by default. This example shows the way to edit can.conf using nano in the SSH terminal.
Command:
nano /etc/network/interfaces.d/can.conf
Typical output:

Changing the bitrate in this file will persistently store the new values to memory.
- 125000 (125 Kbps)
- 250000 (250 Kbps)
- 500000 (500 Kbps)
- 1000000 (1Mbps)
When you are ready editing the file:
- CTRL+X to exit the file editor
- Y to save the modified file
After a reboot, the new CAN bitrate will be used to setup the CAN interface. It is also possible to reinitialize a specific CAN interface with commands in the terminals. The following commands show how to re-initialize can0:
ifdown can0
ifup can0
Low level CAN monitoring
The GOcontroll Moduline controllers are by default installed with candump. The mos useful features of this utility program are live monitoring of CAN messages and the validation of the bus load. These features are perfect for trouble shooting CAN communication failures.
To monitor for example the massages on can0, the following command can be used:
candump can0
If you want to filter on a specific identifier, you can use the following command:
candump can0 | grep 0x311
If you want to check the busload of a CAN interface (in this example can0 with bitrate 250 Kbps), you can use the following command:
canbusload can0@250000
When multiple CAN busses need to analyzed at the same time, your command can look like this:
canbusload can0@250000 can1@500000 can2@125000 can3@250000







