CherryUSB User Guide
CherryUSB is a small, lightweight, portable USB host and device protocol stack for embedded systems. CherryUSB offers the following advantages:
Easy to Learn USB
To facilitate user learning of USB fundamentals, enumeration, driver loading, and IP drivers, the written code has the following advantages:
Streamlined code with simple logic and no complex C language syntax
Tree-structured programming with progressive code layers
Templated and simplified Class drivers and porting drivers
Clear API categorization (Device: initialization, class registration, command callbacks, data transmission; Host: initialization, class discovery, data transmission)
Easy to Use USB
To facilitate user interaction with USB interfaces, considering users’ familiarity with UART and DMA, the designed data transmission interface has the following advantages:
Equivalent to using UART TX DMA/UART RX DMA
No length restrictions on transmission/reception; users don’t need to worry about USB packetization (porting drivers handle packetization)
Easy to Achieve USB Performance
Considering USB performance requirements to reach theoretical USB hardware bandwidth, the designed data transmission interface has the following advantages:
Porting drivers directly interface with registers without abstraction layer encapsulation
Memory zero copy
DMA mode used when IP supports DMA (DMA provides hardware packetization functionality)
No length restrictions, facilitating hardware DMA interfacing and maximizing DMA advantages
Packetization handled in interrupt context
Device Protocol Stack Overall Execution Flow
Host Protocol Stack Overall Execution Flow
Other Related Links
Video Tutorial: https://www.bilibili.com/cheese/play/ss707687201
CherryUSB Theoretical Analysis and Application Practice - Hans Journal: https://www.hanspub.org/journal/paperinformation?paperid=126903
Quick Start
USB Basic Knowledge
Examples
- CDC ACM Device
- HID Device
- MSC Device
- AudioV1 Device
- AudioV2 Device
- USB Video Device
- WinUSB Device
- WebUSB Device
- CDC RNDIS Device
- CDC ECM Device
- ADB Device
- MTP Device
- Serial Host
- HID Host
- MSC Host
- Network Host
- BTBLE Host
- WIFI Host
- Audio Host
- Video Host
- USB OTG
- Writing Vendor Device Driver
- Writing Vendor Host Driver
Release Notes
Performance Showcase
Commercial Support