USB-CAN adapter

New boards that are planned or are in development

USB-CAN adapter

Postby jbelanger » Fri Jan 28, 2011 9:51 pm

This is a little preview of an upcoming board that will allow communication between the PC and an MS2, MS3 or I/O Extender to be done using a USB port on the PC and the CAN bus on the ECU.

The device will be seen by the PC as a USB-serial adapter so the tuning programs will work as before (but you'll have to enable CAN commands). However, since the adapter will be plugged in the PC, the only USB bus exposed to interference will be the USB connector and the traces on the board and the wires going to the ECU will be the CAN bus wires (twisted pair). As the CAN bus protocol is designed to handle a noisy environment at the transport layer, the communication should be more reliable than using a USB or RS-232 cable.

Also, since the board uses the well proven FTDI chip, the drivers will be available for all platforms and it will be possible to use the FTDI API to increase the speed. This will require collaboration with the tuning software designers.

I also intend to develop a CAN bootloader for the MS2 and MicroSquirt module that will allow the use of the CAN bus to load new code making the serial port redundant. However, that will require reprogramming the CPU using a BDM but I will be offering this service for the people who purchase the adapter. I still have to make sure this can be made to fit in the reserved flash area of the CPU but based on my experience with the I/O Extender, it should be feasible.

So here are a few pictures of the first prototype. The hardware, as seen in the pictures, works but the firmware still needs some work.
Image
Image
Image
Image

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby UnaClocker » Fri Jan 28, 2011 10:29 pm

Awesome. What connections from the MS go to this? CAN H/L, power and ground? Is there some kind of quick disconnect or will this be hardwired? Lemme know when you have these available to purchase, I want one. :)
'84 Dodge Rampage - MS3
UnaClocker
 
Posts: 165
Joined: Mon Oct 12, 2009 12:10 pm

Re: USB-CAN adapter

Postby jbelanger » Fri Jan 28, 2011 10:39 pm

It's CANH/L and ground. The power is taken from the USB port. And I'm not sure yet that the ground connection is needed: I know it works without one on the bench but that may be a fluke.

As for connection on the CAN side, there are a few options with some possible connectors on the board or hardwiring. I have a set of 0.1" pads and a set of 2.5mm pads (on the right side of the board in the pictures) which will work with some easily available connectors or even simple right angle headers. And you can also use a stereo jack on the MS side but that may be confusing since this is also used for RS232 in other applications.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby UnaClocker » Sat Jan 29, 2011 2:06 am

I don't suppose this will allow us to run higher speeds than the MS serial would normally support? Like 230k instead of the standard 115k, which seems like it'd be real handy for someone with several CAN devices trying to get data out.. What's the CAN speed, 500k?
'84 Dodge Rampage - MS3
UnaClocker
 
Posts: 165
Joined: Mon Oct 12, 2009 12:10 pm

Re: USB-CAN adapter

Postby turbo355 » Sat Jan 29, 2011 5:20 am

How long do you think it will be before they will be ready to sell?

I will be ready for a few as soon as they are ready.
turbo355
 
Posts: 25
Joined: Wed Jan 19, 2011 5:48 pm

Re: USB-CAN adapter

Postby Rod S » Sat Jan 29, 2011 8:38 am

You can put me on the waiting list officially now too Jean :D

Re. the CAN connections, personally I would prefer it as it is at the moment, just the pads so I could make my own cable of an appropriate length and choose a connector of my own which wasn't likely to be confused with any thing else I've got.

How would this work with your IOx - I thought CAN had to be daisy chained (like original 10base ethernet) but there are only two wires coming from the MS2 daughterboard to the DB37 - or is it acceptable to have the node that far away from the CAN interface chip on the MS2 ?

Rod.
Rod S
 
Posts: 310
Joined: Mon Sep 06, 2010 4:03 am
Location: Rural Suffolk, England, UK

Re: USB-CAN adapter

Postby jbelanger » Sat Jan 29, 2011 11:17 am

Higher speed is something I want to do but that's going to need the collaboration of the tuning software designers. With the clock speed on the board (fixed by the FTDI chip and USB bus), 115200 is the highest standard serial speed that can be done but it would be possible to do 250k or 500k with the FTDI API. And with the MS CAN bus going at 500K it certainly not worth going higher and might not be worth going more than 250k. But even that would be an significant improvement.

As for availability, I'm not sure at this point but it should not be too long since it's basically using code blocks similar to the IOx code. I have a few boards right now that I want to assemble and have some people try and test and there should be some left over for others who want one. But I may want to make an update or two to the board and in any case I'll need to have more boards made so it would be between 1 and 2 months.

