Skip to content

About USB

On ESP32-S2/S3 (and ESP32-C3/C6 for USB CDC) the native USB port can be used by ESP3D in two different ways, depending on what is connected to it:

ModeESP roleConnected toFeature
USB Serial OTGUSB host3D printer / CNC USB portUSB_SERIAL_FEATURE
USB CDCUSB deviceComputerUSB_CDC_CLIENT_FEATURE

The two modes cannot be used at the same time.

On ESP32-S2 and ESP32-S3 the USB Serial OTG can be enabled. This allows to connect the USB OTG port to the 3D printer/CNC usb port if this one has Silicon Labs CP210x, FTDI FT23x or CP34x USB to UART converter.

See Module client for implementation details.

The native USB port of the ESP32-S2/S3/C3/C6 is used as serial port (USB CDC device), like on the Wemos S2 mini or the Waveshare ESP32-S3-Touch-LCD-1.47. A computer connected to this USB port can send ESP3D commands and receive the printer/CNC output, like a serial terminal. The printer/CNC is then connected to the UART of the board.

  • USB_CDC_CLIENT_FEATURE in configuration.h
  • the board must be built with ARDUINO_USB_CDC_ON_BOOT=1, then Serial is the native USB and the UART0 is Serial0
  • it cannot be used with USB_SERIAL_FEATURE

The client is enabled by default, it can be enabled / disabled with [ESP935] or by the setting service/usb_cdc/enable of [ESP401].

The USB port itself is never stopped, because it is also used by log output and to flash the board, only the client is stopped.

The log can use the native USB port with LOG_OUTPUT_USB_CDC in configuration.h, it also needs ARDUINO_USB_CDC_ON_BOOT=1. LOG_USB_CDC_WAIT_MS can be defined to wait up to x ms at boot for the host to open the port, so the first logs are not lost.

See Module client for the client behavior.