AVR-CAN hardware for CAN-data Capture

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.

garygid

Well-known member
Joined
Apr 21, 2010
Messages
12,469
Location
Laguna Hills, Orange Co, CA
NOTE -WARNING about the AVR-CAN Board:
As supplied from the factory, the CAN_T solder-jumper is ON, and
usually, for logging of existing CAN buses, we want it OFF.

Many hardware systems read data from the ONE "standard" CAN bus found on modern
ICE vehicles. Many messages are "standardized" and even required, to facilitate
Smog Testing. Other messages are manufacturer-specific, and are used most significantly
for vehicle "adjustments", diagnostics, and trouble-shooting.

Since the LEAF produces no emissions, it does not need to follow the standard, or required,
conventions. So, the 2011 LEAF has THREE CAN busses on the OBD connector, not just one,
and another CAN bus used just for Quick Charging. Most of the ODB2 (ODB II) automotive
CAN-Data Readers do not work with the LEAF, since the LEAF does not use standard messages.

The "Car" bus is PROBABLY similar to what most other vehicles would have, no matter what
engine type: controlling windows, turn signals, dome lights, unlocking doors, start-up
permissions, etc. The EV-CAN buss has messages that are involved with the Electric nature
of the propulsion system: battery, charging, inverter control for motor drive or Regen, etc.
The AV bus has ... well, see page 33 in the LAN section of the LEAF's Service Manual.

We have chosen a medium cost solution that minimizes the construction of hardware,
is supported by Open Source free software, and can easily be scaled from reading one
CAN bus to recover State Of Charge (SOC) to 3 (or even 4) CAN busses for full data
capture, logging, and display of a real-time "dashboard" on the PC.

The AVR-CAN Development Board is about $40, 2" x 3", and contains the Atmel AT90CAN128
micro-processor (uP) and some convenient Input/Output (I/O) ports: RS232 for serial
communication with a PC, CAN transmitter and receiver (transceiver) to "connect" to the car,
and an industry-standard JTAG interface for loading firmware into the on-card uP.

I have posted a list of the equipment and links to sources to buy it,
but I will have to find that post and copy it over here.

Compiling our firmware and writing it into the uP are the two steps that I have not YET fully
described. But, once you have the compiled program (from us), only the loading of the
firmware into the uP will be needed. It APPEARS that only about $20 of extra hardware is
needed for the firmware loading, and local clubs could share one "Loader" board and cable.

-----------------------------------------------------------------------------------
Parts List for 3-channel CAN-Capture:

Note 1. Always check stock before ordering.
Note 2: Sometimes Shipping and Handling charges can be substantial.
Note 3: Ordering in quantity for your Local LEAF Cluster or Branch might help.
Note 4: Consider buying a Kit, with "Flashed" AVR-CAN boards.

1. Three AVR-CAN Development Boards, 16 MHz by Olimex.
No longer carried by SparkFun, but there is a link to schematic and documents.
SparkFun sku: DEV-08279
Available as of 21 July 2014 at Mouser:
Mouser Part Number: 909-AVR-CAN
Or, also available from Digikey:
http://www.digikey.com/product-detail/en/AVR-CAN/1188-1012-ND/3471441" onclick="window.open(this.href);return false;

Note: see Correction Note for the AVR-CAN board in this post:
http://www.mynissanleaf.com/viewtopic.php?f=44&t=4439&p=379100#p379100" onclick="window.open(this.href);return false;

2. One HI-SPEED USB TO 4 PORT SERIAL RS232 ADAPTER, about $55
In stock 21 July 2014 at EasySync:
EasySync USB2-H-1004

3. One OBD Cable, with a male OBD connector, 16-wire, 6-foot
(I prefer a right-angle male OBD connector.)

OBD2cables Right Angle, Part number: 142601
OR, a Type B, for slightly more $$
Type B, OBD2cables PN 144507

4. Three Female 9-Pin "D" connectors, with plastic shells:

5. Three 5-volt 1 Watt (or higher) Zener Diodes:

6. Misc: Solder, 2 feet of stranded Wire, heat shrink or other tubing

7. Tools as needed: Screwdriver, soldering iron

8. Wiring Instructions:

9. Get AVR-CAN boards flashed with suitable firmware:

10. Download and use my CAN-Do program to Capture and explore the data.
Runs on a fairly quick Windows XP, Vista, or Win7 system.
See my CAN-Do site: http://www.wwwsite.com/puzzles/cando/" onclick="window.open(this.href);return false;

Note: With WINE, CAN-Do has been run on Ubuntu and MacOS 10.9,
but not yet tried for actually capturing high speed data through
their equivalent of a virtual COMM Port.

--------------------------------------------------------------------------
mod edit : viewtopic.php?f=44&t=4131&p=100361&hilit=firmware#p100361

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/ProductDet" onclick="window.open(this.href);return false; ... 09-AVR-CAN

The board is made by (or for) Olimex:
http://olimex.com/dev/index.html" onclick="window.open(this.href);return false;
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" onclick="window.open(this.href);return false;

A Users Manual, from another site:
http://www.olimex.com/dev/pdf/AVR/AVR-CAN.pdf" onclick="window.open(this.href);return false;

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_A" onclick="window.open(this.href);return false; ... RS232_UART

Aother description, with a schematic of the board:
http://www.radiolocman.com/op/device.ht" onclick="window.open(this.href);return false; ... 5&/AVR-CAN

The AT90CAN128 uP is described at the Atmel site:
http://www.atmel.com/dyn/products/produ" onclick="window.open(this.href);return false; ... rt_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" onclick="window.open(this.href);return false;

