DIY AT90CANxx CAN-Capture Project

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.
In reply to the FOLLOWING post:

--------------------
Good thinking, it should make a good DIY project, but beyond most people's skills.

1. I think I also have a $13 JTAG programmer from ebay, if it actually works. If not, I believe there is another "tiny", low-cost, USB-to-JTAG programmer from SparkFun that will work. I have it on order.

2. Do you need to add the CAN transeiver as on the AVR-CAN board?

3. Do you need an RS232 level-generator & transeiver chip, with some caps?

4. The display needs to be mounted and its 4 + 8 = 12 lines connected to the uP board.

5. DB9F connector for the RS232 connection?

6. DB9M (or on-board holes) for connecting the four OBD cable wires?

7. Additional power regulator to handle the 14v from the car?

8. Will you make a daughter board to hold/do this stuff?

9. The labor to program, build, test, and assemble is fine for a skilled person's DIY Project, but might end up saving very little (or actually cost more) when producing a number of units, but still in low quantity.

---
However, if you are serious about the project, we will watch and comment, if you wish.
 
garygid said:
Good thinking, it should make a good DIY project, but beyond most people's skills.

1. I think I also have a $13 JTAG programmer from ebay, if it actually works. If not, I believe there is another "tiny", low-cost, USB-to-JTAG programmer from SparkFun that will work. I have it on order.

2. Do you need to add the CAN transeiver as on the AVR-CAN board?

3. Do you need an RS232 level-generator & transeiver chip, with some caps?

4. The display needs to be mounted and its 4 + 8 = 12 lines connected to the uP board.

5. DB9F connector for the RS232 connection?

6. DB9M (or on-board holes) for connecting the four OBD cable wires?

7. Additional power regulator to handle the 14v from the car?

8. Will you make a daughter board to hold/do this stuff?

9. The labor to program, build, test, and assemble is fine for a skilled person's DIY Project, but might end up saving very little (or actually cost more) when producing a number of units, but still in low quantity.

---
However, if you are serious about the project, we will watch and comment, if you wish.

------
Moderator, please take my post and the previous one and start a "DIY AT90CAN CAN-Capture Project" thread. Thanks.

Gary,

You have many valid questions.

I didn't know there were such cheap JTAG programmers on eBay. That's great if you can get one to work. One thing USBtinyISP is that it works easily with the Arduino IDE.

I didn't realize that a separate transceiver chip was needed, but adding a MCP2551 isn't all too hard.

Yes, I'm aware of the requirements for hooking up a display. At this moment, though, I'm more interested in USB connectivity to a Windows PC

I'm not going to do any RS-232 conversion. None of my PC's have an RS-232 port. It's easier to go straight from the uC to a USB->Serial converter.

Yes, 14V needs to be dealt with. Some additional components can handle that. To start, I was going to just hack a 9V cigarette lighter adapter that I have laying around.

One of the things I didn't like about the other board is the DB9 connectors. I'm buying an OBD cable with stripped ends, so it's easier for me to just attach them directly to the headers.

I'm just going to breadboard the thing while debugging it. Then I'll decide how I'll assemble something more compact to put in the car. Initially, I'll probably just
put all the parts on a proto board.

For volume production, a custom PCB would save a lot on cost. Right now, I'm just interested in hacking something together so I can play.
 
garygid said:
If you connect to the PC via USB, you will need some USB chip, and supporting firmware?

I decided to take advantage of the two on-chip UARTs in the AT90CAN128.
No, he's talking about integrating an Async to USB chip connected directly to the uC UART(s), then just having the USB connection available. It's handy because a mini or micro USB connector is nice and small, and PCs don't really have RS-232 ports anymore anyway. Plus he can skip the RS232 level shifter.
 
Good idea, TTL internal UART directly to "USB" chip.

It would be nice to just lay out one board, no need to
use the AT90CAN128 "header" board.

Doing that, it would be easy to put 3 CAN channels on the same board
and just not populate two if only one-channel data-capture was needed.

-------------
We use $3 USB to RS232 adapter cables when we connect
to a single AVR-CAN. For supporting 3 boards nicely,
I use the 4-port RS232 device, but it is more expensive, but
handy and high speed.

Use at least 115200 baud for transfering binary data,
and maybe twice that if you send compact ASCII data.
We send fixed length 11-byte binary for each message:

Sync Byte, MsgIDLo, MsgIDHi, D1, .... D8
Data count (0 to 8) is in the high nibble of MsgIDHi
Missing data bytes are 0xFF.

Let me know what display you find.

