This project show the steps to convert STM32 USB CDC to WINUSB Device with HAL library. This will change the source code of CDC USB HAL library. "CDC" name will be retained in order to show the differenece. Also with Microsoft OS String Descriptor, no need to install WINUSB driver for Windows 10.
Using STM32F072 Discovery board
Changes of usbd_cdc_if.c and main.c to implement simple echo function.
Change source code of USB library. Create a DeviceInterfaceGUID = {13eb360b-bc1e-46cb-ac8b-ef3da47b4062} The DeviceInterfaceGUID is written into both OSStringPropertyDescriptor and INF file.
Create my_winusb.inf using DeviceInterfaceGUID as described previously. The inf file need to match the VID, PID, and DeviceInterfaceGUID of the USB device. Only Windows 7 and before need install driver.
Use WINUSBNET library from https://github.com/madwizard-thomas/winusbnet to create simple echo test program using Visual Studio with C# WinForm
Using STM32F4 Discovery board with generate project using TrueStudio. There is not much difference from F0.
Another option to install drivers is using Zadig. The usage of Zadig can be found at here..
-
Advanced Mode (Options ? Advanced Mode)
In this mode we can configure our device with defined values.
-
Open Preset (Device ? Load Preset Device)
Load the predefined values(especially "Device Interface GUID") for the device driver. The sample config.ini is in the folder "Zadig".
Windows will save registry entry "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Usbflags\VVVPPPRRRR" where VVV is PID, PPP is PID, and RRRR is version number. This will save the request of OS string descriptor(0xEE) and will prevent request for next plug in device. Please delete corresponding registry entry and uninstall the device driver to debug new device program.