Kinetis USB CDC driver for Windows 10

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kinetis USB CDC driver for Windows 10

8,356 Views
PeteG
Contributor II

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).

1 Reply

2,997 Views
mjbcswitzerland
Specialist V

Hi Peter

Nice concise write-up!

Some further points of interest:

1. If you have installed a USB-CDC device with one VCOM it is possible to add multiple CDC interfaces to it later (using the same VID/PID) and it will automaticaly appear as multiple VCOMs (up to 6 VCOMs are possible with the FRDM-K64F)

2.A fresh install (new VID/PID) of composite CDC devices works the same in automatic mode (no installation needed and all VCOMs are immediately available). Ref.: Windows 8 required a seperate manual installation for each interface....

3. With RNDIS devices (I was just testing a K61 based HS USB RNDIS on Windows 10) it is not as straightforward, unfortunately. [Noting that RNDIS is based on USB-CDC]
- the automatic install method installs it with usb_ser.sys, even if the Microsoft OS String Descriptor (MOD) is used to inform that it is RNDIS... Presently I have found no way to overload this after such an install, although there are dicussions about it in the Internet that don't work on my Win 10 version... [I do believe is that if one knows exactly where the files are stored on the PC it would be possible to directly select them but this is not something that can normally be expected of an end user - especially as the storge location may change and things are named differently in differnt language versions - so I haven't followed it up]
- I MUST remove the automatic method (2, 0, 0xff) instead of (2, 2, 0xff) so that it DOES allow a manual installation and then it is possibe to select a Microsoft "Remote RNDIS based Internet Sharing Device" which then works (almost) normally. Although the RNDIS works I have found that I need to set its adapter to have a fixed IP address and then set it back to "obtain its configuration from DHCP" otherwise it doesn't request from the DHCP server that is in the RNDIS device (not a USB problem but something else strange, which was Ok in Win 8)

- RNDIS + VCOM composite devices of course also need a manual install due to the same problem that it otherwise assumes usb_sys for each interface. Ref. Windows 8 only accepts RNDIS on the first interface and VCOMs following (it will not accept other ordering). Windows 8 will also only accept one RNDIS interface on the device. I haven't yet tried to see whether WIndows 10 will accept multiple RNDIS iterfaces or possibly different interface ordering (I don't have plans to do it at the moment after finding the Win 8 can't do it anyway, but maybe there will be interest at some point in the future and it would be very interesting it it did then work...)

Regards

Mark