The CANtact device is a single channel USB CAN interface. It can be used to connect to CAN bus systems, including cars, heavy duty vehicles, and industrial automation systems. CANtact works on Linux, OS X, and Windows.
With a CANtact and an OBD-II to DE9 cable, it is very easy to get onto the OBD-II CAN bus of any CAN enabled vehicle.
CANtact can be purchased from the Linklayer Store.
Connections & Jumpers
CANtact uses a USB-B cable to interface with your computer. These cables are commonly used to connect printers as well.
The DE9 connector of the CANtact allows for two pin mappings for different use cases:
- Pins 7 (CAN high), 2 (CAN low), and 3 (ground) for standard CAN connections
- Pins 3 (CAN high), 5 (CAN low), and 1 (ground) for use with an OBD-II to DB9 cable. This is compatible with the Sparkfun OBD-II cable.
The pins can be selected using the jumpers on board.
The final jumper is for CAN termination. Place the jumper beside the "CTE" marking to place 120 ohms across CAN high and CAN low. This is commonly used in development, when you are only interfacing with a single CAN device.
On OS X, no drivers are required. CANtact appears as a usbmodem device. You can access it directly by reading and writing to /dev/cu.usbmodem####. The #### will change depending on which USB port the tool is connected to.
On Linux, no driver is required. Depending on your Linux distribution, CANtact will either either appear as /dev/ttyACM# or /dev/ttyUSB#. The # will depend on how many devices are connected.
On Windows, a driver is required.
Once you have a CANtact device connected, you will need software to interface with it. There are a few options. On Linux, SocketCAN is recommended. On Windows and OS X, the graphical cantact-app can be replaced. Developers can use the pyvit library for developing applications around CANtact, and other CAN bus devices.
The CANtact can be updated over USB. First, you will need to put the device into DFU mode by following these steps:
- Disconnect the USB cable from the CANtact
- Connect the two "BOOT" pins (see image on right)
- While the pins are connected, plug the USB cable into the CANtact
- The CANtact device is now in DFU mode
The next steps depend on what OS you are using.
- Install the ST DfuSe Tool
- Open the DfuSe tool
- Click "Choose..." and select a DFU firmware file
- Check the "Verify after download" box
- Click Upgrade
- Wait for the "Verify successful !" message at the bottom of the window.
Linux & macOS
Flashing on Linux and macOS requires dfu-util.
On macOS, this can be installed from Brew:
brew install dfu-util
On Ubuntu, install dfu-util with:
sudo apt install dfu-util
Once dfu-util is installed, flash the device by running:
make flash from the cantact-fw directory.
Once this is complete, unplug the USB cable, disconnect the "BOOT" pins, and reconnect the USB cable. The device is now updated!
CANtact is based around the ST STM32F042C6 microcontroller. This device has both USB and CAN, and is available at a low cost which makes it ideal for this application. A Microchip MCP2561 CAN transceiver provides an interface to a standard high speed CAN bus.
CANtact acts as a virtual serial port, and uses the LAWICEL protocol to send and receive frames. This allows it to be supported by many operating systems, as most support the USB Communications Device Class (CDC) out of the box.
Serial ports are typically limited to 115200 bits per second, which is significantly slower than the maximum 1 Mbits per second of a CAN bus. However, this limitation does not apply to the USB side of a CDC device, and CANtact can operate at speeds much higher than 115200 bps.
On Linux, the candleLight by Hubert Denkmair implements the gs_usb protocol for CANtact. This firmware only works on Linux, but is preferable if only SocketCAN is needed. See the CandleLightFirmware page for details on using candleLight firmware.