cancel
Showing results for 
Search instead for 
Did you mean: 

CAN-bus analyzer

jurij
Associate II
Posted on April 18, 2012 at 21:40

Hi!

I am a newbie in microprocessor systems, so I need some help. I would like to build CAN (Controller Area Network) analyzer for monitoring CAN bus on vehicles (not for diagnostics, just to see simple message frames with identifiers, etc.). I have a few questions:

1) Which IDE to use, as I see there are 4 of them. I am pretty familiar with Eclipse platform, should I go for TrueStudio?

2) Can I connect STM32F4Discovery directly to the CAN bus (5V), or do I have to use voltage shifters or something?

3) When I receive the frame, I would like to immediately send it to PC via UART. Is it possible to connect the Discovery's microUSB port to the PC, create virtual COM port and send data over it? Or is there any simpler way?

That would be it for beginning ... thanks for your answers!

9 REPLIES 9
bjfree
Associate II
Posted on May 03, 2012 at 17:09

1) I use eclipse

2) you need to add the canbus hardware driver. if you look at the

http://www.olimex.com/dev/olimexino-stm32.html schematic you will get a sample.

3)Yes http://stm32-codes.googlecode.com/svn/ has a bootloader and code examples.

jurij
Associate II
Posted on May 05, 2012 at 19:42

''2) you need to add the canbus hardware driver. if you look at the

http://www.olimex.com/dev/olimexino-stm32.html schematic you will get a sample.''

Could you be more specific about this? By looking STM32F4 processor manual, I can see it already has CAN driver ... am I wrong?

Posted on May 05, 2012 at 23:50

Could you be more specific about this? By looking STM32F4 processor manual, I can see it already has CAN driver ... am I wrong?

Yes, try looking at some other reference designs encompassing the CAN bus on the STM32F4

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00036746.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bjfree
Associate II
Posted on May 06, 2012 at 00:34

The STM32F4 board,  pins that connect the first Can TX and RX, are assigned to USB. This means you have to connect to the Can2.

the Can internal to the STM32F4. you will need to add a chip similar to MCP2551-I/SN this is what i call a can driver. this is the interface between the STM32F4 internal Can2 and the Canbus that connects to other can devices.

if you looking for how to do a software driver, find the processor on the ST site then click on design support tab you will find all sorts of appnotes. some include the code you need. there will be a can.h and can.c you can use as a template.

hope that helps.

jurij
Associate II
Posted on May 08, 2012 at 21:10

Thank you guys for the explanation. I totally understand the situation now. I was confused, because I taught the MCU has a CAN transceiver built in. 

This board (http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00036746.pdf) seems nice, but it is no use to me, since CAN network in vehicles is in range 0-5V, while this one supports 0-3.3V.

However, I do have CAN Arduino shield (http://www.sparkfun.com/products/10039) ... so I suppose I could use just the transceiver part of it, what do you think?

bjfree
Associate II
Posted on May 10, 2012 at 01:10

if you look at

http://www.olimex.com/dev/olimexino-stm32.html schematic

you will see one small section for CAN, that has the MCP2551. that is all you need.

the STM32F1 has different pinouts, but it is enough for you to match up the schematic in the STM32F4 user manual.

jurij
Associate II
Posted on May 10, 2012 at 10:28

Yes, I see. I believe this board will do just fine: http://www.skpang.co.uk/catalog/canbus-breakout-board-p-754.html

bjfree
Associate II
Posted on May 12, 2012 at 06:08

 the DB9 since that is serial input to the 2551.

the header is the output of the 2551.

for experiment I suggest putting solderless headers on the board then use the experimenters block to hook up the 2551.

I am working on a break out board for the stm32f4discovery board to plug into.

one of the forgotten facts about CanBus is you have a Power pair the goes to each node, to the Can be powered that way.

this is off the breakout board

http://roadwarrior.free-man.com/can/rvcan/2515.png

now if you want you can remove the optos, and power supply and use the 5v supplied by the discovery board.

bjfree
Associate II
Posted on May 12, 2012 at 13:07

I apologize, I misread the schematic.

I re scan an the product should work like you want.