cancel
Showing results for 
Search instead for 
Did you mean: 

USB - how to start with this?

morpeh89
Associate II
Posted on December 22, 2010 at 09:03

USB - how to start with this?

6 REPLIES 6
daveinca
Associate
Posted on May 17, 2011 at 14:19

Hello Alexey. I don't have any specific information regarding the STMicro processors but I can tell you that using a USB CDC (communications device) is a pretty easy way to go. Once the host and device complete the USB enumeration, a [virtual] COM port is created on the host PC. That port is subject to the same limitations (speed, settings, etc.) as a 'real' COM port on the PC. So the possible maximum speed is 3Mbps (assuming your PC supports this).

An alternative that you may want to try is LibUSB. Do a search for it and then see if they have an example for the STMicro controllers. It's a generic interface but does a good job of transferring data. And, it's cross platform if that's ever an issue for you.

I know this isn't a complete answer to your question but I figured I'd offer a little information anyway.

morpeh89
Associate II
Posted on May 17, 2011 at 14:19

Thanks, Dave! Your answer is really helpful.

Now I decided to try ST-Virtual COM example (that, if I understand properly - is a kind of USB CDC). The only problem is that I don't have a board, which example supposed to be used with. So, I just construct own board, using USB part of standard board's schematics (bulky scheme for providing Disconnect signal). But, analyzing example's code I still don't sure, that it's all I need to do, to make this example work properly. If I reach a success, I will report about it here 🙂
morpeh89
Associate II
Posted on May 17, 2011 at 14:19

I've constructed scheme, similar to USB-part on STM32-SK board. Now PC can recognize my device as ''unknown device''. I tried to install driver, that was included in example - but installation wizard didn't like this file (iarvircomport.inf).

Now I have two suggestions:

1) some mistake in my scheme (it's not STM32-SK board!) - currently testing this aspect.

2) error in ''.inf''-file, or in config. file of project, or some trouble with my system files, needed for successful installation. It's very hard for me to understand, where can this mistake be. If anyone had similar problems - any advice would be very useful!

I have already searched through several forums - there was information, that in some cases files of ST-example are erroneous. I tried to fix some bugs - but it didn't help.

Also I have found, that there was no ''usbser.sys'' file in my drivers folder - and I have downloaded it. I have suggestion, that there can be many similar problems, that don't allow me to install driver.

So, help needed very much!
regmaster2
Associate II
Posted on May 17, 2011 at 14:19

In the device manager, open the properties of the unknown device and then details.

Under hardware ids there must not be 0 for VID or PID!

If so, you might have an electrical problem.

Did you set the USBDP and USBDM as Alternate?

First I didn't do this and had the same problem.

morpeh89
Associate II
Posted on May 17, 2011 at 14:19

Thank you for advices!

VID and PID are really 0000.

USBDP and USBDM are alternate, like in ST-example. In fact, I didn't do any changes in this example (just changed pin-number for disconnect signal to my own pin, because it differs from pin on standard board). I suppose (and hope), that code given is correct, and problem is really in my scheme.

I still continue to search for mistakes.

morpeh89
Associate II
Posted on May 17, 2011 at 14:19

Yeah! I have solved the problem! Now virtual COM  properly operates on my micro, with speed up to 128000 bit/s. Problem really was in schematics.

Now I just need to increase maximum speed up to full speed mode (12 Mbit/s)... but it's another question