|
Veethree D7 SDK
|
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:
The can0 interface is available on the AMPSEAL 23-pin connector and is used for J1939.
The can1 interface is available on the isolated M12 A-coded connector and is used for NMEA 2000.
Both the release and development images for the device come preinstalled with some of the can-utils tools:
Note: The testj1939 tool is not part of the development image.
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.
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.
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.