2012-04-18 12:40 PM
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!2012-05-03 08:09 AM
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.2012-05-05 10:42 AM
''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?2012-05-05 02:50 PM
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 STM32F4http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00036746.pdf
2012-05-05 03:34 PM
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.2012-05-08 12:10 PM
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?2012-05-09 04:10 PM
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.2012-05-10 01:28 AM
Yes, I see. I believe this board will do just fine: http://www.skpang.co.uk/catalog/canbus-breakout-board-p-754.html
2012-05-11 09:08 PM
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.2012-05-12 04:07 AM
I apologize, I misread the schematic.
I re scan an the product should work like you want.