Microcontrollers with USB interface are common, but…
Microcontrollers with USB interface are common nowadays. Manufacturers provide source codes for USB device classes like CDC, HID, Mass storage and DFU. . Even in this case, programming USB communications may not be a trivial task. If it is only required to replace RS232 serial interface to USB, is worth considering using of FTDI TF-X series USB to serial bridge.
● Entire USB protocol handled on the chip. No USB specific firmware programming required.
● Detection of connection to DCP (Dedicated Charging Port) USB port.
● Lower requirements for microcontroller resources. Communication through UART, I2C or SPI is less resource demanding than implementation of USB CDC device class
● Drivers for Windows, Mac OS-X, Linux and Android for free.
● Microcontroller pins are connected to USB connector through USB/serial bridge. ESD or overvoltage spikes on USB bus can damage bridge instead of microcontroller. Replacement of small bridge chip is simpler than replacement of microcontroller.
● USB/serial bridge chip requires PCB space and increases cost.
For more detail: Microcontrollers with USB interface are common, but…
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw