cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 USB CDC VCP unable to open serial port

Matt Blessinger
Associate III
Posted on July 03, 2018 at 18:53

I have strange problem on my hand which I can't figure out if it is a Windows driver or USB stack issue. I have an embedded STM32F732 using USB FS CDC for communication. The MCU is self powered with VBus sensing. When I connect it to a Windows 10 or MacOS machine, I can open a terminal program and communicate with the MCU just fine. When I attempt to do the same with a Windows 7 or 8.1 machine, the COM port does not open. For instance Putty says 'Unable to open connection to COM6. Unable to configure serial port.'

For Windows 7 & 8.1, the device manager has the MCU listed as STMicroelectronics Virtual COM Port. Both machines have the latest v1.5 VCP drivers from STM installed. The interesting thing I discovered is that if I plug the usb cable into the Mac or Win10 machine first and then plug it into the Win7 or 8.1 machine, I can connect to it! And it will still works after I do a soft reset. It will stop working if I do a hard reset and cut power.

This makes me think it is something on the MCU USB stack where it retains information between soft resets, but I don't know how the stack works at all. I use CubeMX to generate the code, in which the only thing I have changed is the device descriptor, although Windows still uses

STMicroelectronics Virtual COM Port.

Does anybody have an idea of where to start tracking down the problem? Thank you!

#usb-fs-cdc #stm32f
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on July 06, 2018 at 17:57

Could this be related to the solution given in a link at the end of this post:

https://community.st.com/0D50X00009Xke3ESAR

 

The problem that person had was resolved by having the ST device save and echo back the line coding parameters.

View solution in original post

9 REPLIES 9
Matt Blessinger
Associate III
Posted on July 05, 2018 at 19:31

After debugging for a while trying to track down the problem in the USB stack, it seems to have resolved itself. After disconnecting the ST-Link V2-1 and cycling the power, the Win 8 machine can open the COM port without the MCU having to be plugged into the Win 10 machine first. Perhaps there was a mild corruption in the program from the last time I was debugging, so I can only hope this phantom problem does not return.

Matt Blessinger
Associate III
Posted on July 05, 2018 at 23:20

And I spoke too soon! VCP communication is working with the Windows 8 machine, but NOT for Windows 7. I tried reprogramming the MCU several times to no success. I uninstalled the VCP drivers and reinstalled and still doesn't work.

I still have to connect the MCU to another machine before it will work with the Win 7 machine. I also found out that if I program and debug the MCU with a

 ST-Link V2-1 then USB works right away, even after a power cycle.

I just don't know where to go forward from here

Matt Blessinger
Associate III
Posted on July 06, 2018 at 17:15

I have a Nucleo F446 that I loaded a USB CDC test program on. It works on all operating systems no problem. So then I went back to my embedded F732 and loaded only the CubeMX output (no additional code). All operating systems enumerate the VCP properly with no driver error codes, but now only Win 7 & 10 can open the serial port; Win 8 is not working!

This is quite frustrating as USB communication is absolutely essential to the product. Given I used the minimum output from CubeMX, I don't know what else I can do. Is it a driver issue since the F4 works without problems compared to the F7?

By the way, I am on CubeMX 4.26.0 with F7 firmware V1.11.0.

Posted on July 06, 2018 at 17:57

Could this be related to the solution given in a link at the end of this post:

https://community.st.com/0D50X00009Xke3ESAR

 

The problem that person had was resolved by having the ST device save and echo back the line coding parameters.

Posted on July 07, 2018 at 00:48

Thank you, Bob!

I wasn't optimistic this would work since I've only seen this used to fix Win 10 and most recently Win 10 was working for me but Win 8 wasn't. I gave it a try anyways, and now both Win 8 & 10 work, which is not a combination I had before! I'll have to wait until Monday to try a Win 7 machine, at which point I'll mark your answer as correct if the solution holds.

Edit: Works on Win 7, 8, 10 and Mac!

Patrick1
Associate II

Hi Matt, could u let me know what the solution is?

The Link that Bob posted is expired...

Im Struggling with same error for 3 days.

Pavel A.
Evangelist III

> The Link that Bob posted is expired

The code that should fix this issue can be found in a template for CDC device here:

https://github.com/pavel-a/stm32f0_libs/blob/389cc3c20de72e529038442027d65dd652863305/STM32Cube_FW_F0/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc_if_template.c#L154

Note how it saves parameters of CDC_SET_LINE_CODING request and later returns them for CDC_GET_LINE_CODING (line 164)

-- pa

mmed
Associate III

Hi all,

I want to handle STM32F407 Disco via VCP. In the first case, i tried to configure UART but when i connect my USB TTL converter to my PC: it informs me that VCP error ''This device cannot start(code 10)''.

I thought that the probem is related to my USB converter

Then i tried to configure CDC USB:

USB_OTG_FS on mode Device only

activate USB_Device middelware in CDC mode

0690X0000088qxcQAA.png

check the CubeMX file attached for more details

but the problem still exist!===> VCP error ''This device cannot start(code 10)''.

0690X0000088qxSQAQ.png

and here is the define in "usbd_desc.c" file

#define USBD_VID   1155

#define USBD_LANGID_STRING   1033

#define USBD_MANUFACTURER_STRING   "STMicroelectronics"

#define USBD_PID_FS   22336

#define USBD_PRODUCT_STRING_FS   "STM32 Virtual ComPort"

#define USBD_SERIALNUMBER_STRING_FS   "00000000001A"

#define USBD_CONFIGURATION_STRING_FS   "CDC Config"

#define USBD_INTERFACE_STRING_FS   "CDC Interface"

=====> Please how can i handle to fix this issue! if there is a wrong value generated by CubeMX! or a change that should i do in my environement (PID, VID....)

this is a real problem for me that block my project0

Please any solution or workaround for this

many thanks

Raful
Associate

Hi

I have an exactly opposite problem.

In win 7 it works fine.

When I plug the USB to win 7 first and then to win 10, I can connect to it. If after win 7 I turn off the device, I cannot open it in win 10.

I work in win 10 pro v. 1809

What is your win 10 version?

Thanks