Overview of USB Device CDC Standalone Example
masterThe CDC Standalone example implements a USB-to-RS232 bridge using the Device Communication Class (CDC) following the PSTN subprotocol. The STM32 MCU acts as a Virtual COM Port (VCP), where it exchanges data with a PC host via the USB interface (Device mode) and with other devices via the UART interface (RS232).
Key Features:
- Full-Duplex Communication: UART receiving is handled via interrupts, while UART transmitting is handled via DMA, allowing simultaneous bidirectional data flow.
- USB Endpoints:
- Bulk IN: Transmits data from STM32 to PC. Data received over UART is stored in
UserTxBufferand transmitted periodically based on theCDC_POLLING_INTERVAL. - Bulk OUT: Receives data from PC to STM32. Data is stored in
UserRxBufferand transmitted over UART using interrupt mode. - Interrupt IN: Handles serial-port parameter requests (Set line/Get line) via
CDC_Itf_Control().
- Bulk IN: Transmits data from STM32 to PC. Data received over UART is stored in
- Clock Configuration: The system clock (SYSCLK) runs at 72 MHz, and the Full Speed (FS) USB module uses an internal 48-MHz clock generated from an integrated PLL.