CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB ip.
- Ip-oriented programming, the same usb ip driver does not need to be written repeatedly, only the parts that are not the same need to be implemented
- Code tree writing makes it easier for users to understand usb concept, enumeration process, class driver loading
- Templating the Class driver makes it easier to use composite device and add custom drivers
- Simplifying the complex transfer of usb makes it easier for users to use usb as easily as uart and dma
- Fewer directory structures, fewer apis, fewer codesize, extreme usb bandwidth
.
├── class
├── common
├── core
├── demo
├── docs
├── osal
├── packet capture
└── port
└── tools
Directory | Description |
---|---|
class | usb class driver |
common | usb spec macros and utils |
core | usb core implementation |
demo | different chips demo |
osal | os wrapper |
docs | doc for guiding |
packet capture | packet capture file |
port | usb dcd and hcd porting |
tools | tool used url |
CherryUSB Device Stack provides a unified framework of functions for standard device requests, CLASS requests, VENDOR requests and custom special requests. The object-oriented and chained approach allows the user to quickly get started with composite devices without having to worry about the underlying logic. At the same time, a standard dcd porting interface has been standardised for adapting different USB IPs to achieve ip-oriented programming.
CherryUSB Device Stack has the following functions:
- Support USB2.0 full and high speed
- Support endpoint irq callback register by users, let users do whatever they wants in endpoint irq callback.
- Support Composite Device
- Support Communication Device Class (CDC)
- Support Human Interface Device (HID)
- Support Custom human Interface Device (HID)
- Support Mass Storage Class (MSC)
- Support USB VIDEO CLASS (UVC1.0、UVC1.5)
- Support USB AUDIO CLASS (UAC1.0、UAC2.0)
- Support Device Firmware Upgrade CLASS (DFU)
- Support USB MIDI CLASS (MIDI)
- Support Test and Measurement CLASS (TMC)
- Support Remote NDIS (RNDIS)
- Support WINUSB1.0、WINUSB2.0(with BOS)
- Support Vendor class
CherryUSB Device Stack resource usage (GCC 10.2 with -O2):
file | FLASH (Byte) | RAM (Byte) |
---|---|---|
usbd_core.c | 3045 | 373 |
usbd_cdc.c | 302 | 20 |
usbd_msc.c | 2452 | 132 |
usbd_hid.c | 784 | 201 |
usbd_audio.c | 438 | 14 |
usbd_video.c | 402 | 4 |
The CherryUSB Host Stack has a standard enumeration implementation for devices mounted on roothubs and external hubs, and a standard interface for the different Class to indicate what the Class driver needs to do after enumeration and after disconnection. A standard hcd porting interface has also been standardised for adapting different USB IPs for IP-oriented programming. Finally, the protocol stack is managed using os, and provides osal to make a adaptation to different os.
CherryUSB Host Stack has the following functions:
- Automatic loading of supported Class drivers
- Support blocking transfers and asynchronous transfers
- Support Composite Device
- Multi-level HUB support, expandable up to 7 levels
- Support Communication Device Class (CDC)
- Support Human Interface Device (HID)
- Support Mass Storage Class (MSC)
- Support Remote NDIS (RNDIS)
- Support Vendor class
The CherryUSB Host stack also provides the lsusb function, which allows you to view information about all mounted devices, including those on external hubs, with the help of a shell plugin.
Quickly start, USB basic concepts, API manual, Class basic concepts and examples, see CherryUSB Documentation Tutorial
USB basic concepts and how the CherryUSB Device stack is implemented, see CherryUSB Device Stack Tutorial.
chryusb_configurator is written in electron + vite2 + ts framework,currently used to automate the generation of descriptor arrays, with additional functionality to be added later.
Manufacturer | CHIP | USB IP | repo url |
---|---|---|---|
bouffalolab | BL702 | bouffalolab | bl_mcu_sdk |
ES32 | ES32F369x | musb | es32f369_repo |
AllwinnerTech | F1C100S | musb | cherryusb_rtt_f1c100s |
STM32 | STM32F103C8T6 | fsdev | stm32f103_repo |
STM32 | STM32F429IGT6 | synopsys/dwc2 | stm32f429_device_repo stm32f429_host_repo |
CH32 | CH32V307 | ch32 | ch32v307_repo |
CH32 | CH57x | ch32 | ch57x_repo |
Nuvoton | nuc442 | nuvoton | nuc442_repo |
Nordicsemi | nrf52840 | nrf5x | nrf5x_repo |
APM32 | apm32exx | fsdev | apm32_repo |
MM32 | mm32l3xx | mm32 | mm32_repo |