Download your favorite Linux distribution at LQ ISO.
Go Back > Blogs > Indymaynard
User Name


Rate this Entry

ViewTool Ginkgo USB-CAN Interface Adapter

Posted 05-11-2017 at 07:34 PM by Indymaynard
Tags fedora, udev

It's been a few years...

My most recent undertaking is an idea that's been done plenty of times before, but I want to do my own version of it. Most importantly, I have learned a lot regarding Linux devices. Expect much more to be added or changed on this before all is said and done.

Simply broken down, my 2007 Jeep Grand Cherokee is equipped with a RAQ sound system. This part is only important if you are a Chrysler vehicle owner from the years 2004-2008. It is a decent system, with a 6 CD/MP3 CD changer, built in Sirius (via the Sirius radio near at the rear of the vehicle), and a UConnect system with Bluetooth capabilities...only for the phone. There is no AUX port, and the lack of Bluetooth coupled with this absent feature is frustrating to say the least. The other stereos available at the time had AUX ports. Even the lower end models included the port. WTF?

Being the kind of guy I am, I thought I could modify the stereo to include a spliced 3.5mm audio cable from one of the unused inputs on the rear of the radio. Perhaps there is a way that wasn't immediately obvious to me, but my direct solution did not work.

It was about that time I realized that Google can probably answer this. There are plenty of resources regarding the stereo, but almost every one had to do with the simple answer of downgrading the stereo, or buying a very expensive aftermarket model. Surely there was another way.

One of the pages I stumbled upon mentioned something about a CAN interface, and I wasn't sure what that had to do with the stereo. This is where reading overwhelmed me, and really put some wild thoughts in my head. More research showed me that I was in way over my head for a home brew solution. Or was I?

Several weeks and more reading later, I determined to undertake a new project. The end goal is to replace my stereo with a "carputer" of sorts, enabling, at a minimum, Bluetooth streaming of music, connection to the internet through my phone's WiFi hotspot, and the ability to still control my stereo through the steering wheel control. Additional features, such as diagnostics, remote start and climate control via my phone, and the obvious addition of some sort of voice response features.

Why not buy a product that already exists? Why not buy a new vehicle with these features? If you ask these questions, this is not for you.

My starting point was to use my Amazon gift card to purchase a Ginkgo USB-CAN Interface Adapter from ViewTool, essentially getting it for free! Thanks, mom! Even still, it is not an expensive purchase. I paid about $65 for it. I chose it because it has dual CAN channels, and that would become important for diagnostics and stereo control simultaneously. If you choose it for another CAN project, it has built in CAN termination resistors that you can use or bypass. Here's the downside: there isn't any software for it. This means I have to write software to sniff the CAN traffic, and then decode the traffic. It doesn't interface directly with canutils, so that is ruled out.

Any tinkerers excited about this project? Considering starting with this tool? Let me document a couple of things that helped me with this process.

The drivers for this device are available in a few packages, but most notably in the application samples available from their website for the device. Included samples are in C++, C#, VB.NET, VB6, Delphi, and Python. There might be one I'm missing, but that is a pretty good list. I chose to use Python, which uses Python 3 syntax for the library and demo application.

I am using Fedora 25x64, and I am using Eclipse for an IDE. There's not much else special about my setup.

You will need to create a udev rule if you want to use this as a normal user and not as root. Create a file /etc/udev/rules.d/10-GinkgoUSBCAN.rules with the following line:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="0666", GROUP=="indymaynard"
Obviously, replace indymaynard with whichever group your user belongs to, which you can determine by using the groups command in the terminal. Generally, it is your user name. Also, it is possible that the idProduct could change with a new version of it, so you may have to use the following commands:

sudo udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/001/0XX)
sudo udevadm test /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1
The first command will output all USB devices, and the one labeled STMicroelectronics with ID 0483:066 is your device. Take note of the device number for it and replace XX with that number. Unplugging and plugging in this device will cause the number to increment by the number of times you have plugged it back in. This will give you a /devices/pci style path to the device. Copy that number. The last command will output whether or not your rules file works.

Next, it is important to determine which language you will use. As I mentioned, I chose Python. Each sample application contains a library called ControlCAN, which must be loaded into your project. The lib folder contained within holds the drivers for various platforms. You can change the static location of the driver in the ControlCAN library, should this be a requirement for your project.

Next steps to be updated: read CAN data and decipher data.

Also, please give me any info you can on some of this stuff. Never really worked in Python before, so it will be ugly on the first go-round.
Posted in Uncategorized
Views 2038 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 07:02 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration