LEAF CANbus decoding. (Open discussion)

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Instead of using a regular OBD connector or plug, here's a cable with a right-angle connector which would seem like it might do a better job of staying out of the way of one's legs while driving. I'm not sure if the cable connects all of the pins we need, but I was hoping it might since it has a female connector on the other end.
http://www.scantool.net/accessories/accessories-cables/cable-j1962m-right-angle-to-j1962f-6ft.html
 
Interesting.. I couldn't tell if it passes all 16 signals, but the picture makes it look like it does.
I ordered it. Will report back. :)

I'm more worried about wearing out or breaking the DLC socket on the car. This cable might let me leave it connected and wear out the other end of the cable instead.

Another worry is that even if they correctly shield the well-known CAN pair, the other two are probably untwisted/unshielded. Doesn't seem like it will matter at 6ft length, but who knows.
 
GroundLoop said:
Interesting.. I couldn't tell if it passes all 16 signals, but the picture makes it look like it does.
I ordered it. Will report back. :)
Great!
...Another worry is that even if they correctly shield the well-known CAN pair, the other two are probably untwisted/unshielded. Doesn't seem like it will matter at 6ft length, but who knows.
If so, there's also a 2ft version but it costs more (the 6ft one is "on sale"). :)
 
these guys also run http://www.obd2cables.com which has a much wider selection.

http://www.obd2cables.com/products/obd-cables/cables-open-end/open-end-to-j1962/cable-j1962m-ra-type-b-to-open-end-6ft.html
 
Bought a 6 foot one so I can make things a little neater...

turbo2ltr said:
these guys also run http://www.obd2cables.com which has a much wider selection.

http://www.obd2cables.com/products/obd-cables/cables-open-end/open-end-to-j1962/cable-j1962m-ra-type-b-to-open-end-6ft.html
 
Wanting the flexibility to program the uP right at the CAN interface
to be able to be an in-car display, and really wanting real-time
display (and Logging) of at least the 3 CAN busses.

1. I ordered AVR-CAN Development Boards from Mouser, $54 + Ship in Q1:
It is a 16 MHz board made by Olimex (see their link below), with an Atmel AT90CAN128 uP.

You would want 1 to 4 of these for monitoring, or just one to add a display
and have a SOC monitor. We are using these today, with our software, to
monitor and log at least 2 of the CAN busses.

I ordered from Mouser because they had them in stock and are usually fast delivery:
http://www.mouser.com/Search/ProductDetail.aspx?R=AVR-CANvirtualkey63420000virtualkey909-AVR-CAN

The board is made by (or for) Olimex:
http://olimex.com/dev/index.html
Click AVR on the left, and then AVR-CAN in the Development Boards
list on on the left side of the page.

More good pictures at this site, another source:
http://www.sparkfun.com/products/8279

A Users Manual, from another site:
http://www.olimex.com/dev/pdf/AVR/AVR-CAN.pdf

Another source, apparently $49 each (but this is only 8MHz, not the 16MHz we want):
(also, this board has different conectors)
http://www.bravekit.com/AVR_CAN_ATMEL_AT90CAN128_prototype_board_JTAG_ISP_RS232_UART

Aother description, with a schematic of the board:
http://www.radiolocman.com/op/device.html?di=71375&/AVR-CAN

The AT90CAN128 uP is described at the Atmel site:
http://www.atmel.com/dyn/products/product_card.asp?part_id=3388

2. I ordered the "T" OBD2 Pass-thru Connector and Cable, $21 to USA
All 16 pins are wired.
http://www.carplugs.com/Product_view_Cables_6.html

The one turbo found above is not a pass-through conector:
http://www.obd2cables.com/products/obd-cables/cables-open-end/open-end-to-j1962/cable-j1962m-ra-type-b-to-open-end-6ft.html

3. I ordered a USB-H-1004 "USB-to 4-Port RS232" (1MHz), about $55 + T&S
http://www.easysync-ltd.com/product/534/usb2-h-1004.html

We have not yet used or tested this piece, but the specs seem to be good
for speed, and I hope to be able to plug in 1 to 4 of the Atmel boards
directly to this "base" to form part of a 1 to 4 channel package that would
monitor the EV, Car, AV, and even QC busses.

