Author Topic: USB to CAN Converter  (Read 6297 times)

0 Members and 1 Guest are viewing this topic.

Offline afhoTopic starter

  • Contributor
  • Posts: 15
USB to CAN Converter
« on: May 11, 2010, 02:06:35 pm »
Hello,

this is my first real project i make in electronics design. It is a little USB to CAN converter you can plug to the USB-Port of your PC an to a CAN-Network (for example to trace the communication between ECUs in a modern car).

I started the design by a little pcb witch i can etch an solder at home, so i used parts that i can handle easy. The case i choose is the case i want to use with the final design made in SMD.

So here is my design! Please tell me all you think about it! I am very happy about constructive criticism!

To my background: I am an software-engineer mainly developing software for embedded systems or test equipment. Developing electronics design is not my job at work, but i tryed to "keep my mind open". I have knowledge about electronics witch i need to develop software for embedded devices.

Thanks.
Alexander
« Last Edit: May 11, 2010, 02:21:59 pm by afho »
 

Offline charliex

  • Frequent Contributor
  • **
  • Posts: 346
  • Country: 00
  • Car Hacker
Re: USB to CAN Converter
« Reply #1 on: May 11, 2010, 05:22:42 pm »
It's useful to add a switchable 120Ohm resistor to the CAN as some cars will need it to talk.. On my usb<>can i have it wired in permanently with a solder blob jumper thats normally closed  if i want to remove it,
 

Offline afhoTopic starter

  • Contributor
  • Posts: 15
Re: USB to CAN Converter
« Reply #2 on: May 11, 2010, 09:31:30 pm »
Hello,

thanks for your reply!

To add a 120Ohm resistor was a idea i also thought about, but i dont want to open the case to enable the resistor. A way to do this is by adding a relay, but this will make my design to big, and as a normal CAN-Node i dont need a resistor. The way i prefer to add a resistor to a CAN-Connection is by using a cable with an integrated resistor.

How did you realize your usb<>can converter?

Kind regards
Alexander
 

Offline charliex

  • Frequent Contributor
  • **
  • Posts: 346
  • Country: 00
  • Car Hacker
Re: USB to CAN Converter
« Reply #3 on: May 12, 2010, 06:46:08 am »
Well a dip switch works well too, I've found some cars work without it, others won't.

I used an AT90CAN128 , FT232R and MCP2551 with a dataflash for some storage.

 

Offline afhoTopic starter

  • Contributor
  • Posts: 15
Re: USB to CAN Converter
« Reply #4 on: May 12, 2010, 07:53:38 am »
The AT90CAN128 has an external bus, where you connect the dataflash? What are your experience with the FT232R. My first idea was to make the converter simple with an FT245R, an SJA1000 and a MCP2551 so i dont need an microcontroller. RX and TX LEDs can directly connected to the RX and TX lines between the SJA and the MCP. But i have no experience with the chips from FTDI.
« Last Edit: May 12, 2010, 12:17:48 pm by afho »
 

Offline wd5gnr

  • Regular Contributor
  • *
  • Posts: 179
Re: USB to CAN Converter
« Reply #5 on: May 12, 2010, 12:01:25 pm »
I'm not CAN savvy but could you have two connectors, one with the resistor and one without? Not much extra space and would be handy.
 

Offline charliex

  • Frequent Contributor
  • **
  • Posts: 346
  • Country: 00
  • Car Hacker
Re: USB to CAN Converter
« Reply #6 on: May 12, 2010, 04:23:06 pm »
The DataFlash connects to the SPI bus, i used a level convertor M74VHC1GT125DF2G  for the SO, the Dataflash can tolerate 5V inputs, and a 100K pullup on the 5V for the CS worked for me, i also have the CS connected to the convertor, though if you've only got one SPI item, this won't matter.

I've used the FT232 variants a few times (bm/br/rt), its a decent chip, easy to do in bus power, self power or shared mode. has a 3.3v output too if you choose to use it, i didn't and went with a seperate 3V VREG. It's cheap enough and easy to get a hold of and they have drivers for the major OS'es.

The drivers are the best of the worst, from my POV all USB<>Serial chip drivers are bad in one way or another, they either don't support overlapped io or they're just flakey. The FTDI ones don't support the overlapped, but they've not had BSOD or disconnect problems with them, I have had oddities with them but nothing show stopping. I've mainly  just justed them as tx/rx/gnd and then do all the handshaking in software. Typically use them at 115K but have done 230. I'm using a 16Mhz xtal on the AVR, there are tables where the baudrate error margins are listed for different xtal speeds.

Though I'd be wary of the AVR if you're planning to do a run of the boards, I've had nothing but problems sourcing AVR's, and I'm not the only one. I eventually had to cut the firmware i'd written from using the 128K CPU to the 64K CPU because they're the only ones i could find. But i was pretty much at the point where I decided to switch to an ARM or something just because of the chip shortage, granted its affecting a lot of chips, but the AVR's just seem to suffer more.

I suppose you could always do the resistor switch on the CPU too. with a spare output.

I've also considered adding opto isolation, I probably will do this on the next rev of the board, it makes a lot of sense.
 

Offline afhoTopic starter

  • Contributor
  • Posts: 15
Re: USB to CAN Converter
« Reply #7 on: May 16, 2010, 11:21:27 am »
Can you send me the design of your board?

Where do you live? I life in Germany, and it is quiet easy to get some AVR devices. Only the newes models are hard to get.

On my next design / revision of the board, I want to use SMD to save space. I want to add some memory to the device for tracing CAN without a PC. Adding a SD-Card seems to be good for storage data.

Optoisolation is also a good idea!

Here is the first populated prototype of the board, in the case I have choosen. The only thing I dont like is the space around the USB-Conector. The case is designed for RJ45-Conectors and not for USB, but I will add some rubber surrounding to fill the space.
« Last Edit: May 16, 2010, 06:52:53 pm by afho »
 

Offline charliex

  • Frequent Contributor
  • **
  • Posts: 346
  • Country: 00
  • Car Hacker
Re: USB to CAN Converter
« Reply #8 on: May 17, 2010, 04:05:14 pm »
Looks good. I'm a european living in las vegas and los angeles, usa.

I use something along the lines of this. http://www.olimex.com/dev/images/AVR-CAN-sch.gif this should give you a good starting circuit, the DK90 CAN from AVR also has a good schematic.

Finding AVR's in one off's etc is somewhat easier, but buying them in bulk has been a problem, i've tried a lot of places all over the world.

SD card is a good idea to add, i went with the DF for cost and simplicity, since i'm reflashing ecu's with it, not really data logging.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf