Writing a driver for USB / VCP RRS feed

  • Question

  • Hi everyone,

    I have a project, with a stm32f4. On this board, I'm using the STM library to "emulate" a VCP (Virtual Com Port). STM has a driver for this device on VCP, but I would like to write my own driver, because some stuffs don't fit enough to my use (for example name, VID, PID). The driver from STM has the advantage to make the device as a Com PORT, which makes the communication with the device very easy to use. So I took a quick look on how I can make a Serial Port driver, and on the example that we can find in the Microsoft repository on github. My problem with that kind of driver is the absence of .INF file. I want to recognize my device via a VID and a PID. I also took a look on the USB driver documentation, but that way, I don't understand how the driver can communicate with the VCP on the board.

    Can you advise on the best way to do what I want to do ?

    If I choose the USB driver, how can I communicate with a device that emulates a VCP ?

    If I choose the Serial port driver, how can I recognize my device ?

    Thanks a lot !


    Monday, October 24, 2016 8:54 AM


  • let's start off by saying that writing a serial port driver in windows is not simple. as a first time driver project, it is one of the worst possible choices as it is complicated in addition to learning new core concepts. If you can make the device CDC compliant, you can use usbser.sys

    this is one driver, it handles serial IO (the "top" edge) and translates each serial IO into a USB command (or more than one) and speaks USB on the bottom edge.  This means taking the existing sample and ripping out all of the ISA hw access and register code and replacing it with the relevant USB commands.

    The INF you want to look at is in %windir%\inf\msports.inf. you will have to replace the ISA style hardware IDs with your USB HW ID.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, October 24, 2016 4:16 PM