Skip to main content
adriano
Associate II
Dec 8, 2014 3:42 PM UTC
Question

STM32CubeMX USB Virtual Com Port

Posted on December 08, 2014 at 16:42

Hi everybody,

I recently bought a STM32F3Discovery board for a project. I made some experiments and tried to get an idea of how it works, and then I decided to set up a VCM in order to have better feedbacks from the board and communicate with it (i.e. to set parameters ''on the fly'').

I have been tryin for some days, but I'm having some serious issues with that. I am using CubeMX to generate the initialization code for my project: i set up pins GPIOA11 and GPIOA12 as USB DM and DP, and selected the USB Device option under ''Middlewares'' (Communication Device Class). I set up some parameters and let the code be generated... and that's pretty much all. I don't get how to use it, communication doesn't work, the CDC_Transmit functions (in the automatically generated file usbd_cdc_if.c) fall into an infinite loop or something like that. I searched for some code examples, but they all work with the StdPeriph and most of them are written for the STM32F4 board...

please, help me :(
    This topic has been closed for replies.

    4 replies

    Amel NASRI
    ST Technical Moderator
    Dec 9, 2014 12:57 PM UTC
    Posted on December 09, 2014 at 13:57

    Hi ApBrandy,

    You should find many examples in the STM32CubeF3 package (http://www.st.com/web/en/catalog/tools/PF260613).

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    adriano
    adrianoAuthor
    Associate II
    Dec 9, 2014 1:19 PM UTC
    Posted on December 09, 2014 at 14:19

    Hi Mayla, thanks for your reply.

    Didn't find anything about CDC communication, only DFU and HID examples. Am I looking in the wrong place?

    Amel NASRI
    ST Technical Moderator
    Dec 9, 2014 1:53 PM UTC
    Posted on December 09, 2014 at 14:53

    Look at STM32Cube_FW_F3_V1.1.0\Middlewares\ST\STM32_USB_Device_Library\Class\CDC.

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
    adriano
    adrianoAuthor
    Associate II
    Dec 9, 2014 2:00 PM UTC
    Posted on December 09, 2014 at 15:00

    I had already looked there, and those seem to be the files automatically included in my project by CubeMX when I select the CDC middleware option in the pinout panel. Unfortunately, they don't seem to work properly

    EDIT - solved. Looks like there was a bug in the initialization code. I found the solution here:

    https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Java%2FUSB%20CDC%20Bug%20in%20CubeMX%20firmware&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=2021

    Thanks.

    reEDIT - still have a problem here: the board gets stuck in the com protocol and doesn't do anything else. This thing is becoming a real pain in the neck...