Skip to content

Platforms

pschatzmann edited this page Nov 26, 2026 · 4 revisions
Platform USB stack Board settings
ESP32-S2 / S3 / P4 TinyUSB of the arduino-esp32 core (3.x) USB Mode: USB-OTG (TinyUSB), USB CDC On Boot: Disabled
RP2040 / RP2350 (arduino-pico) Adafruit TinyUSB (bundled with the core) USB Stack: Adafruit TinyUSB
STM32 with USB OTG FS (e.g. F4, F7, H7) Adafruit TinyUSB Library USB support: None
SAMD, nRF52 Adafruit TinyUSB Library (untested)

Except for the ESP32, whose core has its own TinyUSB integration, all boards use the same generic TinyUSB layer (UVCPlatformTinyUSB.h): the camera is added as an interface of the Adafruit TinyUSB device, next to the USB serial port. You can also use it on the ESP32 with the Adafruit TinyUSB Library by defining TINYUVC_USE_ADAFRUIT_TINYUSB. | Linux / macOS / Windows | simulated host (UVCHostSimulator) | CMake, see Desktop |

Status

Verified on hardware with a Linux host (ffmpeg/V4L2, VLC, Cheese and guvcview):

  • ESP32-S3 + OV5640: YUY2 test pattern, MJPEG from MJPEGEncoder, the camera as MJPEG at 320x240 and 640x480 (15 fps), repeated stream start/stop; TinyGPU wireframe cube as MJPEG (320x240 at 11 fps, 640x480 at 3 fps)
  • Raspberry Pi Pico (RP2040) with Adafruit TinyUSB: YUY2 test pattern at 15 fps next to the USB serial port, repeated stream start/stop; a one hour soak test of 48600 frames and 540 open/close cycles without a single error

RP2350, STM32, ESP32-S2 and ESP32-P4 compile (see test_compile.sh) but are not yet verified on hardware; Windows and macOS hosts are not yet tested.

ESP32

The core builds its USB descriptor when USB starts, and uvc.begin() starts it. With "USB CDC On Boot: Enabled" USB is already running before setup(), and begin() fails. To still have a USB serial port, declare a USBCDC USBSerial; object as in the examples: it shares the OTG port with the camera and supports the 1200 baud reset into the bootloader (stty -F /dev/ttyACM0 1200, then upload).

RP2040 / RP2350

Select Tools > USB Stack > "Adafruit TinyUSB": with the default "Pico SDK" stack the sketch does not compile.

The video classes of arduino-audio-tools need FreeRTOS: select Tools > Operating System > "FreeRTOS SMP" and add #include "AudioTools/Concurrency/RTOS.h" after AudioTools.h.

STM32

Install the Adafruit TinyUSB Library and set "USB support" to "None". The video classes of arduino-audio-tools need the STM32FreeRTOS library.

Bandwidth

All supported MCUs except the ESP32-P4 have a full speed USB port (12 Mbit/s). A bulk endpoint delivers roughly 1 MB/s there. An uncompressed YUY2 frame needs 2 bytes per pixel: 160x120 at 15 fps (576 KB/s) works, 320x240 only at about 5 fps. Use MJPEG for bigger pictures: with a JPEG capable sensor (ESP32 cameras), or with the software MJPEGEncoder of arduino-audio-tools.

Clone this wiki locally