EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Interfacing SJA1000 CAN controller to embedded PC

Started by Unknown March 16, 2012
I have a project coming up which will involve 5 - 10 CAN nodes, 
implemented in ARM9 microcontrollers.  The CAN bus will run a 1Mbit, 
using 11 bit identifiers.  About half the nodes will be in the same 
physical box, the others will be in various sensor / user interface 
boxes connected via short lengths of cable.
There is also an embedded Windows PC in the main box, which we want to 
use to snoop on the CAN transactions to drive a mimic display, etc.  
There's also the possibility of doing all the MCU firmware upgrades via 
CAN.

So, what's the least-effort way of interfacing a 1Mbit CAN bus to a 
Windows PC?  This has to be a chip-level solution; plug-in cards are no 
good for space reasons.  PC host interfaces available are:

- USB 2.0
- PCI Express
- LPC

Now the difficult bit : I'm a hardware engineer, I don't write code 
(unless you count VHDL).  We have people who write bare-metal C for 
MCUs, and other people who write Visual Studio .NET for PCs, but nothing 
in between.  Our last attempt to write a driver using the Windows DDK, 
for a fairly simple peripheral implemented in an FPGA, took months and 
months to get working properly.  Hence an off-the-shelf driver is pretty 
much a must.

Two options I've looked at so far using the ubiquitous SJA1000 
controller:

- USB interface via FT2232H in MCU Host Bus Emulation Mode
  This looks attractive to begin with, all the PC-side code is at the 
application level.  All the comments I've read say that this won't keep 
up with a 1Mbit CAN bus, mainly due to the limited interrupt support in 
the FT2232.
- LPC interface using address decoding, SERIRQ and other glue logic in a 
CPLD
  I already have LPC interface code in VHDL which works well in an 
existing product (but polled I/O only, using DLPORTIO), the difficult 
bit is the Windows device driver.  Are there any off-the-shelf drivers 
available which might fit the bill?  Commercial or open-source, I don't 
mind.

Or if anyone has any better suggestions for how to do this, I'm all 
ears.

TIA
On 16/03/12 12:14, news@rblack01.plus.com wrote:
> > I have a project coming up which will involve 5 - 10 CAN nodes, > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, > using 11 bit identifiers. About half the nodes will be in the same > physical box, the others will be in various sensor / user interface > boxes connected via short lengths of cable. > There is also an embedded Windows PC in the main box, which we want to > use to snoop on the CAN transactions to drive a mimic display, etc. > There's also the possibility of doing all the MCU firmware upgrades via > CAN. > > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a > Windows PC? This has to be a chip-level solution; plug-in cards are no > good for space reasons. PC host interfaces available are: > > - USB 2.0 > - PCI Express > - LPC >
Exactly how much space do you have available? Could you fit a 50mmx35mm board in there somewhere? Andy
On Fri, 16 Mar 2012 12:48:20 +0000, Andy Sinclair (andy@invalid.invalid) 
wrote:
> On 16/03/12 12:14, news@rblack01.plus.com wrote: > > > > I have a project coming up which will involve 5 - 10 CAN nodes, > > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, > > using 11 bit identifiers. About half the nodes will be in the same > > physical box, the others will be in various sensor / user interface > > boxes connected via short lengths of cable. > > There is also an embedded Windows PC in the main box, which we want to > > use to snoop on the CAN transactions to drive a mimic display, etc. > > There's also the possibility of doing all the MCU firmware upgrades via > > CAN. > > > > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a > > Windows PC? This has to be a chip-level solution; plug-in cards are no > > good for space reasons. PC host interfaces available are: > > > > - USB 2.0 > > - PCI Express > > - LPC > > > Exactly how much space do you have available? > Could you fit a 50mmx35mm board in there somewhere? > > Andy >
Possibly. I just found this: www.ixxat.com/can-ib120_can-interface_en.html which would do the job. Probably not much bigger than the SJA1000 + transceiver + CPLD I was considering.
<news@rblack01.plus.com> wrote in message 
news:MPG.29cd3f1eaaf8338e989681@reader80.eternal-september.org...
> > I have a project coming up which will involve 5 - 10 CAN nodes, > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, > using 11 bit identifiers. About half the nodes will be in the same > physical box, the others will be in various sensor / user interface > boxes connected via short lengths of cable. > There is also an embedded Windows PC in the main box, which we want to > use to snoop on the CAN transactions to drive a mimic display, etc. > There's also the possibility of doing all the MCU firmware upgrades via > CAN. > > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a > Windows PC? This has to be a chip-level solution; plug-in cards are no > good for space reasons. PC host interfaces available are: > > - USB 2.0 > - PCI Express > - LPC > > Now the difficult bit : I'm a hardware engineer, I don't write code > (unless you count VHDL). We have people who write bare-metal C for > MCUs, and other people who write Visual Studio .NET for PCs, but nothing > in between. Our last attempt to write a driver using the Windows DDK, > for a fairly simple peripheral implemented in an FPGA, took months and > months to get working properly. Hence an off-the-shelf driver is pretty > much a must. > > Two options I've looked at so far using the ubiquitous SJA1000 > controller: > > - USB interface via FT2232H in MCU Host Bus Emulation Mode > This looks attractive to begin with, all the PC-side code is at the > application level. All the comments I've read say that this won't keep > up with a 1Mbit CAN bus, mainly due to the limited interrupt support in > the FT2232. > - LPC interface using address decoding, SERIRQ and other glue logic in a > CPLD > I already have LPC interface code in VHDL which works well in an > existing product (but polled I/O only, using DLPORTIO), the difficult > bit is the Windows device driver. Are there any off-the-shelf drivers > available which might fit the bill? Commercial or open-source, I don't > mind. > > Or if anyone has any better suggestions for how to do this, I'm all > ears. > > TIA
Not an SJA1000 but I used a CANdo USB to CAN module from http://www.cananalyser.co.uk/ and it worked a treat.
On Fri, 16 Mar 2012 14:04:24 -0000, <news@rblack01.plus.com> wrote:

