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:
Built in USB bootloader. I can make firmware updates and you can flash them.
Jumper selectable DB9 pins. This lets you use it with the "standard" pinout, or with an OBD-II cable. In other words, it's very easy to get on your car's CAN bus.
Built in termination. Need 120 ohms across the bus? Just put the jumper on.
Works with SocketCAN. This means you can use Wireshark and other open source tools with it. Including some cool stuff that I'm building, but that's a different story.
Open Source Hardware (soon). I haven't published this stuff yet, but it's coming shortly. All the hardware design (KiCad) and firmware (gcc friendly) will be released under an OSHW happy license.
It also got renamed. The project is now called CANtact. Yep, I can't get away from the CAN puns.
I am planning to do a run of these in the near future. If you're interested in getting one, let me know in the comments.
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!
Just ordered a set of your hardware, looking forward to tinkering with it! Have an idea for using esp32 listener to initiate animations or events on custom external esp32 lighting based on can bus packets indicating lock/unlock, key in range, etc. This should help me find the packets to listen for later. Then listener can ping light controllers to with event id.
I'm trying to use the CANtact board to sniff traffic onboard my car for eventual use on an Arduino. However, I'm a little coding illiterate. When I go to install the cantact-app, Github says it requires a "CLASSPATH". What do I have to edit or add to the ant build command to make it build properly?
Hello, any news on this? I would like to connect my Arduino and read the speed of my car. If the speed is less than 20kph, the Arduino would turn on the front parking sensors. So far I got to decode the signal from the parking sensor unit in order to show it on a display
Hi Eric. I have been thinking about doing something similar to this, but with a TM4c129X board.
I have attached a little MCP2561 chip and I was trying to read RPM and speed of my car.
Could you give me some advice or code I could start with? I am new to CAN (but not to Tiva C).
Thank you.
Hey, how's the progress over there?
Also wanted to write saying thanks again for the skull and the mention that lead me to getting an article about D-DAQ on the blog.
Progress is resuming, I spent the past two months travelling which meant this project didn't get much attention. Finally have all the parts in front of me again :)
Hey Eric, I've been vaguely thinking about CAN adapters for integrating with my DAQ software so your project is intriguing!
I'm not really familiar with the TI micros... what made you select them? I'm also curious to see what features you implement for your desktop software! :)
I chose the TI Tiva C Series because it has two CAN controllers, a USB peripheral, and I had a dev board lying around. Their dev tools are pretty good in my experience. Everything builds with GCC, and their Launchpad's debug interface (ICDI) is supported by OpenOCD. That makes it easy to use GDB and flash code, set breakpoints, etc...
Eric , I need another unit . The one I had was burnt in a shop fire .
My E mail is ra15806238@gmail.com , I go by gunrunner .