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.
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 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 & OS X
This is possible with dfu-util, guide TODO
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.