>On Fri, 16 Mar 2012 12:48:20 +0000, Andy Sinclair (andy@invalid.invalid) >wrote: >> On 16/03/12 12:14, news@rblack01.plus.com wrote: >> > >> > I have a project coming up which will involve 5 - 10 CAN nodes, >> > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, >> > using 11 bit identifiers. About half the nodes will be in the same >> > physical box, the others will be in various sensor / user interface >> > boxes connected via short lengths of cable. >> > There is also an embedded Windows PC in the main box, which we want to >> > use to snoop on the CAN transactions to drive a mimic display, etc. >> > There's also the possibility of doing all the MCU firmware upgrades via >> > CAN. >> > >> > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a >> > Windows PC? This has to be a chip-level solution; plug-in cards are no >> > good for space reasons. PC host interfaces available are: >> > >> > - USB 2.0 >> > - PCI Express >> > - LPC >> > >> Exactly how much space do you have available? >> Could you fit a 50mmx35mm board in there somewhere? >> >> Andy >> > >Possibly. I just found this: > >www.ixxat.com/can-ib120_can-interface_en.html > >which would do the job. Probably not much bigger than the SJA1000 + >transceiver + CPLD I was considering.
Also look at the offerings over at Peak http://www.peak-systems.com (distributor over at http://gridconnect.com/pcan/pcan-adapters.html) that are about that size. We use a bunch of their USB-CAN adapters to provide PC to CAN connectivity for monitoring the internals of various equipment. The as-built USB-CAN dongle sounds like it would be too large for your app but, perhaps, you could just crack the case and integrate the guts, which may fit and would happily chatter on your USB. May be okay for a onsie-twosie project; not so much for 10K units/week. Could be worth contacting Peak, though, and asking if they have an OEM version. For true chip-level, I'd look at a smaller micro with both USB and CAN; something like one of STMicro's STM32 Cortex-M3 family. Your bare-metal guys should be able to get one up and running without too much trouble. -- Rich Webb Norfolk, VA
On 16/03/12 15:04, Rich Webb wrote:
> Also look at the offerings over at Peak http://www.peak-systems.com > (distributor over at http://gridconnect.com/pcan/pcan-adapters.html) > that are about that size. > > We use a bunch of their USB-CAN adapters to provide PC to CAN > connectivity for monitoring the internals of various equipment. The > as-built USB-CAN dongle sounds like it would be too large for your app > but, perhaps, you could just crack the case and integrate the guts, > which may fit and would happily chatter on your USB. May be okay for a > onsie-twosie project; not so much for 10K units/week. Could be worth > contacting Peak, though, and asking if they have an OEM version. > > For true chip-level, I'd look at a smaller micro with both USB and CAN; > something like one of STMicro's STM32 Cortex-M3 family. Your bare-metal > guys should be able to get one up and running without too much trouble. >
The Peak PCAN-USB is what I had in mind. the board inside the plastic case is 50mmx35mm. It would certainly be easier than a custom interface for small volumes. Andy
On Fri, 16 Mar 2012 12:14:58 +0000, news wrote:

