Binary data over USB

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
stephanelsmith
Posts: 9
Joined: Mon Oct 18, 2021 7:03 pm

Binary data over USB

Post by stephanelsmith » Thu Apr 21, 2022 1:21 am

On esp32 S2/S3, USB is used by default for repl. I can change default repl to UART0:
ESP_CONSOLE_UART_DEFAULT=y
CONFIG_USB_ENABLED=n

Now that I have an open USB available, is it possible to configure a usb stream object for stream like machine.UART?

I'm looking for:
from micropython import USB_CDC
usb0 = USB_CDC(0)
usb0.write(bytes(100))

Alternatively, is there another way to send data through USB without using REPL or having it tied to stdin/out?

In my application, I would like to send raw binary, characters 0x00-0xff, via USB. I'd like to explictly control when repl is activated over USB. Would be cool to use dupterm with USB.

Post Reply