1 
3 ### Lightweight USB Device Stack ###
6 + Event-driven process workflow
7 + Completely separated USB hardware driver and usb core
12 + [CMSIS V4](https://github.com/ARM-software/CMSIS) or [CMSIS V5](https://github.com/ARM-software/CMSIS_5).
13 + [stm32.h](https://github.com/dmitrystu/stm32h) STM32 universal header
15 All requirements can be downloaded into a directory specified in environment variable `CMSIS` using
18 ### Supported hardware ###
21 <tr><th>MCU Series</th><th>Features</th><th>Driver</th><th>File</th></tr>
23 <td rowspan="2">STM32L0x2 STM32L0x3 STM32F070 STM32F0x2 STM32F0x8</td>
24 <td nowrap rowspan="2">Doublebuffered<sup>[2]</sup><br />8<sup>[1]</sup> endpoints<br /> BC1.2</td>
26 <td>usbd_stm32l052_devfs.c</td>
29 <td>usbd_devfs_asm</td>
30 <td>usbd_stm32l052_devfs_asm.S</td>
33 <td rowspan="2">STM32L4x2 STM32L4x3 STM32G4 series</td>
34 <td nowrap rowspan="2">Doublebuffered<sup>[2]</sup><br />8<sup>[1]</sup> endpoints<br /> BC1.2</td>
36 <td>usbd_stm32l433_devfs.c</td>
39 <td>usbd_devfs_asm</td>
40 <td>usbd_stm32l052_devfs_asm.S</td>
43 <td rowspan="2">STM32L1xx</td>
44 <td nowrap rowspan="2">Doublebuffered<sup>[2]</sup><br />8<sup>[1]</sup> endpoints</td>
46 <td>usbd_stm32l100_devfs.c</td>
49 <td>usbd_devfs_asm</td>
50 <td>usbd_stm32l100_devfs_asm.S</td>
53 <td rowspan="2">STM32F102 STM32F103 STM32F302 STM32F303 STM32F373</td>
54 <td nowrap rowspan="2">Doublebuffered<sup>[2]</sup><br />External DP pullup<br />8<sup>[1]</sup> endpoints</td>
56 <td>usbd_stm32f103_devfs.c</td>
59 <td>usbd_devfs_asm</td>
60 <td>usbd_stm32f103_devfs_asm.S</td>
63 <td>STM32L4x5 STM32L4x6</td>
64 <td nowrap>Doublebuffered<br />6 endpoints<br /> BC1.2<br />VBUS detection</td>
66 <td>usbd_stm32l476_otgfs.c</td>
69 <td rowspan="2">STM32F4x5 STM32F4x7 STM32F4x9</td>
70 <td nowrap>Doublebuffered<br/>4 endpoints<br/>VBUS detection<br/>SOF output</td>
72 <td>usbd_stm32f429_otgfs.c</td>
75 <td nowrap>Doublebuffered<br/>6 endpoints<br/>VBUS detection<br/>SOF output</td>
77 <td>usbd_stm32f429_otghs.c</td>
80 <td>STM32F105 STM32F107</td>
81 <td nowrap>Doublebuffered<br/>4 endpoints<br/>VBUS detection<br/>SOF output</td>
83 <td>usbd_stm32f105_otgfs.c</td>
87 1. Single physical endpoint can be used to implement
88 + one bi-directional/single-buffer logical endpoint (CONTROL)
89 + one uni-directional/double-buffer logical endpoint (BULK OR ISOCHRONOUS)
90 + two uni-directional/single-buffer logical endpoints (BULK OR INTERRUPT)
92 2. At this moment BULK IN endpoint can use both buffers, but it is not **real** doublebuffered.
94 3. Tested with STM32L052K8, STM32L100RC, STM32L476RG, STM32F072C8, STM32F103C8, STM32F103CB, STM32F303CC, STM32F303RE, STM32F429ZI, STM32F105RBT6, STM32F107VCT6, STM32L433CCT6, STM32F070CBT6, STM32G431RB,
97 ### Implemented definitions for classes ###
98 1. USB HID based on [Device Class Definition for Human Interface Devices (HID) Version 1.11](https://www.usb.org/sites/default/files/documents/hid1_11.pdf)
99 2. USB DFU based on [USB Device Firmware Upgrade Specification, Revision 1.1](https://www.usb.org/sites/default/files/DFU_1.1.pdf)
100 3. USB CDC based on [Class definitions for Communication Devices 1.2](https://www.usb.org/sites/default/files/CDC1.2_WMC1.1_012011.zip)
101 4. USB TMC based on [USB Device Test and Measurement Class Specification, Revision 1.0](https://www.usb.org/sites/default/files/USBTMC_1_006a.zip)
103 ### Using makefile ###
104 + to build library module
106 make module MODULE=path/module.a DEFINES="mcu spcified defines" CFLAGS="cpu cpecified compiler flags"
110 make bluepill program
118 ### Default values: ###
119 | Variable | Default Value | Means |
120 |----------|-------------------------------------|-------------------------------|
121 | CMSIS | ./CMSIS | path to CMSIS root folder |
122 | CMSISDEV | $(CMSIS)/Device | path to CMSIS device folder |
123 | CMSISCORE| $(CMSIS)/CMSIS/Include $(CMSIS)/CMSIS/Core/Include | path to CMSIS core headers |
124 | MCU | stm32l100xc | MCU selection for demo project|
125 | CFLAGS | -mcpu=cortex-m3 -mfloat-abi=soft | MCU specified compiler flags |
126 | DEFINES | STM32L1 STM32L100xC | MCU specified defines |
127 | STPROG_CLI | ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI | Path to the ST Cube Programmer CLI |
128 | OPTFLAGS | -Os | Code optimization flags |
130 ### Useful Resources ###
131 1. [USB Implementers Forum official site](https://www.usb.org/)
132 2. [USB Made Simple](http://www.usbmadesimple.co.uk/)
133 3. [LUFA - the Lightweight USB Framework for AVRs.](https://github.com/abcminiuser/lufa)
134 4. [Open Source ARM cortex m microcontroller library](https://github.com/libopencm3/libopencm3)