What is USB CDC?USB CDC (Communications Device Class)is a USB device class defined by the USB-IF that allows a USB device to present itself as a communication device, such as a serial port, modem, network adapter, or telephony device. The most commonly used CDC subclass in embedded systems isCDC-ACM (Abstract Control Model), which emulates a traditional UART COM port. [usb.org], [en.wikipedia.org]CDC Class HierarchyUSB Device Class (0x02) │ ├── CDC-ACM (Virtual COM Port) ├── CDC-ECM (Ethernet Control Model) ├── CDC-NCM (Network Control Model) ├── CDC-ATM ├── CDC-PSTN └── CDC-WMCThe most common embedded implementation is:USB CDC-ACM ↓ Windows → COM3, COM4 ... Linux → /dev/ttyACM0 macOS → /dev/cu.usbmodemxxxx [usb.org], [en.wikipedia.org]CDC ArchitectureCDC separates communication into two interfaces:1. Communication Interface (CIC)Used for control and management.Class 0x02 (CDC)Carries:Line coding configurationDTR/RTS statusNotification messagesModem statusTypical endpoint:Interrupt IN2. Data Interface (DIC)Used for actual payload transfer.Class 0x0A (CDC Data)Typical endpoints:Bulk OUT Bulk INEndpoint LayoutA typical CDC-ACM device uses:EP0 Control EP1 IN Interrupt (Notification) EP2 OUT Bulk (Host → Device) EP2 IN Bulk (Device → Host) Host │ ▼ --------------- | CDC Driver | --------------- │ ┌────────┴─────────┐ ▼ ▼ Interrupt EP Bulk EP (Control) (Data)Enumeration ExampleDuring enumeration, the host sees:Device Descriptor Configuration Descriptor Interface 0 CDC Communication Interface Interface 1 CDC Data Interface The host loads the CDC driver and creates a virtual serial port.Examples:Windows : COM5 Linux : /dev/ttyACM0 macOS : /dev/cu.usbmodem101[en.wikipedia.org], [usb.org]CDC-ACM Control RequestsAfter enumeration, the host sends class-specific requests.SET_LINE_CODINGtypedef struct { uint32_t baudrate; uint8_t stopbits; uint8_t parity; uint8_t databits; } LINE_CODING;Example:115200 8 data bits No parity 1 stop bitGET_LINE_CODINGHost requests current UART settings.SET_CONTROL_LINE_STATEControls:DTR RTSMany MCU applications use DTR as:Terminal Connectedsignal.SEND_BREAKGenerate UART break condition.CDC-ACM Data FlowApplication │ UART-style API │ CDC Driver │ USB Bulk IN/OUT │ USB Host Example:printf(Hello\r\n);MCU:CDC_Transmit_FS()USB:Bulk IN EndpointPC Terminal:COM Port Windowshows:HelloWhy CDC Is PopularNo Custom Driver NeededMost operating systems already provide CDC drivers.Windows usbser.sys Linux cdc_acm macOS built-inUART ReplacementInstead of:USB-UART Bridge ↓ FT232 CP2102 CH340the MCU directly implements:USB CDC-ACM saving hardware cost.Debug ConsoleUsed for:Firmware logs CLI commands Bootloader communication AT commandsCDC vs HIDFeatureCDCHIDAppears asCOM PortKeyboard/MouseBulk transferYesNoDriver supportCDC DriverHID DriverThroughputHighLowerVirtual UARTYesNoCDC vs Vendor SpecificFeatureCDCVendor ClassStandardizedYesNoHost DriverBuilt-inUsually customCOM PortYesDependsPortabilityHighLowerTypical Descriptor ClassesDevice Class 0x02 CDC Communication 0x02 CDC Data 0x0AFunctional descriptors:Header Descriptor Call Management Descriptor ACM Descriptor Union DescriptorThese descriptors tell the host that the device implements the CDC-ACM model and that Interface 0 controls Interface 1. [cscott.net], [usb.org]For embedded firmware engineers,CDC-ACM is essentially USB behaving like a UART, although the transport underneath is actually USB control, interrupt, and bulk transfers rather than UART signaling.