Chris showed us one that includes a micro SD card.
Then, "hidden" logging could be done without a PC needed!

As we log, we add a 2-byte second and millisecond time
stamp to each message, and (intend to) insert a date-time
Pseudo-Message (Msg ID = 0xFFFF) once every minute.

Cheers, Gary
 
davewill said:
No, he's talking about integrating an Async to USB chip connected directly to the uC UART(s), then just having the USB connection available. It's handy because a mini or micro USB connector is nice and small, and PCs don't really have RS-232 ports anymore anyway. Plus he can skip the RS232 level shifter.

Right, I like to use offboard USB->Serial adapters. Sparkfun sells them as "FTDI cables." http://www.sparkfun.com/products/9718
But It just plugs into a 4-pin header. On the PC side, it's standard USB. Using 4 of these, you could connect 4 serial ports to your PC. If your PC doesn't have that many free ports, a cheap 4-port hub would let you connect all 4 into just 1 USB port
 
Good price, but what does in include, and
what does it take to program and load firmware into it?

I we were making a lot of these, making our own circuit board would be good, including a display, etc. However the OC-Meter is more of a special tool o help us understand the LEAF's Bars, and LEAF's real range limitations.
 
garygid said:
Good price, but what does in include, and
what does it take to program and load firmware into it?

Here is the user manual and other stuff ....

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en537141&part=MCP2515DM-BM
 
How does one connect the MCP2551 bus transceiver to the CAN bus?
I see the pinouts of the OBD-II connector in this post:

http://www.mynissanleaf.com/viewtopic.php?f=44&t=4131

Does one just connect CANL -> CANL and CANH -> CANH? Do we need to connect anything else, e.g. ground?

For instance, say one is using the AVR-CAN dev board from olimex. I see from the schematic
http://www.olimex.com/dev/pdf/AVR-CAN.pdf of this board,

MCP2551 CANL -> DB9 pin 2
MCP2551 CANH -> DB9 pin 7

From the other post, say we want to listen to the EV bus. We have EV CAN-L (12), EV CAN-H (13) on the OBD-II connector.

So do we just connect

(MCP2551 CANL -> DB9 pin 2) -> EV CAN-L (OBD-II 12)
(MCP2551 CANH -> DB9 pin 7) -> EV CAN-H (OBD-II 13)

Is this correct? Any other signals need to be connected?

I noticed from the schematic of the AVR-CAN board that there is a 120 resistor between CANH and CANL, but it doesn't seem to be connected across jumper pad CAN_T. Am I correct, or is there really a 120 ohm resistor connected between CANL and CANH. Can someone who owns this board verify for me?

Thanks in advance.
 
garygid said:
1. I think I also have a $13 JTAG programmer from ebay, if it actually works. If not, I believe there is another "tiny", low-cost, USB-to-JTAG programmer from SparkFun that will work. I have it on order.

Gary, did you ever get this JTAG programmer to work? Does it do debugging as well? Do you have a link to it?
Thanks.
 
lincomatic said:
So do we just connect

(MCP2551 CANL -> DB9 pin 2) -> EV CAN-L (OBD-II 12)
(MCP2551 CANH -> DB9 pin 7) -> EV CAN-H (OBD-II 13)

Yes - though most also connect ground and VIN for power.
 
evnow said:
lincomatic said:
So do we just connect

(MCP2551 CANL -> DB9 pin 2) -> EV CAN-L (OBD-II 12)
(MCP2551 CANH -> DB9 pin 7) -> EV CAN-H (OBD-II 13)

Yes - though most also connect ground and VIN for power.

Thanks. And we don't need the 120 ohm termination resistor, between CANL & CANH, correct?
 
Not for a logger.
The CANbus in the car already has the termination at each end.
I don't know how far you can run an (unterminated) tap off the DLC, but I've run some long cords and been just fine.
 
The AVR-CAN has a provision to "connect" the resistor (needed if
terminating the un-terminated end of a CAN buss.
Solder-bridge the 1 and 2 sides of the CAN_T option.
Here, we do not use the terminating resistor.

There is a 10k pullup on RS (pin 8) to inhibit the interface
from writing to the CAN buss.
 
I'm having trouble getting the serial port to work properly on my AT90CAN128 header board. When I try to read back data on my PC, I'm just getting garbage. I think there might be a problem with my Arduino library. If someone could send me a HEX file that just repeatedly writes a string to either serial port, I'd greatly appreciate it. I want to figure out if my problem is software or hardware. Thanks in advance.
 
Back
Top