Veethree D7 SDK
Loading...
Searching...
No Matches
CAN Interfaces on the D7 Platform

< Details index

The D7 SDK packages CT2KLib which supports the J1939 and NMEA 2000 protocols, along with a lower level library that wraps SocketCAN.

The D7 device has two CAN interfaces available on two separate connections:

1. can0

The can0 interface is available on the AMPSEAL 23-pin connector and is used for J1939.

AMPSEAL 23-pin connector

2. can1

The can1 interface is available on the isolated M12 A-coded connector and is used for NMEA 2000.

M12 A-coded connector

Testing the CAN interfaces on the device and on Linux hosts

Both the release and development images for the device come preinstalled with some of the can-utils tools:

  • candump
  • cansend
  • canplayer
  • cangen
  • cansequence
  • cansniffer

Note: The testj1939 tool is not part of the development image.

Note
Currently CAN interfaces on the host are only supported on Linux hosts.

You can use a USB-CAN adapter to connect your Linux workstation to the D7 and test out CAN communications.

On a Linux workstation, follow the can-utils guide to get used to the utilities.

You can then connect the workstation to the D7 using a USB-CAN cable or adapter and use the tools form the guide above to experiment with CAN communication on the target device.

D7 SDK support for CAN interfaces

CT2KLib

CT2KLib is packaged in the SDK alongside a compatibility library, such that existing applications that depend on CT2KLib can be easily ported to the D7 Platform.

The CT2KLib documentation can be found here, and the documentation for the compatibility library can be found here.

For an example application that uses CT2KLib alongside the compatibility library, see CT2KLib compatibility library examples.

vsdk::comms

Since the target deivce is running Linux, the CAN ports are exposed via SocketCAN, and thus can be used as any other network interface.

The official documentation for SocketCAN can be found at https://docs.kernel.org/networking/can.html.

The D7 SDK contains an abstraction library over the SocketCAN API, in the vsdk::comms namespace. The relevant headers to include are comms/can_adapter.h, comms/can_socket.h and comms/can_common.h.

These classes offer a simple to use API for bring CAN interfaces up or down, configuring them and for sending and receiving CAN frames.

For the full documentation, please see vsdk::comms::can_adapter and vsdk::comms::can_socket.

For a usage example, please see CAN Examples.