cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an example of creating a USB device for an STM32F407VG that isn't a mouse example or requires a device driver to be installed in order to communicate with it?

Rick V.
Associate II

I'm trying to create a USB / Ethernet testing device. I need to use the USB portion to program an IP address. The mouse example works but I cannot detect it or connect to it. The virtual serial port example also works but a driver needs to be installed in order for me to communicate back and forth (not an option in production). Is there a USB device example that is detectable in windows and doesn't need a special driver to connect to it? Thanks in advance for your consideration.

1 ACCEPTED SOLUTION

Accepted Solutions

Or see this post or search this forum for CDC_SET_LINE_CODING or CDC_GET_LINE_CODING for examples.

https://community.st.com/s/question/0D50X0000BOvcxISQR/possible-stm32-usb-virtual-com-port-driver-bug-on-windows-10

View solution in original post

5 REPLIES 5
Pavel A.
Evangelist III

You can make a "custom HID" device - if it does not look like mouse or keyboard, the host OS won't claim it.

If you make a serial port device *properly* and have WIndows 10, it has a good in-box driver for it.

But if your goal is a "ethernet" device, WIndows 10 has in-box driver for this as well.

For more details on required device descriptors, you can ask in Microsoft drivers forum here. Right from the beast's mouth.

Finally, if you just need some custom device that works without a driver - use libusb on Linux, or add a special descriptor for Windows and use winusb.

-- pa

Thanks Pavel for the response. The intent is to create a serial port device "properly" as you say. The virtual serial port example does "work" in that when I plug-in the USB cable, Windows sees it, assigns the driver, and shows a new COM port in the Device Manager. This is where the "properly" comes in. I cannot connect to it using the C# serial port class which should be simple. The error I get is "The parameter is invalid". This indicates one of two things. 1. My serial port settings are wrong (baud rate for example) or 2. there is no underlying serial layer on the device side (that's what a search for the error yields.). Since there is no visibility in the example as to what the serial port settings are, I used what the Device Manager stated. If there is any insight you or anyone can give me as to how to get both sides talking to each other, I'd greatly appreciate it. BTW, the Ethernet side for now is not a concern at this point.

One usual culprit is that the device does not handle set & get requests for baud rate and other parameters.

Normally all "set" needs to do is to save the parameters that the host passes and in "get" return it back.

Many examples are available on github.

-- pa

Or see this post or search this forum for CDC_SET_LINE_CODING or CDC_GET_LINE_CODING for examples.

https://community.st.com/s/question/0D50X0000BOvcxISQR/possible-stm32-usb-virtual-com-port-driver-bug-on-windows-10

Perfect Bob, I'm now up and running by implementing the CDC SET/GET LINE CODING case statements. Thanks much for the help.