logo资料库

CD00158241(2STM32 USB 学习资料).pdf

第1页 / 共85页
第2页 / 共85页
第3页 / 共85页
第4页 / 共85页
第5页 / 共85页
第6页 / 共85页
第7页 / 共85页
第8页 / 共85页
资料共85页,剩余部分请下载后查看
Table 1. Applicable products
1 Related documents
Table 2. Reference manual name related to each STM32 device
Table 3. User manual name related to each evaluation board
2 STM32 microcontroller family overview
3 STM32 USB-FS-Device firmware library
3.1 USB application hierarchy
Figure 1. USB application hierarchy
Figure 2. USB-FS-Device library package organization
3.2 USB-FS_Device peripheral interface
Table 4. USB-FS_Device peripheral interface modules
3.2.1 usb_reg(.h, .c)
Table 5. Common register functions
3.2.2 usb_int (.h , .c)
3.2.3 usb_mem (.h , .c)
3.3 USB-FS-Device_Driver medium layer
Table 6. USB-FS-Device_Driver medium layer modules
3.3.1 usb_init(.h,.c)
3.3.2 usb_core (.h , .c)
3.3.3 usb_sil(.h, .c)
3.3.4 usb_type.h / usb_def.h
3.3.5 platform_config.h
3.4 Application interface
3.4.1 usb_conf(.h)
3.4.2 usb_desc (.h, .c)
3.4.3 usb_prop (.h , .c)
3.4.4 usb_endp (.c)
3.4.5 usb_istr(.c)
3.4.6 usb_pwr (.h , .c)
Table 8. Power management functions
3.5 Implementing a USB-FS_Device application using the STM32 USB-FS-Device library
3.5.1 Implementing a no-data class-specific request
3.5.2 How to implement a data class-specific request
3.5.3 How to manage data transfers in non-control endpoint
4 Joystick mouse demo
4.1 General description
Figure 3. Format of the four data bytes
4.2 STM32 low-power management in suspend mode
Table 9. Eval board power consumption related jumpers
4.3 Remote wakeup implementation
Table 10. Key push button assignment
5 Custom HID demo
5.1 General description
5.2 Descriptor topology
Figure 4. Custom HID topology
5.3 Custom HID implementation
5.3.1 LED control
Figure 5. Data OUT format
5.3.2 Push-button state report
Figure 6. Data IN Format
5.3.3 ADC-converted data transfer
6 Mass storage demo
6.1 General description
6.2 Mass storage demo overview
Figure 7. New removable disk in Windows
Table 11. Eval board memory support
6.3 Mass storage protocol
6.3.1 Bulk-only transfer (BOT)
Table 12. CBW packet fields
Table 13. CSW packet fields
Table 14. Command block status values
Figure 8. BOT state machine
6.3.2 Small computer system interface (SCSI)
Table 15. SCSI command set
6.4 Mass storage demo implementations
6.4.1 Hardware configuration interface
Figure 9. Hardware and firmware interaction diagram
6.4.2 Endpoint configurations and data management
6.4.3 Class-specific requests
6.4.4 Standard request requirements
6.4.5 BOT state machine
6.4.6 SCSI protocol implementation
6.4.7 Memory management
6.4.8 Medium access management
Figure 10. Medium access layer
Figure 11. NAND write operation
6.5 How to customize the mass storage demo
Table 16. Device descriptor
Table 17. Configuration descriptor
Table 18. Interface descriptors
Table 19. Endpoint descriptors
7 Virtual COM port demo
7.1 General description
7.2 Virtual COM port demo proposal
Figure 12. Virtual COM port demo as USB-to-USART bridge
Figure 13. Communication example
7.3 Software driver installation
Figure 14. Device manager window
7.4 Implementation
7.4.1 Hardware implementation
Table 20. USART connector number for each evaluation board
7.4.2 Firmware implementation
8 VirtualComport_Loopback
8.1 General description
8.2 Demo overview
Figure 15. VirtualComport_Loopback application overview
8.3 Transferring data
8.3.1 Sending data from device to host
8.3.2 Receiving data from host to device
8.4 Running the demo
Figure 16. Window HyperTerminal message display
9 USB voice speaker demo
9.1 General description
9.2 Isochronous transfer overview
Figure 17. Isochronous OUT transfer
9.3 Audio device class overview
9.4 STM32 USB audio speaker demo
Figure 18. STM32 USB-FS_Device audio speaker demo data flow
9.4.1 General characteristics
Figure 19. Audio playback flow
9.4.2 Implementation
Figure 20. Hardware and firmware interaction diagram
Table 21. Device descriptors
Table 22. Configuration descriptors
Table 23. Interface descriptors
Table 24. Endpoint descriptors
10 Device firmware upgrade
10.1 General description
Table 25. Flash memory used by DFU
10.2 DFU extension protocol
10.2.1 Introduction
10.2.2 Phases
10.2.3 Requests
Table 26. Summary of DFU class-specific requests
10.3 DFU mode selection
10.3.1 Run-time descriptor set
10.3.2 DFU mode descriptor set
Table 27. DFU mode device descriptor
Table 28. DFU mode interface descriptor
Table 29. DFU functional descriptor
10.4 Reconfiguration phase
10.5 Transfer phase
10.5.1 Requests
Table 30. Summary of DFU upgrade/upload requests
10.5.2 Special command/protocol descriptions
Table 31. Special command descriptions
10.5.3 DFU state diagram
Figure 21. Interface state transition diagram
10.5.4 Downloading and uploading
10.5.5 Manifestation phase
10.6 STM32 DFU implementation
10.6.1 Supported memories
10.6.2 DFU mode entry mechanism
10.6.3 DFU firmware architecture
Figure 22. DFU firmware architecture
10.6.4 Available DFU image for the STM32
10.6.5 Creating a DFU image
11 Composite example
11.1 General description
Figure 23. USB composite device with two interface functions
11.2 Architecture
Figure 24. HID MSC composite architecture
11.3 USB device descriptor
Figure 25. USB device descriptor
11.4 Running the demo
Figure 26. STM32 device enumerated as composite
12 Revision history
Table 32. Document revision history
UM0424 User manual STM32 USB-FS-Device development kit Introduction The STM32 USB-FS-Device development kit is a complete firmware and software package including examples and demos for all USB transfer types (control, interrupt, bulk and isochronous). The aim of the STM32 USB-FS-Device development kit is to use the STM32 USB-FS- Device library with at least one firmware demo per USB transfer type. This document presents a description of all the components of the STM32 USB-FS-Device development kit, including: ■ STM32 USB-FS-Device library: All processes related to default endpoint and standard requests ■ Device firmware upgrade (DFU) demo: Control transfer ■ Joystick mouse demo: Interrupt transfer ■ Custom HID demo: Interrupt transfer ■ Mass storage demo: Bulk transfer ■ Virtual COM port: Interrupt and bulk transfer ■ CDC LoopBack demo: Interrupt and bulk transfer ■ Composite Example: Interrupt and bulk transfer ■ USB voice speaker demo (USB speaker): Isochronous transfer Table 1. Applicable products Microcontrollers Type Part numbers or product categories STM32F102xx and STM32F103xx series STM32 L1 Ultra Low Power STM32 F3 Series Note: Starting from this release, STM32F105/F107 are no longer supported. These devices are supported by the STM32 USB OTG Host and Device Library. For more details, please refer to user manual UM1021. December 2012 Doc ID 13465 Rev 12 1/85 www.st.com
Contents Contents UM0424 1 2 3 4 2/85 Related documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 STM32 microcontroller family overview . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.3 3.4 STM32 USB-FS-Device firmware library . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 USB application hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 USB-FS_Device peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2 usb_reg(.h, .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.1 3.2.2 usb_int (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.3 usb_mem (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 USB-FS-Device_Driver medium layer . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.1 usb_init(.h,.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 usb_core (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.2 usb_sil(.h, .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3.3 3.3.4 usb_type.h / usb_def.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3.5 platform_config.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.4.1 usb_conf(.h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 usb_desc (.h, .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.4.2 3.4.3 usb_prop (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 usb_endp (.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.4.4 usb_istr(.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.4.5 3.4.6 usb_pwr (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Implementing a USB-FS_Device application using the STM32 USB-FS- Device library 25 3.5.1 3.5.2 3.5.3 Implementing a no-data class-specific request . . . . . . . . . . . . . . . . . . . 25 How to implement a data class-specific request . . . . . . . . . . . . . . . . . . 25 How to manage data transfers in non-control endpoint . . . . . . . . . . . . . 26 3.5 Joystick mouse demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.1 4.2 STM32 low-power management in suspend mode . . . . . . . . . . . . . . . . . 27 Remote wakeup implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.3 Doc ID 13465 Rev 12
UM0424 Contents 5 6 7 8 Custom HID demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.1 5.2 Descriptor topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Custom HID implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.3 5.3.1 LED control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Push-button state report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.3.2 5.3.3 ADC-converted data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6.4 Mass storage demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.1 6.2 Mass storage demo overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Mass storage protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.3 Bulk-only transfer (BOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.3.1 6.3.2 Small computer system interface (SCSI) . . . . . . . . . . . . . . . . . . . . . . . . 38 Mass storage demo implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Hardware configuration interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.4.1 6.4.2 Endpoint configurations and data management . . . . . . . . . . . . . . . . . . 40 Class-specific requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6.4.3 Standard request requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.4.4 6.4.5 BOT state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 SCSI protocol implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.4.6 6.4.7 Memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 6.4.8 Medium access management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 How to customize the mass storage demo . . . . . . . . . . . . . . . . . . . . . . . 46 6.5 Virtual COM port demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 7.1 7.2 Virtual COM port demo proposal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Software driver installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.4 7.4.1 Hardware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Firmware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.4.2 VirtualComport_Loopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.1 8.2 Demo overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Doc ID 13465 Rev 12 3/85
Contents UM0424 9 10 8.3 8.4 Transferring data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.3.1 Sending data from device to host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.3.2 Receiving data from host to device . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Running the demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 USB voice speaker demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1 9.2 Isochronous transfer overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Audio device class overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 9.3 STM32 USB audio speaker demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.4 9.4.1 General characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 9.4.2 10.2.1 10.2.2 10.2.3 10.3.1 10.3.2 Device firmware upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 10.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 10.2 DFU extension protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 10.3 DFU mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Run-time descriptor set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 DFU mode descriptor set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 10.4 Reconfiguration phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Transfer phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 10.5 10.5.1 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Special command/protocol descriptions . . . . . . . . . . . . . . . . . . . . . . . . 75 10.5.2 DFU state diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 10.5.3 10.5.4 Downloading and uploading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 10.5.5 Manifestation phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 10.6 STM32 DFU implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Supported memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 DFU mode entry mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 DFU firmware architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Available DFU image for the STM32 . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Creating a DFU image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 10.6.1 10.6.2 10.6.3 10.6.4 10.6.5 4/85 Doc ID 13465 Rev 12
UM0424 11 Contents Composite example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 11.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 11.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11.3 USB device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11.4 Running the demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 12 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Doc ID 13465 Rev 12 5/85
List of tables List of tables UM0424 Table 1. Table 2. Table 3. Table 4. Table 5. Table 6. Table 8. Table 9. Table 10. Table 11. Table 12. Table 13. Table 14. Table 15. Table 16. Table 17. Table 18. Table 19. Table 20. Table 21. Table 22. Table 23. Table 24. Table 25. Table 26. Table 27. Table 28. Table 29. Table 30. Table 31. Table 32. Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Reference manual name related to each STM32 device . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 User manual name related to each evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 USB-FS_Device peripheral interface modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Common register functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 USB-FS-Device_Driver medium layer modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Power management functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Eval board power consumption related jumpers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Key push button assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Eval board memory support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 CBW packet fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 CSW packet fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Command block status values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 SCSI command set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Configuration descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Interface descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Endpoint descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 USART connector number for each evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Device descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Configuration descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Interface descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Endpoint descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Flash memory used by DFU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Summary of DFU class-specific requests. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 DFU mode device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 DFU mode interface descriptor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 DFU functional descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Summary of DFU upgrade/upload requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Special command descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 6/85 Doc ID 13465 Rev 12
UM0424 List of figures List of figures USB application hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Figure 1. USB-FS-Device library package organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Figure 2. Format of the four data bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Figure 3. Custom HID topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Figure 4. Data OUT format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Figure 5. Data IN Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Figure 6. New removable disk in Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Figure 7. BOT state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Figure 8. Figure 9. Hardware and firmware interaction diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Figure 10. Medium access layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Figure 11. NAND write operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Figure 12. Virtual COM port demo as USB-to-USART bridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Figure 13. Communication example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Figure 14. Device manager window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Figure 15. VirtualComport_Loopback application overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Figure 16. Window HyperTerminal message display. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Figure 17. Isochronous OUT transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Figure 18. STM32 USB-FS_Device audio speaker demo data flow . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Figure 19. Audio playback flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Figure 20. Hardware and firmware interaction diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Figure 21. Interface state transition diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Figure 22. DFU firmware architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Figure 23. USB composite device with two interface functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Figure 24. HID MSC composite architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Figure 25. USB device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Figure 26. STM32 device enumerated as composite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Doc ID 13465 Rev 12 7/85
Related documents UM0424 1 Related documents For more information on using the microcontroller devices listed in Table 1: Applicable products, please refer to the reference manuals below: Table 2. Reference manual name related to each STM32 device Device name Reference manual STM32L151xx and STM32L152xx STM32F102xx and STM32F103xx STM32F302xx and STM32F303xx STM32F372xx and STM32F373xx RM0038 RM0008 RM0316 RM0313 The STM32 USB-FS-Device library is designed for use with the following evaluation boards: Table 3. User manual name related to each evaluation board Eval board name User manual Device name STM3210E-EVAL STM3210B-EVAL STM32L152-EVAL STM32L152D-EVAL STM32373C-EVAL STM32303C-EVAL UM0488 UM0426 UM1018 UM1521 UM1564 UM1567 STM32F103ZGT6 STM32F103VBT6 STM32L152VBT6 STM32L152ZDT6 STM32F373VCT6 STM32F303VCT6 8/85 Doc ID 13465 Rev 12
分享到:
收藏