IOU06 Quick-Start-Guide / SocketCAN Demo

SocketCAN Demo

In this demo, we’ll demonstrate how to receive data from a CAN bus and print it to the console. This demo is using the Linux SocketCAN framework.

Warning On the the IOU06, the CAN and COM ports cannot be used at the same time. To enable CAN, set a persistent bus configuration. If you want to use the COM ports, remove the persistent bus configuration.



  • A Moducop Edge Computer with a IOU06 installed
  • A development PC (Windows or Linux), connected via Network to the Moducop

  • CANbus with at least one CAN device
  • Cable to connect the CAN device with the IOU06

Bus Configuration

Bus Configuration must be set once to tell the IOU06 about the CAN parameters. This configuration is saved persistently in the device. You only need to perform this configuration step once, it survives reboots and power cycles.

In this example, we assume your

  • Bitrate is 125 kBit
  • Sampling Point is 0.625 (62.5%)
  • Synchronization Jump Width is 1
  • Listen only mode is off (i.e. Normal operation)

Configure the device. You specify a string that has the form bitrate:sampling-point/1000:sjw:listen-only

On your Moducop, run:

io4edge-cli -d S101-IOU06-USB-EXT-1 set-parameter can-config 125000:625:1:0
# Restart to apply parameters
io4edge-cli -d S101-IOU06-USB-EXT-1 restart

Connecting (Rev. 0)

CAN Connection

Connect CAN_L, CAN_H and GND_ISO to the CAN bus. Be sure to have correct termination of 120R at each end of the line.

Connecting (Rev. 1)

CAN Connection

Connect CAN_L, CAN_H and GND_ISO to the CAN bus. Be sure to have correct termination of 120R at each end of the line.

Create a socketCAN instance

To access the IOU06 via socketCAN, we create a virtual socketCAN network that matches the service name of your IOU06 CAN Interface.

The virtual socket CAN network must be named according to IOU06 CAN Interface service name. E.g. if the service name is MYDEV-can, the virtual socketCAN device must be named vcanMYDEV (without -can). Because network interface names can have only max. 15 characters, but service names can be longer, there is a rule to map longer service names to socketCAN device names:



  • Service Name S101-IOU06-USB-EXT-1-can -> vcan name vcanS101xxEXT-1
  • Service Name 123456789012-can -> vcan name vcan1234xx89012
  • Service Name MIO04-1-can -> vcan name vcanMIO04-1

Now, create a virtual socketCAN network. On your Moducop, execute:

ip link add dev vcanS101xxEXT-1 type vcan
ip link set up vcanS101xxEXT-1

Function Test

Using the candump tool (part of can-utils package), you should see all frames that are sent on the CAN bus. Example (would dump also error information from CANbus):

./candump vcanS101xxEXT-1 vcanS101xxEXT-1,1FFFFFFF:1FFFFFFF,#FFFFFFFF -e
  vcanS101xxEXT-1  6B6   [5]  37 67 2F 0F F2
  vcanS101xxEXT-1  24A   [6]  B1 39 8A 3A A5 77
  vcanS101xxEXT-1  57C   [5]  01 B2 9F 37 22
  vcanS101xxEXT-1  665   [8]  1C C2 60 0A 8E E3 85 42
  vcanS101xxEXT-1  18B   [5]  B0 E5 E4 2E 24
  vcanS101xxEXT-1  0D0   [8]  64 49 45 71 6B B2 6E 09
  vcanS101xxEXT-1  146   [7]  2E A6 CF 44 1A E9 2A
  vcanS101xxEXT-1  508   [0]
  vcanS101xxEXT-1  726   [8]  B0 B5 2E 62 70 89 78 4F
  vcanS101xxEXT-1  454   [2]  15 01