Tuesday, April 10, 2012

Adventures in SW-Can/GMLan Land - Part I

The Pontiac G8 (and all it's variants) uses Hi-Speed CAN and 'Single-Wire Can' also known as SWCAN for it's internal communications with the different sensors, computers etc. GM has it's own message structure built on top of regular CAN, called 'GMLan. And while the Hi-Speed line is used for crucial information such as engine controls etc (and used for ECM/TCM Reprogramming etc), the SWCan line is used for slower speeds / more 'informative' data like simple status messages, certain button presses like turn the A/C up or down. This also means that for a hobbyist the SWCan line is the much more interesting line to be looking at.

Unfortunately most OBDII devices only support Hi-Speed Can, and don't support SW-Can. You can buy specialized devices, but these tend to be expensive: Ranging from $200-500 for a plugin device. Part of the fun when people mod their cars or tinker with electronics is of course the DIY Aspect so there has to be a way to get around this.

Brad over at 'GTOSoft' is obviously a skilled electronic engineer and he managed to take a typical ELM327 based BlueTooth OBDII device, and modify it to be a SW-Can device instead. You can read his Blog entry here: How to Build a Single-Wire Can Adapter. I noticed based on the comments that it wasn't totally clear what exactly he did, so I figured I'd try to re-create this, but by using a USB-Version of a typical ELM327 based device since for what I wanted to do I would be connected to my laptop anyway. Also I figured I would describe the actual process. It's nice to know to solder Component A to Wire B, but it's better to know WHY you're doing it.


First, let's see exactly what Brad did - The Typical ELM327 Device is basically exactly made per the datasheet where on page 67-69 you can see the standard schematic, part list and optional USB connection (or in his case, bluetooth). Obviously the section we are interested in is the Hi-Speed Can transceiver, which is replaced with a Single-Wire can transceiver. Cleaning up the schematic to only show the Can Section we find the following standard schematic (which may or may not be 100% accurate depending on which device/clone version you purchase):
Typical Can-Bus implementation for an ELM327 based device
The MCP2551 is a Hi-Speed Can Transceiver which connects the Can-Bus (Can-L & Can-H) to the ELM327 Chip on pin 24 & pin 23, which are it's Can RX and Can TX respectively. The Datasheet for it shows the following pin-out:
Looking at the pin-outs and the ELM327 schematic you can see how they match up. Of course the point is to get rid of this chip and switch to a Single-Wire Can chip.
 
While there are several chips available as Single-Wire Can Transceivers, Brad from GTOSoft devised a prototype board with a Melexis TH8055 Single-Wire Can transceiver to take the place of the MCP2551, so let's look at the a typical TH8055 implementation in the DataSheet. (Since the chip has reached it's end-of-life and is now replaced by the TH8056, the datasheet does no longer seem to be on the Melexis site. Luckily there are tons of 'datasheet' sites available where you can find almost anything!)
Obviously the pin-out for the TH8055 is different than the MCP2551. Pin 1,4 and 7 in theory seem to be in the same location, but this really does not mean anything to use, since the supporting circuitry between the two is vastly different . This is for instance how a typical TH8055 schematic would look

Now obviously there are bunch of components on here, but looking at the pictures that Brad put up of his proto-board you'll notice he has 4 components in addition to the TH8055 chip.
GTOSoft SW-Can ProtoBoard
There are 2 resistors, a Capacitor and the 'dark' looking resistor is actually an inductor. While Brad's post was a little thin on actual details, he was kind enough to post pictures from multiple angles, which allowed me to reconstruct his board as quick schematic, which if I did everything right looks like this (Excuse my crappy schematic skills) - Note that I drew it to mimic his actual board layout and not a 'generic' schematic, so some things may look a little weird


Comparing this schematic to the datasheet version, we see, starting at the SW Can Input:
L1 - the 47uH Inducator inline with the SW-Can line to Pin 7
C1 - the 220pf Capacitor (yes it's 'after' the inductor in this board) connected to ground
Pin8 - Connected to Ground
TXD - going to Can Controller / ELM327
RXD - going to Can Controller / ELM327
Pin5 - Getting +5v / VBatt

Notice though that in the original schematic Pin5/VBatt is obviously in the 12V area, while here we're dealing with 5V. Apparently the TH8055/TH8056 has a wide range of operating voltages and according to the datasheet DOES function with 5V (though some things that we're not dealing with are affected)

So far so good, but at this point the design deviates a little from the reference schematic.
a) R1 - 2.1k Resistor between Pin5 and Pin4. Looking at the TH8055 schematic we see that Pin5 normally gets VBat and Pin 4 gets connected to a 5v regulator through a 2.5k resistor. Since we're piggybacking of another board, the way I understand 'R1' is to basically mimic this behavior by still connecting Pin 4 (TXD) to a 5V source. But since we do not have an extra voltage regulator we connect it to the other 5V source at hand (which most likely already came out of a regulator).  The value of R1 is a little lower than the original schematic, but is still 'close enough' where it would not cause any issues.

b) pin 6 is seemingly left unconnected , unlike the schematic where it's tied to Pin7 with a resistor- apparently this was not needed for this project

c) The more interesting thing is Pin2 and Pin3. These are defined as 'Mode 0' and 'Mode 1' in the datasheet. According to the TH8055 schematic these normally connect to the Can Controller and set the mode of the Can Transceiver to either Sleep Mode, High Speed Mode, Wake up, or Normal Mode. Now since the ELM327 does not have these pins (ELM329 does!)  By tying Pin 2 and Pin 3 together and then to the 5v power through a 10K resistor Brad devised a way to keep these pins both 'high' which means the transceiver would work in 'Normal' mode, which is exactly what we want. Simple, but effective!

This leaves us with a board which has 5 wires connected being:
Pin 1- TXD
Pin 4- RXD
Pin 5- PWR (+5V)
Pin 8- GND
Pin 7- SW-Can

To install the board you would simply solder the wires to the footprint of the removed MCP2551 chip, which looking at it's pinout would be:
Pin 1 - TXD
Pin 2 - GND
Pin 3 - PWR
Pin 4 - RXD


Lastly Pin 7 - the wire with the inductor connection, will simply connect directly to Pin 1 on the actual OBDII connector , which usually is not connected to anything.

Here's a picture of Brad's board connected in that exact way, with the green wire going to the back of the board/blue OBDII plug is the SWCan connection.



Next up - Let's do this conversion on a cheap Ebay ELM327 based device!

No comments:

Post a Comment