Peter Grabau

Kinetis USB CDC driver for Windows 10

Discussion created by Peter Grabau on Sep 28, 2016
Latest reply on Sep 29, 2016 by Mark Butcher

This is not a question, I just thought that my experiences might be of use to someone with the same problem.

 

Recently, like with a number of others, I have needed a method for transferring data between a Visual Studio 2015 C++ program on a PC running Windows 10 and a FRDM-K64F board. 

For the FRDM-K64F I started with the KSDK v2.0 USB CDC ACM class example usb_device_cdc_vcom and the provided driver fsl_ucwxp.inf. Windows 10 would not load the driver of course, (as its not signed) so I went in search of answers and found two:

 

1. The first answer was "Enable the installation of unsigned drivers" as in

https://community.nxp.com/thread/375982

I didn't particularly want to do this so I kept looking.

 

2. The second answer (which I stumbled across by accident) is that you don't need a driver, or more correctly you don't need to supply a driver, but can use usbser.sys, the Microsoft provided in-box driver for your Communications and CDC Control device. This can be loaded manually or automatically.

Manual installation; Note: On my PC it enumerated as COM4.

When usb_device_cdc_vcom is started the Device Manager shows a new device with the title Other devices > etc.

    1. In Device Manager right-click on the new device and select “Update Driver Software…”.
    2. Select “Browse my computer for driver software”, then “Let me pick from a list of device drivers on my computer”, then “Common hardware types: > Ports (COM & LPT)”,
    3. From the list select Manufacturer > Microsoft. Then Model > USB Serial Device… This produces a “Not Recommended… Can’t verify it is compatible etc”, BUT then it installs as

“Update Driver Software – USB Serial Device (COM4)

Windows has successfully updated your driver software

Windows has finished installing driver software for this device

USB Serial Device

   

In Device Manager > Ports (COM & LPT), there is now a new device USB Serial Device (COM4).

Note:

In step 3 there is another Model option USB Serial Modem Device. I don’t know what the difference is but it appears to do the same thing.

 

If there is another driver already loaded for your device and you wish to change to the Microsoft driver the procedure is slightly different;

  1. In Device Manager right-click on the new device and select “Update Driver Software…”.
  2. Select “Browse my computer for driver software”, then “Let me pick from a list of device drivers on my computer”, then, uncheck "Show compatible hardware"  
  3. From the list select Manufacturer > Microsoft and Model > USB Serial Device
  4. In Device Manager > Ports (COM & LPT), there is now a new device USB Serial Device (COM4).

 

Automatic Installation: To load usbser.sys automatically, set the class code bDeviceClass = 02 and the subclass code bDeviceSubClass = 02 in the Device Descriptor.

 

Testing and verification

This worked as far as usb_device_cdc_vcom would echo characters typed into a serial emulation program such as Putty but wouldn't work for a Visual C++ program such as the Microsoft example on the SerialPort Class page. The serial port would open correctly but wouldn't accept any characters for transmission. The solution is to set the DTR handshaking signal by including the line

_serialPort->DtrEnable = true;

in the Visual C++ program after the port is opened. The DtrEnable command is sent to the FRDM-K64F and results in the s_cdcVcom.startTransactions flag being set indicating that the CDC device is ready to Transmit and Receive data. See the kUSB_DeviceCdcEventSetControlLineState event in function USB_DeviceCdcVcomCallback() of file WinUSB_Test_003.c (file virtual_com.c in project dev_cdc_vcom_bm_frdmk64f).

Outcomes