Turn off USB CDC Device

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Stan456
 
Posts: 2
Joined: Sun Oct 10, 2021 11:31 am

Turn off USB CDC Device

Post by Stan456 »

Board: Adafruit Feather M0 Express
Development Tool: Arduino IDE
Problem or question: Turn off USB CDC Device on SAMD21

Please is there any way to turn off USB CDC Device? I would like to create a device based on the Adafruit Feather M0 Express board that only behaves like an USB MSC Device.
The CDC seems to be part of the core, and I haven't found a way to turn it off. I need older Windows systems not to seek for CDC drivers when connecting this device. And to prevent an unrecognized device appearing in Windows Device Manager.
Thanks for any advice. Stan

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Turn off USB CDC Device

Post by hathach »

If selecting TinyUSB as usb stack, you could disable the Serial by calling Serial.end() as one of the first command in the setup(). The example is here https://github.com/adafruit/Adafruit_Ti ... al.ino#L26

Note: you will loose the auto-reset when uploading new sketch, and need to manually double tap reset button before uploading.

User avatar
Stan456
 
Posts: 2
Joined: Sun Oct 10, 2021 11:31 am

Re: Turn off USB CDC Device

Post by Stan456 »

Thank you hathach,
your advice was accurate. New version of TinyUSB library and Serial.end(); solved my problem.
Since then, I've tested it on a number of computers with different versions of the operating system.
It works from ancient Win2000, XP, Vista, 7, 10... No driver for CDC is required and MSD is functional.
Thanks again.
Stan

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”