Fără Descriere

sakumisu da170ae177 update port rst 3 ani în urmă
class 020e99c524 update hid functions register 3 ani în urmă
common 174a07fb89 update readme 3 ani în urmă
core ed37802600 update usb core macros 3 ani în urmă
demo 3d615a1c66 update template 3 ani în urmă
docs da170ae177 update port rst 3 ani în urmă
osal 859c2ee6ae modify section protect with global irq 3 ani în urmă
packet capture 274c3aa6be update packet capture files 4 ani în urmă
port a8fb71bed7 update ep config 3 ani în urmă
third_party ad12809f00 add fatfs in demo 4 ani în urmă
tools e938e44320 delete submodule,replace with url 3 ani în urmă
.clang-format 8a143df509 first commit 4 ani în urmă
.gitattributes 4ef4a9be98 add gitattributes 4 ani în urmă
.gitignore 2bb5d6c137 add ignore files 3 ani în urmă
LICENSE 8a143df509 first commit 4 ani în urmă
README.md 174a07fb89 update readme 3 ani în urmă
README_zh.md 174a07fb89 update readme 3 ani în urmă
SConscript 2b686023eb fix dwc2 path name 3 ani în urmă
usb_config.h ed37802600 update usb core macros 3 ani în urmă

README.md

CherryUSB

中文版

CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB ip.

CherryUSB

Why choose

  • More comprehensive class drivers, and class drivers are all templated, easy to learn and add independently
  • Tree programming, easy to understand the relationship between class driver and interface, endpoint, the relationship between hub, port, class; code layer by layer, call relationship at a glance, easy to understand the usb enumeration process and class driver loading
  • The use of the device stack is simplified to the use of classes such as uart and dma, and the use of the host stack is simplified to the use of files
  • Standardized porting interface, as well as ip-oriented programming, eliminating the need to rewrite drivers for the same ip
  • Api less, clear classification: dcd/hcd api, registration api, command callback api
  • Streamlined code, minimal memory footprint, and the ability to achieve the maximum bandwidth that usb hardware can achieve

Directoy Structure

.
├── 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

Device Stack Overview

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

Host Stack Overview

The CherryUSB Host Stack has a standard enumeration implementation for devices mounted on roothubs and external hubs, and a standard interface for different Classes 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 host stack is managed using os, and provides osal to make a adaptation for 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.

CherryUSB Host Stack resource usage (GCC 10.2 with -O2):

file FLASH (Byte) RAM (Byte)
usbh_core.c 7992 472
usbh_cdc_acm.c 1208 4
usbh_msc.c 2239 4
usbh_hid.c 930 4
usbh_hub.c 3878 14

Documentation Tutorial

Quickly start, USB basic concepts, API manual, Class basic concepts and examples, see CherryUSB Documentation Tutorial

Video Tutorial

USB basic concepts and how the CherryUSB Device stack is implemented, see CherryUSB Device Stack Tutorial.

Graphical Config Tool

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.

Demo Repo

Manufacturer CHIP or Series USB IP Repo Url
Bouffalolab BL702 bouffalolab bl_mcu_sdk
Essemi ES32F36xx musb es32f369_repo
AllwinnerTech F1C100S musb cherryusb_rtt_f1c100s
ST STM32F103C8T6 fsdev stm32f103_repo
ST STM32F4 dwc2 stm32f429_device_repo stm32f429_host_repo
ST STM32H7 dwc2 stm32h743_device_repo stm32h743_host_repo
WCH CH32V307 ch32_usbfs/ch32_usbhs ch32v307_repo
WCH CH57x ch58x ch57x_repo
Nuvoton Nuc442 nuvoton nuc442_repo
Nordicsemi Nrf52840 nrf5x nrf5x_repo
Geehy APM32E10x APM32F0xx fsdev apm32_repo
Mindmotion MM32L3xx mm32 mm32_repo
Espressif esp32 dwc2 esp32_repo

Contact

QQ group: 642693751