The one turbo found above is not a pass-through conector:
http://www.obd2cables.com/products/obd-" onclick="window.open(this.href);return false; ... d-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" onclick="window.open(this.href);return false; ... -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.
 
I have an AVR programmer, so I could help with writing bootloaders/software to uPs. Not sure why we need this? The Olimex board comes with a bootloader I presume? Or does the serial port not work with these boards for uploading pograms?

Or are you planning to eventually build something based on the AT90CAN128 from scratch? I.e. something with just the uP and the display, i.e. the stand-alone SOC meter, without all the stuff that is just part of the development board and not really needed?
 
The Olimex board is not an Arduino.
All the Arduino boards have an integrated USB adapter (FTDI) to go from the AVR's serial port to a PC, and a special bootloader program pre-flashed that intercepts the RS-232 and runs a programming bootloader.

The Olimex is a raw AT90128 chip, with no Arduino bootloader or RS-232-to-USB interface (as far as I know). It's programmed through the ISP or JTAG pins using external hardware to adapt to a PC. The programmer is really inexpensive, and easy to use. Not much of an impediment.
 
There is also an Appnote from Atmel on how to implement a CAN-based firmware loader.
If you wanted to embed your own CAN controller under the dash, this would be the way to go. You could reflash it from the DLC.

Search for "AVR076: AVR CAN - 4K Boot Loader"
 
For the moment I would probably be happy with just implementing the SOC meter, although just for fun.
In theory we would just need the olimex testboard, a CAN connector, a display and some code to upload to the
board, correct?
 
klapauzius said:
For the moment I would probably be happy with just implementing the SOC meter, although just for fun.
In theory we would just need the olimex testboard, a CAN connector, a display and some code to upload to the
board, correct?
Yup. And a DB9 connector, of course. (And a programmer for the ISP/JTAG)
 
I bought an inexpensive programmer (RS232 to JTAG) for Atmel parts (says for AT90CAN128 and AVR-JTAG compatible) on ebay, and I will be testing it today and tomorrow.

I am using the AVR-GCC open source software for the PC (WinAVR for Windows OSs), and I THINK (maybe) I got the compile & link (Makefile) to work last night.

More exact details when I get it all tested. :D
 
How about this $15 USB "Pocket AVR Programmer" for AVR programming ?

http://www.sparkfun.com/products/9825

This new version uses an SMD 5x2 header. This is a simple to use USB AVR programmer. It is low cost, easy to use, works great with AVRDude, and is tested extensively on a Windows desktop.

09825-01b.jpg
 
Our CAN-Capture Hardware Parts List:

1. Three AVR-CAN Development boards, about $55 each, possibly from www.Mouser.com ... but the 16 MHz unit by Olimex, not the 8 MHz AVR-CAN-H? unit.

2. One 4-port RS232-to-(one)-USB adapter, about $70 from ??? (I will add the source later).

3. One male OBD cable, right-angle preferred, 16-pins, with all pins wired, about $13 from www.obd2cables.com (let me verify this item, which I have on order).

4. Three 9-pin "D" connectors, and three "shell" kits, possibly from Fry's Electronics. (Mouser has them, but rather more expensive, I think).

5. A suitable plastic box or enclosure to keep dust and dirt out of the electronics, about 8" x 6" x 4" (better numbers later), perhaps from Target or some such.

6. About a foot of shrink tubing, about 2 feet of stranded (not solid) wire.
 
Here's my idea for a lower cost build that can do 1 bus at a time:

Header Build for AT90CAN128 $29.95: http://www.sparkfun.com/products/655
What I like about this board is it has an ICSP header, so it can be programmed with a lower cost programmer such as my USBtinyISP instead of JTAG.

OBD cable $10.95: http://www.obd2cables.com/products/cable-j1962m-right-angle-to-open-6ft.html
I think you mentioned this cable somewhere else

HD44780-based LCD $6.80: http://cgi.ebay.com/New-1602-LCD-16...639?pt=LH_DefaultDomain_0&hash=item2311405eef

USBtinyISP for programming $22: http://www.adafruit.com/products/46
I have a clone that works fine, $13: http://cgi.ebay.com/USBtinyISP-AVR-...790?pt=LH_DefaultDomain_0&hash=item25606ad026

To talk to a computer via USB, a serial->USB adapter is needed. An FTDI cable would work, but I those who have spare Arduinos can also use those for development.

I'm ordering the parts I don't already have, and will post once I get everything working.
 
I like the idea of having a larger LCD display - so that we can display multiple things on it.

We should look for LCD displays that are easy to interface with. This should probably go in the other thread ...
 
I just added a CAN-Capture project Parts List to the first post.
About $300 in parts for a 3-channel CAN-Capture system.

For anybody interested, I have (or had):
1. one Kit available for about $400, or
2. a completed 3-Channel system for about $500.

(The downloadable Software requires a Windows XP, Vista, or Win7 system).
 
I still question the need to monitor all three CAN Buses.

One bus is simply the pushbuttons that surround the Nav system. Hardly worth the parts it takes to tap into that mundane data.
 
Monitoring one buss at a time might be quite enough for
even the few who will monitor anything.

Later, I will add a Parts List for One-Buss CAN-Capture.

I have captured all 3 busses, but not looked at the AV-CAN buss messages.

Later, we hope to do 4-buss data-capture, while we are
charging with the QC port. Any idea where best to connect
to the QC-CAN buss?
 
The (primary) CAN and EV-CAN both have interesting data, and it seems we do need to monitor both to get speed/distance and power information at the same time.

The AV-CAN, well, save your AT90CAN, I say.. :)
As far as I can tell, it's just the "multifunction" switch. Anyone find reason to poke there?
 
Back
Top