Page 1 of 1

Binary data over USB

Posted: Thu Apr 21, 2022 1:21 am
by stephanelsmith
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.