CANtact is now working with Wireshark! Here's what that looks like:
This is done using SocketCAN on Linux. The slcand daemon is used to provide a bridge between the CANtact's USB CDC interface and SocketCAN. With this working, you can open up Wireshark and sniff the bus.
Like any packet capture, this can be filtered, saved, and analyzed easily. Wireshark is a great utility for capturing packet data. The candump, cangen, and cansend utilities are also working with the tool.
This project got put on hold for a number of reasons. Now it's back, though I've changed course a bit.
After talking with lots of people, it seemed that there was a need for a basic tool for getting on CAN that's easy to use. I decided to reduce the scope and build something a bit simpler.
Here's the hardware:
I think it's cool for a few reasons:
I've ordered some boards from OSHPark. They should arrive in a couple of weeks. Files are available in the Github repo.
I've been working on the firmware for the past week, but I decided to get started on custom hardware for the project. Up until now, I've been using the Tiva C Series Launchpad from TI with a hacked together add-on board for CAN. It's time for custom hardware.
This hardware uses the same microcontroller family, but opts for a model with 128k of flash instead of the 256k on the Launchpad. Since 128k should be plenty, this will lower the BOM cost of the hardware.
There is room for four CAN transceivers on board. However, it is intended to only be populated with two at a time. This way, you can choose between two high-speed buses, two single-wire buses, or one of each. For the high speed buses, there's a termination resistor that can be enabled with a jumper.
The hardware is fairly simple, and the next step is to design the PCB. That should get done shortly.
The schematic is hosted on Github, and available as a PDF here. It's a draft, let me know if you spot any issues!
After transmit was working, the next logical step was receiving CAN messages. This is now working, and the latest firmware is in the Github repo.
One challenge is receiving messages without dropping any. This is something I'm still playing with, but the results so far are pretty good. The device keeps up at moderately high bus loads, but the next step will be testing on a real vehicle network.
Now that the basics are done, I need to get the second CAN bus up and running. After that, I'll be writing some desktop software for dealing with the data. I'm looking at support for SocketCAN, which will allow it to interface with tools such as Wireshark easily.
Good news, I now have USB and CAN transmit working! The development setup looks a bit like this.
Right now I'm using CDC-ACM for USB. This emulates a serial terminal, and is really easy to develop applications for. It's also cross-platform, and does not need drivers on many systems.
For CAN, I'm using a Kvaser Memorator to test with. This device provides a CAN to USB bridge. The green PCB in the middle is a CAN terminator, which puts a resistance across the differential bus to terminate it.
The launchpad sits on top of a little Boosterpack, which just has the MCP2551 CAN transceiver on it. This transceiver operates at 5 V, which is available from USB. Fortunately, it will accept the 3.3 V input from the MCU, and the MCU is tolerant up to 5.5 V. This means no level shifting is required.
Currently, the device can go onto the bus, set its bit rate, and transmit messages. Next up is working on receiving messages.
For a first step, I need to add transceivers to the Tiva C Series Launchpad. This is a pretty simple circuit which should be easy to build on perfboard. I've started the design on Upverter.
We need to get this thing working quickly, so the first version will be built out of a dev board, some perfboard, and whatever else is lying around.
For the dev board, I'm planing on using the Tiva C Launchpad, because I have a few of them. Thanks for the free stuff TI! The Tiva C Launchpad hosts a TM4C123GH6PM processor, which has two CAN buses. One of them is shared with the UART which is used for a debug console. We should be able to jumper wires into some test pads to get access to this, and hopefully the debug console will not interfere during normal operation. If it does, we'll be a bit more assertive and cut the traces.
To actually get on CAN, we'll need transceivers. I want to support one high speed (differential) CAN bus and one low speed (single wire) CAN bus. This means two different transceivers. The MCP2561 is a cheap differential transceiver that's available in a DIP-8. That'll make prototyping easy. As for single wire, the NCV7356 will work. It's available in a SOIC-8, which is only slightly more difficult to mount to a perfboard.
Other than that, everything should be available on the Launchpad, making this a really straightforward hardware build. Time to order some components!