CherryUSB – A lightweight USB device/host stack for embedded systems

CherryUSB is a lightweight open-source USB device/host stack for embedded systems with one or more USB interfaces. The stack implements various class drivers such as CDC, HID, MSC, audio, video, and so on.

It’s apparently part of Boufallo Lab SDK (e.g. for BL702 MCU), and has been ported and tested with WCH CH32V307 RISC-V MCU, STMicro STM32F4, and Nuvoton NUC442 Cortex-M4 microcontroller, as well as a two Arm Cortex-M3 microcontrollers I’ve never heard of: EastSoft ES32F3 and MindMotion MM32L3xx.

CherryUSB USB stack for embedded systems

CherryUSB device stack highlights:

  • Support for USB2.0 full and high speed
  • Endpoint irq callback
  • USB classes support
    • Composite Device
    • Communication Device Class (CDC)
    • Human Interface Device (HID) including “Custom HID”
    • Mass Storage Class (MSC)
    • USB VIDEO Class (UVC1.0,UVC1.5)
    • USB AUDIO Class (UAC1.0, UAC2.0)
    • Device Firmware Upgrade CLASS (DFU)
    • Test and Measurement CLASS (TMC)
    • Vendor class
  • Remote NDIS (RNDIS) support
  • Support WINUSB 1.0,WINUSB 2.0 with BOS (Binary Device Object Store)

The USB device stack core uses 3045 bytes of flash, and 373 of RAM, and the HID class takes an additional 784 bytes of storage, and 201 bytes of RAM.  We’re not told on which target, but that gives an idea.

CherryUSB host stack features:

  • Automatic loading of supported Class drivers
    • Composite Device
    • Communication Device Class (CDC)
    • Human Interface Device (HID)
    • Mass Storage Class (MSC)
    • Vendor class
  • Synchronous and asynchronous transfers
  • Multi-level HUB support, expandable up to 7 levels
  • Support Remote NDIS (RNDIS)

We’re not given any footprint estimation for the host stack.

The source code can be found on Github, released under an Apache License 2.0. There’s also a graphical configuration tool used to generate USB descriptors. Documentation is available but only in Chinese, and I notice some instructions for RT-Thread RTOS as well, so more microcontrollers may be supported beyond the list provided in the introduction.

Share this:

Support CNX Software! Donate via cryptocurrencies or become a Patron on Patreon

ROCK Pi 4C Plus
Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
Weller PCB manufacturer