One of the changes I can see is having the device isolated from the CAN bus. At the moment the power is taken from the USB port and there are 3 wires going to the ECU: CANH CANL and ground. So the ground is shared between the ECU (and other CAN devices) and the PC. In a fully isolated scenario, the USB port would still power most of the adapter but there would be an additional 5V wire between the adapter and the ECU. That would power just the CAN transceiver on the adapter and the power and ground on the PC side would remain completely isolated from the power and ground on the CAN bus side.

The isolation would be a nice thing but that would require an additional wire. And I'm not sure if that would actually make a difference for most of the people. But there has been some people having communication issues with the serial port when their laptop was connected to an inverter in the car since the inverter had a ground offset. The isolated adapter would solve that.

So would you consider it an advantage to have an isolated device despite the need to run one more wire? The wires needed are small gauge so it would still remain a very small cable.

As for connecting multiple devices, you simply need to tap into the CANH/L wires connecting the MS2 and the IOx (I would do it at one of the connectors). The CAN bus is simply the CANH and the CANL wires with devices dropping off of this. It's not really a daisy chain as much as a real bus with devices connected to it. And I'm not sure what you mean by the distance from the CAN interface chip on the MS2 since it is the same type of chip on all devices. As long as the total bus length is less than 100m (at 500kb/s) it will be ok.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby Rod S » Sat Jan 29, 2011 12:00 pm

jbelanger wrote:So would you consider it an advantage to have an isolated device despite the need to run one more wire? The wires needed are small gauge so it would still remain a very small cable.


Personally I would prefer the isolated solution - the cable is cheap, spending time trying to solve grounding issues is not.

jbelanger wrote: And I'm not sure what you mean by the distance from the CAN interface chip on the MS2 since it is the same type of chip on all devices.


Because I was assuming a daisy chain - if the devices were both connected at the DB37 there would be the wires inside the MS2 box that weren't part of the chain but a Tee off the chain.
I had a mental picture that the wires should be running to one device then on to the next, rather than Tees off a bus.

Hope that makes sense.


Another question, does this kind of bus need terminating resistors at either end once you start expanding it ?

Rod.
Rod S
 
Posts: 310
Joined: Mon Sep 06, 2010 4:03 am
Location: Rural Suffolk, England, UK

Re: USB-CAN adapter

Postby jbelanger » Sat Jan 29, 2011 12:20 pm

Rod S wrote:
jbelanger wrote:So would you consider it an advantage to have an isolated device despite the need to run one more wire? The wires needed are small gauge so it would still remain a very small cable.


Personally I would prefer the isolated solution - the cable is cheap, spending time trying to solve grounding issues is not.

Agreed. I also think this is the best solution. I wish I had thought of that before having these boards made but it will still be a useful development platform and definitely a useful test bench tool.

Rod S wrote:
jbelanger wrote: And I'm not sure what you mean by the distance from the CAN interface chip on the MS2 since it is the same type of chip on all devices.


Because I was assuming a daisy chain - if the devices were both connected at the DB37 there would be the wires inside the MS2 box that weren't part of the chain but a Tee off the chain.
I had a mental picture that the wires should be running to one device then on to the next, rather than Tees off a bus.

Hope that makes sense.

I see what you mean.

Rod S wrote:Another question, does this kind of bus need terminating resistors at either end once you start expanding it ?

Rod.

Normally you should but it seems that it's not too fussy about it. But the IOx and the adapter have been designed for this. You should have the MS2 at one end and its on-board resistor (non-removable) will be terminating that end. If the IOx is in the middle, you'll simply need to remove the solder jumper that is just besides the CAN transceiver (between the CPU and the proto area).

And the USB-CAN adapter has a DIP switch (not in the picture but the placement can be seen at the bottom of the board) which can connect and disconnect the resistor. But it will usually be at the end of the bus so will likely be switched on.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby Rod S » Sat Jan 29, 2011 2:03 pm

OK, Jean,

I see the solder jumper you mean on the IOx board, right above R3.

I'm guessing R3 is the terminating resistor for the bus.

The logical sequence (as the terminating resistor is fixed on the MS2) is,
MS2 to IOx to CANUSB
Otherwise the CANUSB would require a cable in and out.

So just a suggestion for the future, could you make the terminating resistor on the IOx switchable (like you say you have done on the CANUSB card) or at least a 0.1" jumper so I don't need my Mr Magoo glasses on to desolder it :D

Rod.
Rod S
 
Posts: 310
Joined: Mon Sep 06, 2010 4:03 am
Location: Rural Suffolk, England, UK

Re: USB-CAN adapter

