{"id":13698698,"url":"https://github.com/xtoolbox/TeenyUSB","last_synced_at":"2025-05-04T03:32:03.926Z","repository":{"id":41364451,"uuid":"160909901","full_name":"xtoolbox/TeenyUSB","owner":"xtoolbox","description":"Lightweight USB device and host stack for STM32 and other MCUs. Ready for USB 3.0 device.","archived":false,"fork":false,"pushed_at":"2023-11-30T04:36:23.000Z","size":6303,"stargazers_count":571,"open_issues_count":24,"forks_count":178,"subscribers_count":33,"default_branch":"master","last_synced_at":"2024-11-13T03:34:48.526Z","etag":null,"topics":["cdc","ch56x","composite","embedded","hid","host","hub","msc","rndis","speed","stm32","super","usb","usb3","winusb"],"latest_commit_sha":null,"homepage":"http://www.tusb.org","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xtoolbox.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-08T06:11:18.000Z","updated_at":"2024-11-07T14:27:51.000Z","dependencies_parsed_at":"2022-08-28T03:11:30.672Z","dependency_job_id":"53a3aacc-61cc-4ad2-9f9a-e0f014950f1d","html_url":"https://github.com/xtoolbox/TeenyUSB","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtoolbox%2FTeenyUSB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtoolbox%2FTeenyUSB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtoolbox%2FTeenyUSB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtoolbox%2FTeenyUSB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtoolbox","download_url":"https://codeload.github.com/xtoolbox/TeenyUSB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252283729,"owners_count":21723533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdc","ch56x","composite","embedded","hid","host","hub","msc","rndis","speed","stm32","super","usb","usb3","winusb"],"created_at":"2024-08-02T19:00:52.009Z","updated_at":"2025-05-04T03:31:58.917Z","avatar_url":"https://github.com/xtoolbox.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"Teeny USB \n==========\n[![Build Status](https://travis-ci.org/xtoolbox/teenyusb.svg?branch=master)](https://travis-ci.org/xtoolbox/teenyusb)\n\n一个简易的单片机USB主机和设备协议栈，现在支持3.0设备。\n\nA teeny USB device and host stack for MCUs, support super speed device.\n\n关于TeenyUSB的实现细节和使用方式请阅读《STM32 USB设备开发指南》 [Github下载](https://github.com/xtoolbox/TeenyUSB/releases/download/0.1/STM32_USB_desgin_guide.pdf) , [21IC下载](http://dl.21ic.com/download/stm32_usb-285543.html)\n\n## 设备栈 Device Stack\n- HID class\n- MSC 大容量存储设备，U盘。 Mass storage class\n- CDC ACM 虚拟串口。 Communication device class, abstract control mode, known as virtual serial port.\n- CDC RNDIS 虚拟网口。 Communication device class, remote NDIS\n- Vendor 厂商自定义设备。 vendor class\n\nUSB描述符由TeenyDT生成。 [在线试用TeenyDT](http://dt1.tusb.org)\n\nUSB descriptor is generate by TeenyDT. [Try TeenyDT online](http://dt.tusb.org)\n\n### USB设备例程 Demo for device\n\n- 复合设备，包含HID CDC(虚拟串口) WinUSB MSC(U盘) Composite device with HID+CDC+WinUSB+MSC\n- WinUSB设备，Bulk传输免驱动。 Bulk device with WinUSB support\n- CMSIS DAP on STM32F723 discovery\n- 虚拟网卡, CDC RNDIS device\n\n## 主机栈 Host Stack\n- HUB class, 支持多设备级连, support multiple device and hub\n- HID class, 支持键盘、鼠标以及自定义HIDden设备。support keyboard, mouse, custom device\n- MSC class, 大容量存储类(U盘)，使用BOT协议。 mass storage class with BOT protocol\n- CDC ACM class, 虚拟串口。 Communication device class, abstract control mode\n- CDC RNDIS class,  虚拟网口。 Communication device class, remote NDIS\n- Vendor class，厂商自定义设备\n\n### USB主机例程 Demo for host\n\n- 简易交互式主机，支持U盘、HUB、键盘、鼠标以及自定义设备 [更多说明][host_readme]。 Interactive host, support HUB,MSC,Keyboard,Mouse and generic device. [more info][host_readme]\n- rt-thread双角色设备, 支持运行时切换设备类行，支持动态mount U盘，[更多说明][drd_readme]。Dual role device with rt-thread, [more info][drd_readme].\n\n[host_readme]: https://github.com/xtoolbox/TeenyUSB/blob/master/demo/host/readme.md\n[drd_readme]: https://github.com/xtoolbox/TeenyUSB/blob/master/demo/drd_rtt/readme.md\n\n## 如何生成示例程序 How to make demo\n\n编译工具为 [arm-none-eabi-gcc](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) is the compile toolchain.\n\n调试使用VSCode+OpenOCD，[如何在VSCode中配置STM32开发调试环境?](http://blog.xtoolbox.org/stm32_open_source_toolchain/)\n\n``` batch\ngit clone https://github.com/xtoolbox/TeenyUSB.git\ncd TeenyUSB\ngit submodule update --init\ncd sample\nmake all -j8\n```\n如果更新mcu库很慢，可以使用gitee.com镜像。[https://gitee.com/xtoolbox/st_driver.git](https://gitee.com/xtoolbox/st_driver.git)\n\n### demo编译后各字段大小信息 Section size info of each demo\n```\n$ echo \"   text    data     bss     dec     hex filename\" \u0026\u0026 make all -j8 LOG_INFO=0 | grep '^[^l].*output/.*.elf'\n   text    data     bss     dec     hex filename\n  12072    1084   69296   82452   14214 output/f723dap.elf\n   4480    1080    6068   11628    2d6c output/f072bulk.elf\n   6392    1084    6416   13892    3644 output/f407bulk.elf\n   5396    1084    6064   12544    3100 output/f303bulk.elf\n   4972    1080    6068   12120    2f58 output/f103bulk.elf\n   6524    1084    6416   14024    36c8 output/f723bulk.elf\n   6284    1084    6416   13784    35d8 output/f767bulk.elf\n   8100    3500    2200   13800    35e8 output/f103comp.elf\n   8324    3500    2200   14024    36c8 output/f072comp.elf\n  10132    3504    2588   16224    3f60 output/f407comp.elf\n  10240    3504    2588   16332    3fcc output/f723comp.elf\n   8528    3504    2196   14228    3794 output/f303comp.elf\n  10000    3504    2588   16092    3edc output/f767comp.elf\n  27560    1092   35776   64428    fbac output/f107host.elf\n  28704    1092   28608   58404    e424 output/f407host.elf\n  28860    1092   28832   58784    e5a0 output/f723host.elf\n  28504    1092   28792   58388    e414 output/f767host.elf\n```\n\n## 目录结构说明 Folder\n```\n.\n├── TeenyDT         # 基于lua的USB描述符生成工具 A lua based USB descriptor generator \n├── sample          # 示例代码 Sample projects\n├── mcu_lib         # MCU文件子仓库，MCU library sub module\n├── core            # USB核心文件， TeenyUSB core file\n├── class           # USB设备类和主机类文件, TeenyUSB device and host class file\n├── driver_stm32    # STM32驱动文件。 STM32 Driver file\n├── pc_test_tool    # 基于lua Qt的Windows USB 测试程序 A luaQt based Windows program to test CDC/HID/WinUSB devices\n└── third_part      # 第三方代码,如FatFs,rt-thread。 Third part source code, e.g. FatFs, rt-thread.\n```\n\n## Demo测试用的开发板 Demo tested boards\n\n| Board Folder     |      Board Type             |      Chip     |HSE Freq | USB Core            |\n|------------------|-----------------------------|---------------|---------|---------------------|\n| stm32f072c8t6    | Custom board                | STM32F072C8T6 | No HSE  | USB FS              |\n| stm32f103ret6    | Custom board                | STM32F103RET6 | 8 MHz   | USB FS              |\n| stm32f107vc      | Custom board                | STM32F107VCT6 | 25 MHz  | OTG_FS              |\n| stm32f3_disco    | [stm32f3 disco][303]        | STM32F303VCT6 | 8 MHz   | USB FS              |\n| stm32f407_evk    | [Waveshare EVK407I][407]    | STM32F407IGT6 | 8 MHz   | OTG_FS/OTG_HS_ULPI  |\n| stm32f723e_disco | [stm32f723e discovery][723] | STM32F723IEK6 | 25 MHz  | OTG_FS/OTG_HS_Embed |\n| stm32767zi_nucleo| [stm32f767zi nucleo][767]   | STM32F767ZIT6 | 8 MHz   | OTG_FS              |\n| stm32h743_openmv | [stm32h743_openmv][h743]    | STM32H743VIT6 | 12 MHz  | OTG_FS              |\n| ch565w_evk       | [ch565w_evk][ch565w]        | CH565W        | 30 MHz  | OTG_SS              |\n\n\n[767]: https://www.st.com/en/evaluation-tools/nucleo-f767zi.html\n[723]: https://www.st.com/en/evaluation-tools/32f723ediscovery.html\n[407]: http://www.waveshare.net/wiki/EVK407I\n[303]: https://www.st.com/en/evaluation-tools/stm32f3discovery.html\n[h743]: https://github.com/Kevincoooool/OpenMV_PCB\n[ch565w]: http://www.wch.cn/downloads/CH569EVT_ZIP.html\n\n## 其它支持STM32的开源USB协议栈 Other open source USB stack for STM32\n- [tinyusb](https://github.com/hathach/tinyusb.git)  全静态内存分配，不支持多设备，不支持同一设备上使用多个同类型接口，暂时不支持STM32主机模式。\n- [libopencm3](https://github.com/libopencm3/libopencm3.git) 动态生成描述符，不依赖官方库。USB设备类型少，不支持主机模式。\n- [libusb_stm32](https://github.com/dmitrystu/libusb_stm32.git) 资源占用极少的USB设备库，不支持主机模式。\n\n## 其它嵌入式开源USB协议栈\n- [lufa](https://github.com/abcminiuser/lufa) 运行于AVR的轻量级USB主机和从机栈。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtoolbox%2FTeenyUSB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtoolbox%2FTeenyUSB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtoolbox%2FTeenyUSB/lists"}