Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Visitor
jcerna1
Posts: 5
Registered: ‎03-20-2012
0

Building CAN BUS sniffer on Spartan FPGA

Hello!

 

First of all, I would like to say I am beginner in FPGA. I have made simple VGA and PCI controller on Spartan 3 FPGA so far, that's basically all my experience.

 

However, I would like to make CAN BUS sniffer in FPGA. I would only like to see the messages passing on the bus, no other advanced functions. I was thinking about connection CAN transceiver to the FPGA board and then to send the decoded messages to PC via UART.

 

Now - since I am beginner - can somebody evaulate how difficult would this project be? Could somebody share any tip?

 

Thanks!

Visitor
jcerna1
Posts: 5
Registered: ‎03-20-2012
0

Re: Building CAN BUS sniffer on Spartan FPGA

Anyone?

Expert Contributor
eteam00
Posts: 7,505
Registered: ‎07-21-2009
0

Re: Building CAN BUS sniffer on Spartan FPGA

It is not clear what question you would like answered.

 

You have said that you have already "made" a VGA controller and a PCI controller.

What parts of your planned design do you think will pose problems for you?

 

I am guessing that a small fraction of FPGA designers (and user forum correspondents) are familiar with CAN bus protocol and interfaces on a detailed level.  If you can be more specific with your request, you may be more likely to receive a useful reply.

 

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
Expert Contributor
rcingham
Posts: 2,010
Registered: ‎09-09-2010
0

Re: Building CAN BUS sniffer on Spartan FPGA

We use CAN in some of our products, but this is not an area I have worked in. However, looking at the schematics for a CAN-equipped board, the PHY (physical interface layer) is something to ensure that you get right. We seem to use a transformer, a termination resistor, and a transceiver IC between the CANbus and the FPGA. I suspect that your favourite Internet search engine will find a suitable transceiver IC and application notes.

The interface is slow by current standards, but the wide selection of protocols could make the design of a 'universal' sniffer quite time-consuming.

------------------------------------------
"If it don't work in simulation, it won't work on the board."
Visitor
jcerna1
Posts: 5
Registered: ‎03-20-2012
0

Re: Building CAN BUS sniffer on Spartan FPGA

Hi!

 

I would like to connect CAN transciever (for example: http://www.maxim-ic.com/datasheet/index.mvp/id/4299) to CAN controller (for example: http://ww1.microchip.com/downloads/en/devicedoc/21801d.pdf) and CAN controller to FPGA. Inside FPGA, I would like to implement SPI bus to talk to  the CAN controller, and UART bus to talk to the PC, so I can see the CAN messages on PC.

 

First of all - is this even possible - am I thinking right?

 

Then - as far as I know, the FPGA board (mine is Spartan 3E from Digilent: http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,400,792&Prod=S3EBOARD) works on 3.3V voltage ... so both CAN transciever and CAN controller need to work on 3.3V, am I right?

 

Next thing - since I don't have knowledge in analog electronics ... is there any analog component needed to connect CAN transciever and CAN controller to the FPGA board, or is it enought just to use wires? Can I use clock from FPGA to drive the CAN controller?

 

Bus speeds - since CAN is faster than UART, will I have problems following packets in real time on CAN network?

 

 

Thank you very much for your answers in advance!

Expert Contributor
rcingham
Posts: 2,010
Registered: ‎09-09-2010
0

Re: Building CAN BUS sniffer on Spartan FPGA

[ Edited ]

Quick impressions:
1. The CAN Transceiver looks like a good enough choice.
2. I wouldn't bother with a CAN Controller, as all you want is a non-transmitting monitor/sniffer.
3. You will probably need a software element to decode the protocol, for example a MicroBlaze, using XPS/EDK/whatever. Doing it all in HDL would be possible, but probably really hard. The MB SystemBuilder will allow you add a UART. Sheet 2 of the board schematics shows a RS232 transceiver.
4. You will need to dig around for the analogue circuitry, or hope sombody else bothers to help you out. HOWEVER, it would help a lot if you were to state what sort of equipment you need to monitor.
5. What might help is: http://www.can232.com/ Or would that be cheating?

 


------------------------------------------
"If it don't work in simulation, it won't work on the board."
Visitor
jcerna1
Posts: 5
Registered: ‎03-20-2012
0

Re: Building CAN BUS sniffer on Spartan FPGA

[ Edited ]

Hi!

 

First of all, thanks for your answers!

 

1) About CAN controller - Yes, I will not be transmitting any data on CAN bus, I only need to "sniff" what on CAN bus is going on ...

 

Does this mean I can only use CAN transciever? My biggest concern is - what kind of data is the output of the CAN transciever (on rx and tx lines)?

 

2) About protocol decoding. I was thinking that the hardware part would only be sending raw information (e.g. zeros and ones) over UART to the PC. I would handle protocol decoding with software (my own).

 

3) Yes, can232 would definately be cheating. ;) The whole point of this project is to build the sniffer on my own ... I know the "already working ones" are cheap to buy.

 

4) I would like to monitor CAN bus on automotive systems. Practically, I would like to connect my sniffer to OBD port on a car and record the data on the bus. 

Expert Contributor
bassman59
Posts: 4,741
Registered: ‎02-25-2008
0

Re: Building CAN BUS sniffer on Spartan FPGA


jcerna1 wrote:

Hello!

 

First of all, I would like to say I am beginner in FPGA. I have made simple VGA and PCI controller on Spartan 3 FPGA so far, that's basically all my experience.

 

However, I would like to make CAN BUS sniffer in FPGA. I would only like to see the messages passing on the bus, no other advanced functions. I was thinking about connection CAN transceiver to the FPGA board and then to send the decoded messages to PC via UART.

 

Now - since I am beginner - can somebody evaulate how difficult would this project be? Could somebody share any tip?

 

Thanks!


FWIW, if I had to build a CAN bus sniffer, I'd use a microcontroller with a built-in CAN bus interface.


----------------------------------------------------------------
Yes, I do this for a living.
Visitor
jcerna1
Posts: 5
Registered: ‎03-20-2012
0

Re: Building CAN BUS sniffer on Spartan FPGA

Could you be more specific why? What part would FPGA play in this case?

Expert Contributor
bassman59
Posts: 4,741
Registered: ‎02-25-2008
0

Re: Building CAN BUS sniffer on Spartan FPGA


jcerna1 wrote:

Could you be more specific why? What part would FPGA play in this case?


To whom are you replying?


----------------------------------------------------------------
Yes, I do this for a living.