Postby jbelanger » Sat Jan 29, 2011 2:28 pm

Actually, thinking about it and having read the datasheet on the isolated CAN transceiver, you could do something simpler. You can consider that the MS2 to IOx CANH/L wires are the CAN bus and the wires from the USB-CAN to either device (or even the middle of the bus) is the tee off for the adapter. Then you simply keep the MS2 and IOx terminating resistors and switch off the adapter resistor.

What the bus needs is a 60 Ohm resistance which the two 120 Ohm terminating resistors provide and the wiring contribution is negligible. Of course that wouldn't work with a very long wire since you need to take impedance and capacitance into consideration but I think it would work fine in this case assuming you don't need a cable that is more than a few feet.

And I also need my Mr Magoo glasses when soldering it. I'll think about doing something else for future versions but I also have to think about what would fit within the board stack. A standard 0.1" jumper would not work unless done with a right angle header.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby Stu_D » Sat Jan 29, 2011 2:54 pm

This is looking very nice Jean

Fully isolated does sound best, might as well do it properly :)

Is this ever likely to end up on a future version of the I/O Extender?

jbelanger wrote:
I also intend to develop a CAN bootloader for the MS2 and MicroSquirt module that will allow the use of the CAN bus to load new code making the serial port redundant. However, that will require reprogramming the CPU using a BDM but I will be offering this service for the people who purchase the adapter. I still have to make sure this can be made to fit in the reserved flash area of the CPU but based on my experience with the I/O Extender, it should be feasible.



You mention here that you are planing to develop a CAN bootloader for MS2/Microsquirt that could make the serial port redundant, Would the board ever be available as a daughter card to make a in box solution for MS2 or Microsquirt?

It would be nice to totally do away with the serial connector on the MS2 and replace it with a mini USB connector or something so a bog standard cable could be used for tuning. Although this could be tricky on the V3 main board, could maybe hang it beneath on a header where the RS232 chip is and use the serial connector mounting holes for extra support, and probably a new little hole in the end plate for a USB. Or probably easer, a card that mounts in a spare case slot like the others.

