These docs are for v7.1.0. Click to read the latest docs for v7.6.0.

How to Use CAN bus

The ESF CAN bus protocol implementation is based on the SocketCAN interface, which provides a socket interface to userspace applications. The sockets are designed as can0 and can1. The SocketCAN package is an implementation of Controller Area Network (CAN) protocols. For more information, refer to the following link: https://www.kernel.org/doc/Documentation/networking/can.txt.

Supported Devices

The ESF CAN bus protocol implementation is supported on the following devices:

  • ReliaGATE 10-11

  • ReliaGATE 10-12

  • ReliaGATE 10-20

  • ReliaGATE 20-25

  • DynaGATE 10-12

  • BoltGate 20-25

Configure the CAN bus Driver

The CAN network must be initialized prior to communications. Verify that the CAN driver module has been enabled in the kernel by issuing the following command:

ifconfig -a

The connections “can0” and “can1” should be displayed.

Next, the sockets must be enabled and configured using the following commands (the bitrate value must be set according to the bitrate of the device that will be connected):

ip link set can0 type can bitrate 50000 triple-sampling on
ip link set can0 up
ip link set can1 type can bitrate 50000 triple-sampling on
ip link set can1 up

Use the CAN bus Driver in ESF

To use the Can bus Driver in ESF, the bundle org.eclipse.kura.protocol.can must be installed. Refer to the section Application Management for more information.

Once this bundle is installed and verified, the CanConnectionService provides access to basic functionalities of the CAN network, including:

  • sendCanMessage – sends an array of bytes in RAW mode.

  • receiveCanMessage – reads frames in RAW mode waiting on socket CAN.

Refer to the following ESF javadocs for more information: http://download.eclipse.org/kura/docs/api/4.1.0/apidocs/.

Also, for information about the wrapper that this service utilizes, refer to the following link: https://github.com/entropia/libsocket-can-java.