SocketCAN

Name Value Description

Code

socketcan

Name

SocketCAN (software bridge to CAN).

Maven Dependency

<dependency>
  <groupId>org.apache.plc4x</groupId>
  <artifactId>plc4j-transport-socketcan</artifactId>
  <version>0.12.0</version>
</dependency>

Transport Syntax:

{name of the socketcan interface}

Can differ depending on the OS:

  • can0

  • vcan0

Options:

none

SocketCAN is linux specific way to access CAN bus. It has its own representation of CAN frames, buffers and so on. This means that you have to program your application against socketcan and not raw can interfaces.

Primary difference is fixed length of socketcan frames (CAN 2.0A always takes 16 bytes) and extended size of CAN identifier. Standard CAN frame uses 11 bits while socketcan uses 29 and appends flags to remaining 3 bits.

Use of socketcan means that Apache PLC4X does not handle low level bus access, arbitration, coordination and so on. This is done by socketcan and layer below it.

This transport have been successfully tested with vcan as well as gs_usb drivers.