Skip to content

Latest commit

 

History

History
121 lines (89 loc) · 5.21 KB

readme.md

File metadata and controls

121 lines (89 loc) · 5.21 KB

Teeny USB

A teeny USB stack for STM32 MCUs, also contain a toolset to create USB descriptors and drivers.

关于TeenyUSB的实现细节和使用方式请阅读《STM32 USB设备开发指南》 Github下载 , 21IC下载

特性

  1. 设备例程:串口,5路串口,自定义HID,自定义设备批量传输(无需驱动)。
  2. 主机例程:无协议栈主机,键盘鼠标+HUB。
  3. 使用lua脚本生成USB相关描述符,并根据描述符自动生成初始化配置代码。
  4. 根据USB描述自动生成驱动文件,并对驱动文件签名。

Feature

  1. Device demo: CDC, multiple CDC, Custom HID, Custom Bulk (No custom driver need, even no inf)
  2. Host demo: raw host, hub+keyboard+mouse
  3. USB descriptor generation by lua script and UI tool
  4. Driver inf generation (based on libwdi)

目录结构说明 Folder

usb_stack TeenyUSB协议栈的源码 Source code of TeenyUSB

TeenyDT 描述符自动生成工具及源码 Source code of USB descriptor tool

pc_test_tool PC端测试工具及源码 Source code for USB device test tool

TeenyUSB协议栈 TeenyUSB Stack

示例 demos

USB设备例程 Demo for device

Demo Folder Demo Type Tested Board
custom_bulk 自定义 Bulk 设备 All Below
cdc 虚拟串口 CDC All Below
msc 虚拟U盘 Mass Storage All Below
custom_hid 自定义 HID 设备 All Below
cdc5 5路 CDC All Below
CubeMXF107 CubeMX+TeenyUSB 自定义设备 STM32F107VCT6
CubeMXF303 CubeMX+TeenyUSB 自定义设备 STM32F3 Disco
CubeMXF723 CubeMX+TeenyUSB 自定义设备 stm32f723e discovery

USB主机例程 Demo for host

Demo Folder Demo Type Tested Board
host_raw 无协议栈主机 Raw Host 723
host_input HUB+KeyBoard+Mouse 723

USB OTG例程 Demo for OTG

Demo Folder Demo Type Tested Board
host_rtt OTG in rtthread stm32f723e_disco

接入普通USB线时,工作在设备模式,FS设备默认为CDC串口,HS设备默认为U盘,使用板载QSPI,可以通过命令行更改设备角色,重新插拔后生效。

接入OTG线时,工作在主机模式,主机采用修改后的rtthread USB主机协议栈,目前支持HUB,U盘,键盘和鼠标。

When plug with normal USB cable, work in device mode, the FS core is CDC and HS core is MSC by default. The device role can be changed through the command.

When plug with OTG cable, work in host mode, support HUB, Mass storage, keyboard and mouse devices.

Demo测试用的开发板 Demo tested on boards

Board Folder Board Type Chip HSE Freq Tested USB Core
stm32f0 Custom board STM32F072C8T6 No HSE USB FS
stm32f1 Custom board STM32F103RET6 8 MHz USB FS
stm32f407_evk Waveshare EVK407I STM32F407IGT6 8 MHz OTG_FS/OTG_HS_ULPI
stm32f723e_disco stm32f723e discovery STM32F723IEK6 25 MHz OTG_FS/OTG_HS_Embed
stm32767zi_nucleo stm32f767zi nucleo STM32F767ZIT6 8 MHz OTG_FS

TeenyDT 描述符工具 TeenyDT Descriptor Tool

UI操作方式 GUI

teenydt_ui

teenydt_ui_en

命令行方式 Command Line

lua gen_descriptor.lua demo.lua -maxep=7 -maxmem=1024

TeenyDT版本描述符示例,Demo of descriptor in TeenyDT

return Device {
    strManufacture = "TeenyUSB",
    strProduct = "TeenyUSB CDC",
    strSerial = "TUSB123456",
    idVendor = 0x0483,
    idProduct = 0x0002,
    prefix = "CDC",
    Config {
        CDC_ACM{
            EndPoint(IN(3),  Interrupt,  64),
            EndPoint(IN(1),  BulkDouble, 64),
            EndPoint(OUT(2), BulkDouble, 64),
        },
   }
}

更多示例 More TeenyDT Descriptor Demo:Custom BulkCDCCDCx5MSCCustom HID

USB测试工具 USB Test Tool

串口测试 Serial Port Viewer

test_cdc5

HID测试 HID Viewer

test_hid