ESP32 USB OTG board needed

I’ve got the Espressif devkits that support USB OTG - ESP32-C3-DevKitM-1 and ESP32-S3-DevKitC-1 - but neither seem to be supported by PlatformIO.

Do you have a suggestion for an ESP32 that does USB OTG and is also supported by PlatformIO?

The ESP32-C3 does NOT have a USB OTG peripheral. It has a USB peripheral restricted to JTAG and USB CDC (serial connection). So it can be used for uploading, debugging and for serial communication.

For the serial communication, just use USBSerial instead of Serial, e.g.:

#include <Arduino.h>

void setup() {
    USBSerial.begin(115200);
}

void loop() {
    USBSerial.println("Hello, world!");
    delay(2000);
}

Note that immediately after uploading code, the serial communication will not work. You have to press the RESET button first.

Hi,

I need to create communication over two ESP32-s3 using USB, since USBHost functionality is not supported by PlatformIO, what are my options?

Does USBSerial can be use to communicate between two esp32-s3?

Regards

Why not supported? We should support everything the Arduino IDE does. Can you give a concrete example / sketch / configuration which works in the Arduino IDE but doesn’t in PlatformIO?

I did not said that it is supported by ArduinoIDE, it is only supported in ESP-IDF.

USB-Host functionality is only supported in ESP-IDF.

ESP-IDF is fully supported by PlatformIO. So there is no restriction here.

For two ESP32-S3s to communicate with each other over USB, one must assume the role of USB host and the other one the role USB device.

Furthermore, they must agree on a protocol. The best support for a protocol is likely available for USB CDC ACM (serial communication over USB). So one device implements the host side of USB CDC, the other the device side.

For the USB CDC host, the ESP-IDF example cdc_acm_host is a good starting point.

For the USB CDC device, multiple options exist:

  • In menuconfig in Component config > ESP System Settings > Channel for console output: select USB CDC if your USB port is connected to the ESP32-S3’s USB OTG peripheral. You can then simply write to and read from the console.
  • In menuconfig in Component config > ESP System Settings > Channel for console output: select * USB Serial/JTAG Controller* if your USB port is connected to the USB Serial/JTAG port. Again, you can then simply write to and read from the console.
  • Implement something along the lines of the ESP-IDF example tusb_serial_device