I will investigate the firmware Loader for this AVR-CAN board and
report more in a few days. In the mean time, I only need some
9-pin connectors and shells ... and more programming.
 
More details on the serial stream coming out of our AVR-CAN (with
the firmware that we loaded):

The first byte is a Check-Sync byte, which is:
IDbyte1 XOR IDbyte2 XOR 0x53

second byte is IDbyte2, third byte is IDbyte1, and
the the 8 data bytes follow (padded by 0xFF as needed to make 8 bytes.

That gives us an 11-byte "message", and we feed it to a (virtual) Comm Port
in the PC via an RS232 to USB adapter cable. The included driver for the
adapter makes the incoming bytes appear in a virtual Comm Port.

----------------
The AVR-GCC software is used for preparing the firmware.
Compile, Assemble, Link, ...
then Load the firmware to the uP via a JTAG port.

Some GCC libraries and some Atmel libraries are needed for Linking.
More info on that when I have actually done it myself.
 
Another Display option is a pre-built Chumby.
They run Linux, and can run Chumby (Flash) apps, or be reprogrammed from the ground up.

Most importantly, they're about $50 in finished plastics.
They generally have WiFi, audio, and USB, and run on DC voltage.

An Arduino AT90 CAN adapter combined with a USB Serial interface makes sense, but it's a lot of software work to get all the parts working together.

Still, for $20 more than an LCD display you get a 3.5" Color LCD touchscreen and sound. That's hard to ignore.

Here's an example of someone interfacing a circuit to Arduino to Chumby with success:
https://boconnor.is-a-geek.com/pmwiki/index.php?n=Geek.Chumby
It's not simple, but it's arguably the best looking package. Moreover, the WiFi feature enables all kinds of data transfer/logging facilities without added wires.
 
The "ODB2" pass-through T-cable (all pins wired) arrived yesterday, and I will add three 9-pin female "D" connectors this AM (to plug onto three AVR-CAN cards that should arrive from Mouser this afternoon).

The 4-port RS232 to 1-port USB adapter from EasySync should also arrive this afternoon. Removing the two cable-securing "screw-nuts" from the RS232 port on the AVR-CAN boards should allow me to plug the three boards directly into the EasySync RS232-to-USB adapter.

The USB plugs into my laptop, and its driver should give me 4 virtual Comm Ports, with the EV-CAN, Car-CAN, and AV-CAN message data streaming in.

Of course, we will need to "flash" the firmware into each AVR-CAN board, but that only takes a minute (with the right equipment).

The AVR-CAN boards get powered from the always-on 12v on the "ODB2" connector, and the RS232-to-USB gets power from the USB port.
 
GroundLoop,
If you can get to Oceanside (maybe at Mossy Nissan there), we could meet to demo and share results, if you would like. I am about 40 miles "North", in Laguna Hills (Orange County).

In any case, I plan to bring a Show-n-Tell to the July 16th San Diego Gathering at HTB in Mira Mesa.
 
If I can get a simple display with enough contrast (or backlight) to be easy to read, I should be able to bring a working "SOC Display" to the SD Gathering on 16 July (and a working prototype to the SoCal Gathering on 25 June).

Parts:
1. Cable from EV-CAN buss ("QDB2" to 9-pin "D")
2. AVR-CAN board with firmware
3. Simple Display, maybe a "serial" 2 x 20 or something similar.

It could all be powered by the LEAF-ON 12v on the "ODB2" connector.
 
garygid said:
GroundLoop,
If you can get to Oceanside (maybe at Mossy Nissan there), we could meet to demo and share results, if you would like. I am about 40 miles "North", in Laguna Hills (Orange County).

In any case, I plan to bring a Show-n-Tell to the July 16th San Diego Gathering at HTB in Mira Mesa.
I should be able to make HTB on July 16. I'd like to see your rig.

My current wiring solution is one DTC connector on Cat5 (four twisted pairs). Perfect for Three CAN bus, one power/gnd.

The RJ45 snaps into one of three RJ45-to-DB9 shells, which selects one of the CAN Bus onto the standard pin assignments. Pretty easy, and works with all my CANbus adapters. Of course, I'm not trying to monitor all three at once.
 
Another Display option is a pre-built Chumby.

Didn't think of that. I'm exploring this as it makes the most economical sense. My Chumby Classic (beanbag) fits perfectly in that spot just forward of the cup holders. Not sure how well the chumby one would fit.
 
turbo2ltr said:
Another Display option is a pre-built Chumby.

Didn't think of that. I'm exploring this as it makes the most economical sense. My Chumby Classic (beanbag) fits perfectly in that spot just forward of the cup holders. Not sure how well the chumby one would fit.
I have an Insignia 3.5" that is a perfect fit in size and shape.
Sure makes that 4x20 LCD look archaic.

That said, everything I can find about Chumby programming makes it look obtuse. To get something on the screen, it pretty much has to be either Flash or a total rebuild of the Chumby system to turn it into a Linux+Xwindows/Browser machine.

Flash can't access devices, so you have to have:
- A device driver for Linux, like ttyUSB0
- A perl script or code that takes the device data and turns it into something friendly
- A web server (!) running on the Chumby to run the script
- Flash code to access the web server and render the display

Arduino, it's not.
 
Using our old custom "ODB" cable, one AVR-CAN board (firmware flashed),
and an RS232-to-USB adapter (with its included driver):

We got my CAN-Do (v129) program to display the LEAF's real-time EV-CAN buss
data on its "dashboard", using my laptop running 32-bit Vista. YEA! :D :D :D

Now, to make the same "hook-up" for me:

1. I wire a 9-pin "D" to the "ODB2" cable I just got, (solder 4 wires)

2. Connect the flashed AVR-CAN board (already flashed today)

3. Connect the RS232-to-USB "adapter" cable from AVR-CAN board to the PC.
(driver already installed)

4. Run the CAN-Do program.

(about $21 for cable, $54 for AVR-CAN board, and $4 for a one-port RS232-to-USB adapter = $79 plus shipping & tax) !!!
 
The Lawicel data format (from their CAN232 device) appears to be:

1. An Ascii character string with a <cr> character at the end of each message.
2. A "t" followed by 4 hex characters DDDN, where DDD is the CAN-Message ID, and the N (0 to 8) is the number of following bytes.
3. The N data bytes (if any), as two hex digits for each data byte.
4. Four optional Time-Stamp characters MMMM (representing 0 to 59999 msec in a minute).
5. The "terminating" Carriage Return character.

If somebody has such a "Lawicel" Log file, please send it and I will add support for it in CAN-Do.

This format allows an OPTIONAL milli-seconds in current minute "time stamp", but it is apparently not the default format.

The frequent message rate on the LEAF's fast 500k-bit EV-CAN buss could give 1000 messages per second (times 22 Ascii characters per message = 22,000 x 10 bits per character) => 220k baud required. Usually there are only 100 or 200 per second, so some message buffering can use a "standard" 115200 baud RS232 data rate.

So, to cut down the data rate, we decided to use single binary bytes instead of using two Ascii bytes to represent each binary byte.

Other info/input/suggestions, please?
 
The Lawicel devices are just CAN to RS232 (or USB) adapters. They come with no software at all, so there isn't really a file log format. By default, people just record the serial traffic with Hyperterminal (heaven forbid) or whatever com program they use.

It's also the reason the format is entirely readable ASCII, and takes twice as many bytes as a binary format. :(

The Lawicels have an optional timestamp, enabled with the "Z1" command. This appends a four-ASCII-nibble timestamp to the end of each message (before the <cr>). This 16-bit word represents a millisecond count. It wraps not at 0xFFFF but at 60,000 (one minute).

Here's a segment of a log file, where ^M represents '\r'. Normally you would configure your terminal for CR->CRNL conversion, of course.

Code:
t1D489C6D0000020660500251^Mt1F2808640000000400080252^Mt50A60620001900000252^Mt1D489C6D000042066097025B^Mt1F280864000000040109025C^M

There are other leading characters other than 't' for different CANbus messages, but on the Primary CAN and EV-CAN, I haven't seen any other than 11-bit identifiers. Anything unusual on the AV-CAN?
 
Back
Top