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:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus

7 Replies to “CherryUSB – A lightweight USB device/host stack for embedded systems”

  1. I’ve just noticed the developer (sakumisu) works for Bouffalo Lab, so it should be no surprise that it’s part of the BL SDK…

      1. Some of the MCUs supported by CherryUSB are not (yet) supported by TinyUSB, but apart from that, I’m not sure.

        1. 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.

        2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC