UM0424 - STM32F10xxx USB-FS-Device development kit.pdf
(
716 KB
)
Pobierz
STM32F10xxx USB-FS-Device development kit
UM0424
User manual
STM32F10xxx
USB-FS-Device development kit
Introduction
The STM32F10xxx USB-FS-Device development kit is a complete firmware and software
package including examples and demos for all USB-FS-Device transfer types (control,
interrupt, bulk and isochronous). It supports all STM32F10xxx
microcontroller
families.
The aim of the STM32F10xxx USB-FS-Device development kit is to use the STM32F10xxx
USB-FS-Device library with at least one firmware demo per USB-FS-Device transfer type.
This document presents a description of all the components of the STM32F10xxx USB-FS-
Device development kit, including:
■
STM32F10xxx USB-FS-Device library: All processes related to default endpoint and
standard requests
■
Device Firmware Upgrade Demo: Control transfer
■
Joystick mouse demo: Interrupt transfer
■
Mass storage demo: Bulk transfer
■
Virtual COM port: Bulk transfer
■
USB-FS-Device voice demo (USB speaker): Isochronous transfer
May 2009
Doc ID 13465 Rev 7
1/69
www.st.com
Contents
UM0424
Contents
1
STM32F10xxx USB-FS-Device firmware library . . . . . . . . . . . . . . . . . . . 7
1.1
USB-FS-Device application hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2
USB-FS-Device library core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.1
usb_type.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.2
usb_reg(.c, .h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.3
usb_int (.c , .h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2.4
usb_core (.c , .h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3
Application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3.1
usb_istr(.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3.2
usb_conf(.h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.3
usb_endp (.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.4
usb_prop (.c , .h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.5
usb_pwr (.c , .h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.3.6
usb_desc (.c, .h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4
Implementing a USB-FS-Device application using the
STM32F10xxx USB-FS-Device library . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4.1
Implementing a no-data class-specific request . . . . . . . . . . . . . . . . . . . 19
1.4.2
How to implement a data class-specific request . . . . . . . . . . . . . . . . . . 20
1.4.3
How to manage data transfers in non-control endpoint . . . . . . . . . . . . . 20
2
Joystick mouse demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.1
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2
STM32F10xxx low-power management in suspend mode . . . . . . . . . . . 21
2.3
Remote Wakeup implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3
Custom HID demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2
Descriptor topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3
Custom HID implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3.1
LED control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3.2
Push-button state report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3.3
ADC-converted data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4
Device firmware upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2/69
Doc ID 13465 Rev 7
UM0424
Contents
4.1
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2
DFU extension protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.2
Phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.3
Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3
DFU mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3.1
Run-time descriptor set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3.2
DFU mode descriptor set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.4
Reconfiguration phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5
Transfer phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5.1
Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5.2
Special command/protocol descriptions . . . . . . . . . . . . . . . . . . . . . . . . 34
4.5.3
DFU state diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.5.4
Downloading and uploading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5.5
Manifestation phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.6
STM32F10xxx DFU implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.6.1
Supported memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.6.2
DFU mode entry mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.6.3
DFU firmware architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.6.4
Available DFU image for the STM32F10xxx . . . . . . . . . . . . . . . . . . . . . 38
4.6.5
How to create a DFU Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5
Mass storage demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.1
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2
Mass storage demo overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.3
Mass storage protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3.1
Bulk-only transfer (BOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3.2
Small computer system interface (SCSI) . . . . . . . . . . . . . . . . . . . . . . . . 43
5.4
Mass storage demo implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.4.1
Hardware configuration interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.4.2
Endpoint configurations and data management . . . . . . . . . . . . . . . . . . 45
5.4.3
Class-specific requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.4.4
Standard request requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4.5
BOT state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4.6
SCSI protocol implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.4.7
Memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Doc ID 13465 Rev 7
3/69
Contents
UM0424
5.4.8
Medium access management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.5
How to customize the mass storage demo . . . . . . . . . . . . . . . . . . . . . . . 50
6
Virtual COM port demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.1
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.2
Virtual COM port demo proposal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.3
Software driver installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.4
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.4.1
Hardware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.4.2
Firmware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7
USB-FS-Device voice demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.1
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.2
Isochronous transfer overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.3
Audio device class overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.4
STM32F10xxx USB-FS-Device audio speaker demo . . . . . . . . . . . . . . . 60
7.4.1
General characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.4.2
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4/69
Doc ID 13465 Rev 7
UM0424
List of tables
List of tables
Table 1. USB-FS-Device library core modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 2. Common register functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 4. Power management functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 5. Summary of DFU class-specific requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 6. DFU mode device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 7. DFU mode interface descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Table 8. DFU functional descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Table 9. Summary of DFU upgrade/upload requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Table 10. Special command descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Table 11. CBW packet fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Table 12. CSW packet fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 13. Command block status values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 14. SCSI command set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Table 15. Device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Table 16. Configuration descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Table 17. Interface descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Table 18. Endpoint descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Table 19. Device descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Table 20. Configuration descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Table 21. Interface descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Table 22. Endpoint descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Table 23. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Doc ID 13465 Rev 7
5/69
Plik z chomika:
kaczor1000
Inne pliki z tego folderu:
um0685.zip
(1691 KB)
UM0585 - STM32F10xxx DSP library.pdf
(187 KB)
um0585.zip
(1391 KB)
UM0549 - STM3210E-EVAL demonstration software.pdf
(1163 KB)
UM0721 - STM32F105xx and STM32F107xx USB on-the-go (OTG) FS library.pdf
(909 KB)
Inne foldery tego chomika:
[KURS] EdW - Mikrokontrolery z rdzeniem ARM
Dokumenty
LIB
Noty Aplikacyjne
Noty Katalogowe
Zgłoś jeśli
naruszono regulamin