> I have a project coming up which will involve 5 - 10 CAN nodes, > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, > using 11 bit identifiers. About half the nodes will be in the same > physical box, the others will be in various sensor / user interface > boxes connected via short lengths of cable. There is also an embedded > Windows PC in the main box, which we want to use to snoop on the CAN > transactions to drive a mimic display, etc. There's also the possibility > of doing all the MCU firmware upgrades via CAN. > > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a > Windows PC? This has to be a chip-level solution; plug-in cards are no > good for space reasons. PC host interfaces available are: > > - USB 2.0 > - PCI Express > - LPC > > Now the difficult bit : I'm a hardware engineer, I don't write code > (unless you count VHDL). We have people who write bare-metal C for > MCUs, and other people who write Visual Studio .NET for PCs, but nothing > in between. Our last attempt to write a driver using the Windows DDK, > for a fairly simple peripheral implemented in an FPGA, took months and > months to get working properly. Hence an off-the-shelf driver is pretty > much a must. > > Two options I've looked at so far using the ubiquitous SJA1000 > controller: > > - USB interface via FT2232H in MCU Host Bus Emulation Mode > This looks attractive to begin with, all the PC-side code is at the > application level. All the comments I've read say that this won't keep > up with a 1Mbit CAN bus, mainly due to the limited interrupt support in > the FT2232. > - LPC interface using address decoding, SERIRQ and other glue logic in a > CPLD > I already have LPC interface code in VHDL which works well in an > existing product (but polled I/O only, using DLPORTIO), the difficult > bit is the Windows device driver. Are there any off-the-shelf drivers > available which might fit the bill? Commercial or open-source, I don't > mind. > > Or if anyone has any better suggestions for how to do this, I'm all > ears.
These guys were great when I last used their stuff (5 years ago). They would have to have worked hard to not be good now. http://www.kvaser.com/en/products/can/usb.html -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
On Fri, 16 Mar 2012 16:11:33 +0000, Andy Sinclair <andy@invalid.invalid>
wrote:

