Skip to main content
arge
Associate III
January 28, 2014
Question

USB Virtual Com Port example

  • January 28, 2014
  • 10 replies
  • 6112 views
Posted on January 28, 2014 at 15:02

Hello,

USB Virtual Com Port example doesn't work on device mode

I have a uC card wtih stm32f107 which works host and  FS mode, reads Flash disc.. Now I am trying eval vcp example, I made necessary changes but it doesnt work even I put break points on main and systick. Something is wrong about VCP example with CL devices.

My other question does VBus need to be open manually for device mode? Because on host mode we read flash disc by ''USBH_USR_MSC_Application'' event.

#usb-vcp
This topic has been closed for replies.

10 replies

chen
Associate II
January 29, 2014
Posted on January 29, 2014 at 13:13

Hi

It is unclear what you are trying to do.

''I have a uC card wtih stm32f107 which works host and  FS mode, reads Flash disc.. Now I am trying eval vcp example, I made necessary changes but it doesnt work''

The USB host example you have got is a USB Mass Storage device Class.

''STM Virtual Com Port'' is the host (as in PC) driver for a USB CDC device.

If you want to use USB serial - this is USB Communication Device Class.

There is an example of USB device type CDC.

This is a 'USB device' NOT a 'USB host'

It is NOT possible to be both a Host and Device on the same USB peripheral.

(Some other have been toying with doing both but on the 2 separate USB peripherals)

Looking in the \STM32_USB_HOST_Library directory for the USB example libraries, I do not see a Host example for a VCP.

I do not know how you would adapt the MSC example into a VCP.

arge
argeAuthor
Associate III
January 29, 2014
Posted on January 29, 2014 at 14:37

is it possible to switch host msc mode to device cdc mode with same hardware?

chen
Associate II
January 29, 2014
Posted on January 29, 2014 at 14:47

''is it possible to switch host msc mode to device cdc mode with same hardware?''

Yes. That is what USB On The Go is all about.

arge
argeAuthor
Associate III
January 29, 2014
Posted on January 29, 2014 at 15:49

I am trying cdc example on my card I have connect RS232 with hyperterminal it works I can see data i send. But my card has a female usb socket. So to connect pc I find a male to male usb cable and plugged my pc. But I guess I need a virtual host for usb. Hyperterminal cant open a usb port thank you

chen
Associate II
January 29, 2014
Posted on January 29, 2014 at 15:55

Hi

''But I guess I need a virtual host for usb.''

Yes, you will need a VCP driver for windows which then makes a USB CDC look like a serial port.

This is the one to use for ST parts:

http://www.st.com/web/en/catalog/tools/PF257938

You can then use any terminal emulator you like

arge
argeAuthor
Associate III
January 29, 2014
Posted on January 29, 2014 at 16:58

i installed the driver and plugged usb. I openned windows Hyper Terminal but i still can't open a virtual port how will I use this driver?

chen
Associate II
January 29, 2014
Posted on January 29, 2014 at 17:03

Hi

Use Windows 'Device Manager'.

Under 'Ports (COM & LPT)

If the driver is installed correctly, USB device enumerated correctly, it should be listed as a COM port (my gets listed as ''STMicroelectronics Virtual COM Port (COM4)).

(Sometimes the port number is large eg COM15 - it depends on how many COM devices the machine has seen!)

In Hyperterminal - open that COM port. If Hyperterm cannot select that port (I think it is limited to 4) - use another terminal program.

arge
argeAuthor
Associate III
January 30, 2014
Posted on January 30, 2014 at 09:12

After I install driver before I plug usb should i seee STMicroelectronics COM under device manager>COM&LPT?  or when I plug because I have no eval board just I am using its sw.. thx 

chen
Associate II
January 30, 2014
Posted on January 30, 2014 at 10:48

Hi

Windows 'Device Manager'.

Under 'Ports (COM & LPT)

Should list all the available comm ports.

''After I install driver before I plug usb should i seee STMicroelectronics COM under device manager>COM&LPT? ''

No.

It should only appear after a USB CDC device is plugged in and correctly enumerates/installs.

''because I have no eval board just I am using its sw.. thx''

Only valid enumerated 'USB CDC devices' will be listed in the DeviceManager-Ports.

October 18, 2016
Posted on October 18, 2016 at 12:55

Hello everyone, 

  I using STM32F070 microcontroller and following example below for USB CDC:

STM32Cube_FW_F0_V1.6.0\Projects\STM32072B_EVAL\Applications\USB_Device\CDC_Standalone

 

I have made it work using CDC standalone but the issue is that I was previously following CMSIS library and the example of CDC standalone follows HAL,  I am new Hal and don't want to switch, any working example of USB via cmsis would be helpful.

I would be grateful if anybody help me in this regard. 

Thankyou