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)
    • MIDI CLASS (MIDI)
    • 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, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX Rockchip RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
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.
7 Comments
oldest
newest
Rogan Dawes
Rogan Dawes
2 years ago

Wonder why one would choose this over TinyUSB?

Rogan Dawes
Rogan Dawes
2 years ago

Looks like some of the gadget functions implemented in Cherry USB are also not yet implemented in TinyUSB, so e.g. USB RNDIS or UVC might be a compelling reason.

sakumisu
sakumisu
2 years ago

Thank you for recommending my repo,also, some of the mcus are not yet supported.I did this to simplify the code and api usage, and templatizing the programming will allow users to find patterns and easily assign paste. The second is to make it easy for newbies to use usb like uart and dma.

sakumisu
sakumisu
2 years ago

Making the complex simple

Yaumen
Yaumen
2 years ago

Dear sakumisu. Thanks for your CherryUSB. Do you plan to write a port for LPC17xx devices?

Boardcon Rockchip RK3588S SBC with 8K, WiFI 6, 4G LTE, NVME SSD, HDMI 2.1...