>On 16/03/12 15:04, Rich Webb wrote: >> Also look at the offerings over at Peak http://www.peak-systems.com >> (distributor over at http://gridconnect.com/pcan/pcan-adapters.html) >> that are about that size. >> >> We use a bunch of their USB-CAN adapters to provide PC to CAN >> connectivity for monitoring the internals of various equipment. The >> as-built USB-CAN dongle sounds like it would be too large for your app >> but, perhaps, you could just crack the case and integrate the guts, >> which may fit and would happily chatter on your USB. May be okay for a >> onsie-twosie project; not so much for 10K units/week. Could be worth >> contacting Peak, though, and asking if they have an OEM version. >> >> For true chip-level, I'd look at a smaller micro with both USB and CAN; >> something like one of STMicro's STM32 Cortex-M3 family. Your bare-metal >> guys should be able to get one up and running without too much trouble. >> >The Peak PCAN-USB is what I had in mind. the board inside the plastic >case is 50mmx35mm. >It would certainly be easier than a custom interface for small volumes.
It's pretty easy to get up and running for custom apps. In addition to a basic bus monitor (PCanView) it comes with a dll for MS Windows apps. That, plus my trusty Borland BCB5, is all that's needed for some snazzy monitoring. They also include a Linux driver; haven't played with that. -- Rich Webb Norfolk, VA
On Fri, 16 Mar 2012 14:43:27 -0000, Bill Davy (Bill@SynectixLtd.com) 
wrote:
> <news@rblack01.plus.com> wrote in message > news:MPG.29cd3f1eaaf8338e989681@reader80.eternal-september.org... > > > > I have a project coming up which will involve 5 - 10 CAN nodes, > > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, > > using 11 bit identifiers. About half the nodes will be in the same > > physical box, the others will be in various sensor / user interface > > boxes connected via short lengths of cable. > > There is also an embedded Windows PC in the main box, which we want to > > use to snoop on the CAN transactions to drive a mimic display, etc. > > There's also the possibility of doing all the MCU firmware upgrades via > > CAN. > > > > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a > > Windows PC? This has to be a chip-level solution; plug-in cards are no > > good for space reasons. PC host interfaces available are: > > > > - USB 2.0 > > - PCI Express > > - LPC > > > > Now the difficult bit : I'm a hardware engineer, I don't write code > > (unless you count VHDL). We have people who write bare-metal C for > > MCUs, and other people who write Visual Studio .NET for PCs, but nothing > > in between. Our last attempt to write a driver using the Windows DDK, > > for a fairly simple peripheral implemented in an FPGA, took months and > > months to get working properly. Hence an off-the-shelf driver is pretty > > much a must. > > > > Two options I've looked at so far using the ubiquitous SJA1000 > > controller: > > > > - USB interface via FT2232H in MCU Host Bus Emulation Mode > > This looks attractive to begin with, all the PC-side code is at the > > application level. All the comments I've read say that this won't keep > > up with a 1Mbit CAN bus, mainly due to the limited interrupt support in > > the FT2232. > > - LPC interface using address decoding, SERIRQ and other glue logic in a > > CPLD > > I already have LPC interface code in VHDL which works well in an > > existing product (but polled I/O only, using DLPORTIO), the difficult > > bit is the Windows device driver. Are there any off-the-shelf drivers > > available which might fit the bill? Commercial or open-source, I don't > > mind. > > > > Or if anyone has any better suggestions for how to do this, I'm all > > ears. > > > > TIA > > > Not an SJA1000 but I used a CANdo USB to CAN module from > http://www.cananalyser.co.uk/ and it worked a treat. >
OK, thanks, that's the smallest board-level module I've seen so far. I'll add it to the list.
On Fri, 16 Mar 2012 11:54:20 -0500, Tim Wescott (tim@seemywebsite.com) 
wrote:
> On Fri, 16 Mar 2012 12:14:58 +0000, news wrote: > > > I have a project coming up which will involve 5 - 10 CAN nodes, > > implemented in ARM9 microcontrollers. The CAN bus will run a 1Mbit, > > using 11 bit identifiers. About half the nodes will be in the same > > physical box, the others will be in various sensor / user interface > > boxes connected via short lengths of cable. There is also an embedded > > Windows PC in the main box, which we want to use to snoop on the CAN > > transactions to drive a mimic display, etc. There's also the possibility > > of doing all the MCU firmware upgrades via CAN. > > > > So, what's the least-effort way of interfacing a 1Mbit CAN bus to a > > Windows PC? This has to be a chip-level solution; plug-in cards are no > > good for space reasons. PC host interfaces available are: > > > > - USB 2.0 > > - PCI Express > > - LPC > > > > Now the difficult bit : I'm a hardware engineer, I don't write code > > (unless you count VHDL). We have people who write bare-metal C for > > MCUs, and other people who write Visual Studio .NET for PCs, but nothing > > in between. Our last attempt to write a driver using the Windows DDK, > > for a fairly simple peripheral implemented in an FPGA, took months and > > months to get working properly. Hence an off-the-shelf driver is pretty > > much a must. > > > > Two options I've looked at so far using the ubiquitous SJA1000 > > controller: > > > > - USB interface via FT2232H in MCU Host Bus Emulation Mode > > This looks attractive to begin with, all the PC-side code is at the > > application level. All the comments I've read say that this won't keep > > up with a 1Mbit CAN bus, mainly due to the limited interrupt support in > > the FT2232. > > - LPC interface using address decoding, SERIRQ and other glue logic in a > > CPLD > > I already have LPC interface code in VHDL which works well in an > > existing product (but polled I/O only, using DLPORTIO), the difficult > > bit is the Windows device driver. Are there any off-the-shelf drivers > > available which might fit the bill? Commercial or open-source, I don't > > mind. > > > > Or if anyone has any better suggestions for how to do this, I'm all > > ears. > > These guys were great when I last used their stuff (5 years ago). They > would have to have worked hard to not be good now. > > http://www.kvaser.com/en/products/can/usb.html >
OK, thanks, I'll keep them in mind for a USB adapter for debug use but as far as I can see they don't do an embeddable module.

Memfault Beyond the Launch