cancel
Showing results for 
Search instead for 
Did you mean: 

USB Virtual Com Port example

arge
Associate III
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
10 REPLIES 10
chen
Associate II
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
Associate III
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
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
Associate III
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
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
Associate III
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
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
Associate III
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
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.