The outdated V3 PCB is the weak link in all things Megasquirt these days :( Its just crazy when you look at how much can be left out when using your boards.

I'm probably day dreaming but oh well. :roll: Would be really nice on a new uS based design though, like if you ever made a Microsquirt carrier board for the I/O Extender.

Or is the howl idea to do away with the common serial/USB cables for something more resilient to interference?

I was going to mention that you could trick the USB-CAN adapter in to thinking it was the middle if the bus meaning no resistors need removing but you beat me to it. Its not impossible to remove or short R11 the MS2 terminating resistor. Not any harder than some of the other MS2 card mods to use sequential code or spare pins PE0/PE1 anyway. I'm sure it would be possible to graft on a two pin header or something so it is switchable too.
Stu_D
 
Posts: 18
Joined: Wed May 19, 2010 7:06 pm

Re: USB-CAN adapter

Postby jbelanger » Sat Jan 29, 2011 4:31 pm

The main idea is indeed to do away with the RS232 and USB cable since these are not designed to go in a harsh environment like a car. This means the software on both sides have to do the work to handle the noise. CAN has that built it so an exposed CAN cable should be less of an issue. And this should also make it easier and more reliable to go to a higher data rate.

As for making it a daughter card, that would defeat the purpose mentioned above. There are already solutions to have a mini USB port on the V3 board available from DIY (but I'm not sure how reliable it is). And the IOx has one on the logger board but I need to add the CAN passthrough code to use it for an MS connected to the IOx. This will come together with the code for the USB-CAN adapter.

And thinking more about the fully isolated solution, it seems more and more like the way to go. And the best connector for the ECU side might well be a 4 contact 3.5mm plug and jack. This would be compact and simple and using a 3.5mm would differentiate this from the 2.5mm serial connector. You could put the jack on the end plate of the MS, the IOx or on the dash with wires going to the MS and IOx.

And when I do the Microsquirt module carrier for the IOx, it will likely use this connector to be used with the USB-CAN adapter.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby Rod S » Sun Jan 30, 2011 4:53 am

Jean,

One final thought from me - physical layout.

From the photos, the usb "plug" is central along the "short" edge of the case but the "short" edge is still quite long.

On both my laptops the pair of USB ports are side by side and very close together.

It is quite likely it would block the second USB port once plugged in.

Other laptops I've seen have the USB connectors above one another so the thickess of the case could be a problem if the "plug" is also central vertically.

Obviously the way I would get around it (as it is now) would be to plug it in via a short USB extension lead but, if you do have to re-design it, it might be worth considering the limitations imposed by an average laptop.

Rod.
Rod S
 
Posts: 310
Joined: Mon Sep 06, 2010 4:03 am
Location: Rural Suffolk, England, UK

Re: USB-CAN adapter

Postby jbelanger » Sun Jan 30, 2011 9:53 am

Rod,

Those were concerns of mine but it's not an easy thing to fix. I also have physical and electrical constraints and need to use a commonly available box. So that may remain a constraint for user that the box uses up the 2 USB ports but I'll see what can be done. Do you usually need the other port when tuning?

And back on the terminating resistor, I just realized that the option of keeping them on both the IOx and MS2 and disabling it on the adapter is actually the only valid one. The adapter will not be a permanent part of the CAN bus and will only be there when the laptop is used for tuning and upgrading. And since there will likely be CAN communication between the MS2 and IOx to transfer some data, the bus will need 2 terminating resistors.

So the way to go will be to enable the terminating resistor on the USB-CAN adapter when communicating with a single device and disabling it when there is more than one device on the CAN bus.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby Rod S » Sun Jan 30, 2011 10:23 am

Jean,

The second USB port in my case would be a mouse.......

I'm one of those people that can't stand the "touchpad" on laptops and always plug in an optical mouse - works on the car seat or the knee of my jeans etc. :D

If you were prepared to sell it, like you do with your new VR conditioner board, in a "complete" potted version and a "board only" version (but still with the case) I would take the board only version and get around the problem by cutting a spare USB cable in half and putting a short USB flying lead onto the board. Every single consumer electronics product you buy over here has a USB cable included, I have dozens of spares. That also gives the option for the user to choose his/her own CAN cable and connector. The only slight issue would be that your USB end seems to have SMD pads only whereas the CAN end has through hole pads which are obviously easier for attaching a cable.

Rod.

EDIT - and good point about the terminating resistor, I hadn't thought about the fact it would be unplugged most of the time.
Rod S
 
Posts: 310
Joined: Mon Sep 06, 2010 4:03 am
Location: Rural Suffolk, England, UK

Re: USB-CAN adapter

Postby jbelanger » Sun Jan 30, 2011 11:24 am

Rod,

Something like that could be used. That would have the added benefit of not adding a USB wire that could catch some EMI.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby jbelanger » Sun Jan 30, 2011 3:19 pm

Rod,

I just tried on my laptop and my desktop and without the case lid I can use the USB port that is just above the one used by the adapter. So if I put spacers under the board mounting points to make the USB connector flush with the case top (without the lid), it should work with the lid installed. I'll have to see what that does with the DIP switch and may mean having to cut the lid for this.

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Re: USB-CAN adapter

Postby Rod S » Sun Jan 30, 2011 3:34 pm

Jean,

My thoughts were if you had to re-design the board you could move the connector sideways to one corner.

If you also spaced it upwards like you are thinking then it would fit a laptop with either the USB ports close sideways or close top to bottom.

Having the terminating resistor DIP switch accessible through the top of the case would surely be a good idea ?


Having said that, I can't see a short USB flying lead being a problem, it will be a long way from any interference and I currently have 3 X 1m RS232 cables out of the laptop (via plugin USB/RS232 convertors) to the MS2 and TechEdge stuff I use with no obvious problems. (the actual laptop I'm currently using has 4 USB ports thanks to a plugin PMCIA card but they are still very close together, more so on the PMCIA card).

Rod.
Rod S
 
Posts: 310
Joined: Mon Sep 06, 2010 4:03 am
Location: Rural Suffolk, England, UK

Re: USB-CAN adapter

Postby jbelanger » Sun Jan 30, 2011 4:37 pm

I can't move the connector to the side very much because there will be some interference and there may also be some routing issues.

So I'll keep the option of moving the board closer to the top. However that means finding the appropriate spacers and screws and cutting a bit of the cover (locating lip). And if the DIP switch has to get an opening then that means more cutting which makes it a lot of hand work for me if I want to sell complete units (which I do). So I either work for free or charge more.

Having the DIP switch available through the top is practical but it also means it could be accidentally switched which may cause issues. If the switch is slightly recessed then accidental switching should be minimal.

And you're probably right that a short USB extension should have minimal impact. And since there are some 6" one available on Ebay for a few $, it's probably a good option for those who will have issues with plugging the adapter directly to the PC (if I keep the current configuration).

Jean
Image
jbelanger
 
Posts: 3578
Joined: Sat Oct 03, 2009 12:24 pm
Location: Quebec, Canada

Next

Return to New Boards

Who is online

Users browsing this forum: No registered users and 1 guest

cron