2014-04-24 12:11 AM
Hello
Is there a detailed tutorial out there on how to set up an USB CDC class for creating a virtual com port? I found certain threads in the forum and example code, but both was rather old. Since a lot of things changed with the latest peripheral library release I'd really appreciate it if someone could write a step-by-step instruction on setting up a VCP project or point me into the right direction. What I've tried so far is creating an USB-Device with the CDC class selected from the Cube eclipse plugin but this is far from ready to work and I'm not really sure what things need to be changed or even where things have to be adapted... E.g. how to set up the USB properly, or how to provide certain system functions the USB stuff is looking for. I can't even compile the standard files created by Cube right now because the linker is looking for a reference to '_sbrk'. I guess other linker errors would follow... How and where to I provide those system calls... and so on and so forth ;)2014-04-24 02:27 AM
Hi
''I can't even compile the standard files created by Cube right now because the linker is looking for a reference to '_sbrk'.'' How much experience do you have with embedded and STM32 ? Have you tried a simple 'blinky' (make a LED blink on/off) program ? ''What I've tried so far is creating an USB-Device with the CDC class selected from the Cube eclipse plugin'' Eclipse is primarily a Java IDE. It is NOT designed for embedded and does not work for STM32 without tailoring. Do not ask me how to tailor Eclipse - I am an embedded engineer NOT a tools developer. I would NOT recommend Eclipse as a IDE for STM32 development. If you must use Eclipse - try one that has already been adapted : Coocox Atollic True Studio You are right about _sbrk() - there will be other 'system level' functions that need to be provided. The 2 IDEs I suggested I think should sort your problems out for you. Better IDEs : IAR workbench Keil em:Blocks2014-04-24 08:48 AM
Eclipse is set up right and so is my project. I can compile and debug just fine right before I add the USB middleware.
I'm just looking for some tutorials or info on how to provide the system calls I need plus what changes I've to do on the USB in order to a VCP working.2014-04-24 09:11 AM
''Eclipse is set up right and so is my project.''
If that were true - then you would not be falling over _sbrk() If you do a malloc() in your project do you get the same link error? ''I'm just looking for some tutorials or info on how to provide the system calls I need plus what changes I've to do on the USB in order to a VCP working.'' Sorry, I have not used the Cube code generator yet. My understanding is that it should generate all the code needed to drive the STM32 and peripherals. The rest you have to do. If this was the OTG library - I could help you.2014-04-24 10:54 AM
malloc won't compile either. Looks like malloc calls _sbrk because I get the same error message.
I think the virtual comm example just uses USB OTG as well. The Cube plugin should use the same usb libraries? As far as i know only the peripheral stuff changed with Cube. /edit ok, I just provided a ''syscalls.c'' found in the repository which provides all necessary functions now I get the following error msg: ''./Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc_if_template.o:(.data.linecoding+0x0): multiple definition of `linecoding' ./Src/usbd_cdc_if.o:(.data.linecoding+0x0): first defined here'' /edit2 ok, nvm I just forgot to delete the template files... right, USB-OTG cdc stuff compiles fine right now so, what do I have to do in order to get it working like an usart ?2014-04-25 02:06 PM
I still need help setting up Transmit and Receive Functions.
I guess I've to setup a usbd-cdc-xxx.c file in order to get transceive functions, but I've no clue where to start since the current library version only contains a USB->serial example where they only receive stuff. / edit ok, got tx and rx functions working on the latest lib version... thanks anyways