cancel
Showing results for 
Search instead for 
Did you mean: 

VCP for STM32F4_Discovery

tony239955
Associate II
Posted on June 22, 2012 at 17:47

I have recently downloaded the latest USB libraries which include a virtual comms port project. However all the examples use the ''Eval'' boards which include an LCD etc. rather than the Discovery board which does not. I am trying to edit the configurations and files in IAR to work with the Discovery board but as a relative beginner at this, it is proving difficult. Is there an ST project for a VCP which will run on the Discovery board?

Tony
14 REPLIES 14
tony239955
Associate II
Posted on June 22, 2012 at 18:42

Answering my own post - I downloaded jlc.jlsilicon's VCP code as posted previously and got the hex file into the board with st-link. I downloaded the ST VCP driver code for windows, but it did not recognise the USB VID/PID. I was able to change the .inf file to the VID/PID used by jlsilicon's code - namely 0304/E457, and the driver installed OK. I was then able to use Hyperterminal to play with the board - thank you Mr jlsilicon.

Its quite a miracle really, since I am doing this on a Macbook running Parallels so the USB has to get to Windows XP through several extra layers. The LED on/off controls all work OK, and the ADC reading pops up.

I now have to work out how to modify the code because this is what I want to do to change ADC parameters and as I posted previously I had problems with the different usbd files. Having now been pointed to the latest USB libraries by Clive1, I may be able to get my own compiling to work. Current problem is I am using IAR EWARM, so I have to recreate the environment which jlc.jlsilicon used - any help most welcome.

Tony

Posted on June 22, 2012 at 19:03

I'll take a look, as this fits into my development strategy. I can't help you with the IAR stuff, but I have culled the eval board projects into Keil and Yagarto and removed all the LCD and EEPROM junk. To this point I've done the MSC example for both the F4, and my F2 target, and worked with JLC on getting a workable binary from the GNU/GCC chains. Most critically the linker script, and startup files.

The GNU/GCC model is to dump all the .C/.H files from the library into a single directory, remove the source files not needed and then making the whole thing. The model with Keil, and presumably IAR, is to build a project which adds files and groups, and cherry picks the library files from their own directory tree locations. To take local copies of the stm32fxxx_whatever_eval.c/h files and hatchet out the unnecessary includes, and variables/structures contained there-in.

With Keil, I cloned the eval board project as a starting point, deleted unwanted files both within the project and from the disc, removed all the obvious #include and references, and then built iteratively to catch other references.

I can certainly see this as being overwhelming for a beginner, because you have to break so much, and then try to glue it back together.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
taha_najmee
Associate II
Posted on October 28, 2012 at 22:23

Hello abbey.tony,

I am working on VCP Port as well but not able to find any reference code for STM32F4Discovery Board. The link to jlc.jlsilicon's VCP code is broken. So can you send me your code as a reference? I would really appreciate that.

Posted on October 29, 2012 at 01:51

This is my VCP STM32F4-Discovery port for Yagarto (GNU/GCC)

https://docs.google.com/open?id=0B7OY5pub_GfIdnREeExyRWNXbFE

I have a Keil port too, and I'd consider a IAR EWARM one if someone bought me a license.

ST provide example code within their USB firmware for the STM32xx-EVAL series boards, these are reasonably easy to port to other boards and tool chains for those with familiarity with their tools.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
taha_najmee
Associate II
Posted on October 30, 2012 at 02:22

Clive, Thank for sharing your code. I have added your files into my Keil project but still the windows doesn't recognize any virtual com port. I have the driver 1.3.1 installed on my PC. I can see 4 LEDs blinking but it doesn't initialize the com port. I have attached my whole project if you want to look at it.

________________

Attachments :

Test_Codes.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzZM&d=%2Fa%2F0X0000000bNi%2F24lBe.nfcVt_TGHGWskKSkFQgkk19kDqsAzi_PyPGnc&asPdf=false
Posted on October 30, 2012 at 15:32

Yikes, that's a bit of a monster.

The defines don't appear to be correct.

Defines : USE_STDPERIPH_DRIVER,STM32F4XX,USE_STM32F4_DISCOVERY,USE_USB_OTG_FS,HSE_VALUE=8000000

Target : Use MicroLIB : Checked, Floating Point Hardware : Not Used

This is my VCP STM32F4-Discovery port for Keil

https://docs.google.com/open?id=0B7OY5pub_GfIeVpqZXZLWEVrNWc

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
taha_najmee
Associate II
Posted on November 01, 2012 at 16:44

Clive, Thanks really appreciate it ... The USB is working now.

Thanks Again

taha_najmee
Associate II
Posted on November 18, 2012 at 22:49

Hello Clive,

I am having a problem understanding one thing. I am trying to send and receive some data from UART 4 and 5 at the baud rate of 600. But when I include my code to your given VCP code, the baud rate for both UARTs changed some how. Do you have any idea about it?

When I check it on oscilloscope, one frame which consists of start bit, 8 data bits and stop bit should be around 60 Hz while with the VCP code, it jumps to 930 Hz.

Posted on November 18, 2012 at 23:59

You should be able to configure the baud rate when you first initialize the ports, but you do not want to let USB/VCP side of things reconfigure the port, so you can ignore requests from the PC to set a specific/different rate.

Without knowing exactly what you added it's hard to know.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..