《嵌入式应用开发》课程教学资源(文献资料)UM0424 User manual STM32 USB-FS-Device development kit

UM0424STUser manualSTM32USB-FS-DevicedevelopmentkitIntroductionTheSTM32USB-FS-Devicedevelopment kit isa completefirmwareand software packageincludingexamplesanddemosforall UsBtransfertypes(control,interrupt,bulkandisochronous).The aim of the STM32 USB-FS-Device development kit is to use the STM32 USB-FS-Device librarywithat leastonefirmwaredemoperUSB transfertype.Thisdocumentpresentsadescriptionof all thecomponentsof theSTM32USB-FS-Devicedevelopmentkit, including:STM32USB-FS-Devicelibrary:AllprocessesrelatedtodefaultendpointandstandardrequestsDevice firmware upgrade (DFU) demo: Control transferJoystickmousedemo:InterrupttransferCustomHID demo:Interrupt transferMassstoragedemo:Bulktransfer VirtualCOMport:InterruptandbulktransferCDC LoopBackdemo:Interrupt andbulk transferCompositeExample:InterruptandbulktransferUSBvoicespeakerdemo(USBspeaker):IsochronoustransferTable 1.ApplicableproductsTypePartnumbers orproduct categoriesSTM32F102xxandSTM32F103xxseriesMicrocontrollersSTM32 L1 Ultra Low PowerSTM32 F3 SeriesNote:Startingfrom thisrelease,STM32F105/F107arenolongersupported.Thesedevicesaresupportedby theSTM32USBOTGHostandDeviceLibrary.Formoredetails,pleaserefertousermanualUM1021.1/85December2012DocID13465Rev12www.st.com
December 2012 Doc ID 13465 Rev 12 1/85 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-FSDevice 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 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. Table 1. Applicable products Type Part numbers or product categories Microcontrollers STM32F102xx and STM32F103xx series STM32 L1 Ultra Low Power STM32 F3 Series www.st.com

ContentsUM0424Contents18Relateddocuments29STM32microcontrollerfamilyoverview3.10STM32USB-FS-Devicefirmwarelibrary3.110USBapplication hierarchy3.212USB-FS_Deviceperipheral interface.123.2.1usb_reg(.h, .c)3.2.2..17usb_int (.h, .c)3.2.3usb_mem (.h,.c).173.3USB-FS-Device_Driver medium layer173.3.1.17usb init(.h,.c)3.3.2usb_core(.h,.c).173.3.3usb_sil(.h, .c)213.3.4.21usb_type.h/usb_def.h3.3.5.21platform_config.h3.421Applicationinterface3.4.1usb_conf(.h)223.4.2usb_desc (.h,.c).223.4.3.23usb_prop(.h,.c)3.4.4.24usb_endp (.c)3.4.525usb_istr(.c)3.4.625usb_pwr (.h,.c)3.5Implementinga USB-FS_Deviceapplicationusing theSTM32USB-FS-Device library253.5.1...25Implementing a no-data class-specific request3.5.2.25Howto implement adataclass-specificrequest3.5.3.26Howtomanagedatatransfers innon-controlendpoint4. 27Joystickmousedemo4.1.* 27Generaldescription4.227STM32 low-powermanagement in suspendmode4.3Remotewakeup implementation:282/85DocID13465Rev12
Contents UM0424 2/85 Doc ID 13465 Rev 12 Contents 1 Related documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 STM32 microcontroller family overview . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 STM32 USB-FS-Device firmware library . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 USB application hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2 USB-FS_Device peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.1 usb_reg(.h, .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.2 usb_int (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.3 usb_mem (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3 USB-FS-Device_Driver medium layer . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.1 usb_init(.h,.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.2 usb_core (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.3 usb_sil(.h, .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3.4 usb_type.h / usb_def.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3.5 platform_config.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.4 Application interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.4.1 usb_conf(.h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.4.2 usb_desc (.h, .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.4.3 usb_prop (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.4.4 usb_endp (.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.4.5 usb_istr(.c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.4.6 usb_pwr (.h , .c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.5 Implementing a USB-FS_Device application using the STM32 USB-FSDevice library 25 3.5.1 Implementing a no-data class-specific request . . . . . . . . . . . . . . . . . . . 25 3.5.2 How to implement a data class-specific request . . . . . . . . . . . . . . . . . . 25 3.5.3 How to manage data transfers in non-control endpoint . . . . . . . . . . . . . 26 4 Joystick mouse demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.2 STM32 low-power management in suspend mode . . . . . . . . . . . . . . . . . 27 4.3 Remote wakeup implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

UM0424Contents530CustomHID demo305.1General description5.230Descriptortopology5.331CustomHIDimplementation5.3.12..31LED control5.3.2.32Push-button state report5.3.3.32ADC-converteddatatransfer6:33Massstoragedemo6.133General description6.2..33Mass storage demo overview346.3Mass storage protocol6.3.1.34Bulk-onlytransfer (BOT)6.3.2.38Smallcomputersysteminterface(ScsI)6.4Mass storage demo implementations396.4.1.39Hardwareconfiguration interface6.4.2.40Endpoint configurations and data management.416.4.3Class-specificrequests6.4.4..42Standardrequest requirements6.4.5BOTstatemachine.426.4.6SCSIprotocol implementation436.4.7Memory management.446.4.844Mediumaccessmanagement6.5Howto customize themass storagedemo467Virtual coMport demo497.149Generaldescription7.249Virtual COMportdemoproposal7.350Softwaredriverinstallation7.451Implementation..517.4.1Hardware implementation.517.4.2Firmware implementation8.53VirtualComport_Loopback8.153Generaldescription8.253Demooverview3/85DocID13465Rev12
UM0424 Contents Doc ID 13465 Rev 12 3/85 5 Custom HID demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.2 Descriptor topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.3 Custom HID implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.3.1 LED control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.3.2 Push-button state report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.3.3 ADC-converted data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 6 Mass storage demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.2 Mass storage demo overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6.3 Mass storage protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.3.1 Bulk-only transfer (BOT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 6.3.2 Small computer system interface (SCSI) . . . . . . . . . . . . . . . . . . . . . . . . 38 6.4 Mass storage demo implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.4.1 Hardware configuration interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 6.4.2 Endpoint configurations and data management . . . . . . . . . . . . . . . . . . 40 6.4.3 Class-specific requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6.4.4 Standard request requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.4.5 BOT state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.4.6 SCSI protocol implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.4.7 Memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 6.4.8 Medium access management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 6.5 How to customize the mass storage demo . . . . . . . . . . . . . . . . . . . . . . . 46 7 Virtual COM port demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 7.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 7.2 Virtual COM port demo proposal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 7.3 Software driver installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.4.1 Hardware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.4.2 Firmware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 8 VirtualComport_Loopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.2 Demo overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

ContentsUM04248.354Transferring data8.3.1.54Sendingdatafromdevicetohost8.3.2...54Receivingdata fromhost to device8.454Running the demo955USBvoicespeakerdemo9.1General description559.2.55Isochronoustransferoverview9.356Audiodevice class overview9.4...57STM32USBaudiospeakerdemo9.4.1General characteristics.589.4.2Implementation.591067Device firmware upgrade10.167General description10.268DFU extension protocol10.2.1.68Introduction10.2.2.68Phases10.2.3.69Requests10.369DFUmodeselection.6910.3.1Run-time descriptor set10.3.2DFUmode descriptor set.707410.4Reconfigurationphase10.574Transferphase10.5.1.74Requests10.5.2..75Specialcommand/protocoldescriptions10.5.3DFUstatediagram.7610.5.4Downloadingand uploading.7710.5.5Manifestationphase.777810.6STM32DFUimplementation10.6.1.78Supportedmemories10.6.2.78DFUmodeentrymechanism10.6.3.78DFUfirmwarearchitecture10.6.4AvailableDFU imageforthe STM32.79.7910.6.5CreatingaDFU image4/85DocID13465Rev12
Contents UM0424 4/85 Doc ID 13465 Rev 12 8.3 Transferring data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.3.1 Sending data from device to host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.3.2 Receiving data from host to device . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 8.4 Running the demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 9 USB voice speaker demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.2 Isochronous transfer overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 9.3 Audio device class overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 9.4 STM32 USB audio speaker demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 9.4.1 General characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 9.4.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 10 Device firmware upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 10.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 10.2 DFU extension protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 10.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 10.2.2 Phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 10.2.3 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 10.3 DFU mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 10.3.1 Run-time descriptor set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 10.3.2 DFU mode descriptor set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 10.4 Reconfiguration phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 10.5 Transfer phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 10.5.1 Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 10.5.2 Special command/protocol descriptions . . . . . . . . . . . . . . . . . . . . . . . . 75 10.5.3 DFU state diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 10.5.4 Downloading and uploading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 10.5.5 Manifestation phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 10.6 STM32 DFU implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 10.6.1 Supported memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 10.6.2 DFU mode entry mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 10.6.3 DFU firmware architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 10.6.4 Available DFU image for the STM32 . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 10.6.5 Creating a DFU image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

UM0424Contents11.80Compositeexample11.1.. 80General description..8111.2Architecture11.381USBdevicedescriptor11.4..82Running the demo12...83RevisionhistoryDocID13465Rev125/85
UM0424 Contents Doc ID 13465 Rev 12 5/85 11 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

ListoftablesUM0424List of tablesATable 1.Applicableproducts..8Table 2.Referencemanual namerelatedtoeachSTM32device.8Table 3.Usermanualnamerelatedto eachevaluationboard12Table 4.USB-FS_Deviceperipheralinterfacemodules.-.12Table 5.Commonregisterfunctions...17Table 6.USB-FS-Device_Drivermediumlayermodules.25Table 8.Powermanagementfunctions.28Table 9.Evalboardpowerconsumptionrelated jumpers..28Table 10.Keypushbuttonassignment34Table 11.Evalboardmemorysupport.35Table 12.CBWpacketfields.36Table 13.CSWpacketfieldsTable 14..36Commandblockstatusvalues.38Table 15.ScsIcommandset..46Table 16.Devicedescriptor..47Table 17.Configuration descriptorTable 18.Interface descriptors.47..48Table 19.Endpointdescriptors.51Table 20.USARTconnectornumberforeachevaluationboard62Table 21.Devicedescriptors.62Table 22.Configurationdescriptors.62Table 23.Interfacedescriptors.65Table 24.Endpointdescriptors..Table 25.FlashmemoryusedbyDFU..67.69Table 26.SummaryofDFUclass-specificrequests.70Table 27.DFUmodedevicedescriptor71Table 28.DFUmode interfacedescriptor...73Table 29.DFUfunctionaldescriptor...74Table 30.SummaryofDFUupgrade/uploadrequests75Table 31.Specialcommanddescriptions..83Table 32.Document revision historyS6/85DocID13465Rev12
List of tables UM0424 6/85 Doc ID 13465 Rev 12 List of tables Table 1. Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Table 2. Reference manual name related to each STM32 device . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Table 3. User manual name related to each evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Table 4. USB-FS_Device peripheral interface modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Table 5. Common register functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Table 6. USB-FS-Device_Driver medium layer modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Table 8. Power management functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Table 9. Eval board power consumption related jumpers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Table 10. Key push button assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Table 11. Eval board memory support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Table 12. CBW packet fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Table 13. CSW packet fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Table 14. Command block status values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Table 15. SCSI command set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Table 16. Device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Table 17. Configuration descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Table 18. Interface descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Table 19. Endpoint descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Table 20. USART connector number for each evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Table 21. Device descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Table 22. Configuration descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Table 23. Interface descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Table 24. Endpoint descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Table 25. Flash memory used by DFU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Table 26. Summary of DFU class-specific requests. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Table 27. DFU mode device descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Table 28. DFU mode interface descriptor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Table 29. DFU functional descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Table 30. Summary of DFU upgrade/upload requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Table 31. Special command descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Table 32. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

UM0424List offiguresList of figuresFigure 1.USBapplication hierarchy.10Figure 2.USB-FS-Devicelibrarypackageorganization..1127Figure 3.Format of the four data bytes31Figure4.Custom HID topology.32Figure 5.DataOUTformat....32Figure6.Data IN Format.....33Figure 7.NewremovablediskinWindows37Figure 8.BOTstatemachine...39Figure 9.Hardwareandfirmwareinteractiondiagram.45Figure 10.MediumaccesslayerFigure 11...45NANDwriteoperation.. 49Figure 12.Virtual COM port demo as USB-to-USARTbridgeFigure 13.50Communicationexample50Figure 14.Devicemanagerwindow...53Figure 15.VirtualComport_Loopbackapplicationoverview..54Figure16Window HyperTerminal message display...56Figure17.IsochronousOuTtransferFigure 18.STM32USB-FS_Deviceaudiospeakerdemodataflow.57.58Figure 19.Audioplaybackflow.60Figure 20.Hardware and firmware interaction diagram...76Figure 21.Interfacestatetransitiondiagram.......79Figure 22.DFUfirmwarearchitecture.80Figure 23.USBcompositedevice with two interfacefunctions.81Figure 24.HIDMSCcompositearchitectureFigure 25..81USBdevicedescriptor.82Figure 26.STM32deviceenumeratedascompositeSDocID13465Rev127/85
UM0424 List of figures Doc ID 13465 Rev 12 7/85 List of figures Figure 1. USB application hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Figure 2. USB-FS-Device library package organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Figure 3. Format of the four data bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Figure 4. Custom HID topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Figure 5. Data OUT format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Figure 6. Data IN Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Figure 7. New removable disk in Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Figure 8. BOT state machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 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

RelateddocumentsUM04241RelateddocumentsFormoreinformationonusingthemicrocontrollerdevices listed inTable1:Applicableproducts,pleaserefertothereferencemanuals below:Table 2.ReferencemanualnamerelatedtoeachSTM32deviceDevice nameReference manualRM0038STM32L151xxandSTM32L152xxRM0008STM32F102xxandSTM32F103xxRM0316STM32F302xxandSTM32F303xxRM0313STM32F372xxandSTM32F373xxTheSTM32USB-FS-Device libraryisdesignedforusewiththefollowingevaluationboards:Table 3.Usermanual namerelatedtoeachevaluationboardEval board nameUsermanualDevice nameSTM3210E-EVALUM0488STM32F103ZGT6UM0426STM32F103VBT6STM3210B-EVALUM1018STM32L152-EVALSTM32L152VBT6UM1521STM32L152D-EVALSTM32L152ZDT6UM1564STM32373C-EVALSTM32F373VCT6STM32303C-EVALUM1567STM32F303VCT6S8/85Doc ID13465Rev12
Related documents UM0424 8/85 Doc ID 13465 Rev 12 1 Related documents For more information on using the microcontroller devices listed in Table 1: Applicable products, please refer to the reference manuals below: The STM32 USB-FS-Device library is designed for use with the following evaluation boards: Table 2. Reference manual name related to each STM32 device Device name Reference manual STM32L151xx and STM32L152xx RM0038 STM32F102xx and STM32F103xx RM0008 STM32F302xx and STM32F303xx RM0316 STM32F372xx and STM32F373xx RM0313 Table 3. User manual name related to each evaluation board Eval board name User manual Device name STM3210E-EVAL UM0488 STM32F103ZGT6 STM3210B-EVAL UM0426 STM32F103VBT6 STM32L152-EVAL UM1018 STM32L152VBT6 STM32L152D-EVAL UM1521 STM32L152ZDT6 STM32373C-EVAL UM1564 STM32F373VCT6 STM32303C-EVAL UM1567 STM32F303VCT6

UM0424STM32microcontrollerfamilyoverview2STM32microcontrollerfamilyoverviewInthisdocument,STM32referstothefollowingdevices:Low-densitydevices:STM32F101xx,STM32F102xxandSTM32F103xx3microcontrollerswheretheFlashmemorydensityrangesbetween16and32Kbytes.Medium-densitydevices:STM32F101xx,STM32F102xxandSTM32F103xxmicrocontrollers where the Flash memory density ranges between 64 and 128 Kbytes.High-densitydevices:STM32F101xxandSTM32F103xxmicrocontrollerswheretheFlashmemorydensityrangesbetween256and512Kbytes.XL-density devices:STM32F101xxand STM32F103xx microcontrollers where theFlashmemorydensityrangesbetween512and1024Kbytes..Medium-densityLow-Powerdevices:STM32L15xxmicrocontrollerswheretheFlashmemorydensityrangesbetween64and128Kbytes.Low Power Medium-density Plus devices:STM32L15xxand STM32L162xxmicrocontrollerswheretheFlashmemorydensityis256Kbytes.LowPowerHigh-densitydevices:STM32L15xxandSTM32L162xxmicrocontrollers9wheretheFlashmemorydensityis384Kbytes..STM32F3 Series:STM32F30xxmicrocontrollerswheretheFlashmemorydensityrangesbetween128and256Kbytes.STM32F37xxmicrocontrollerswheretheFlashmemorydensityrangesbetween64and256Kbytes.S9/85DocID13465Rev12
UM0424 STM32 microcontroller family overview Doc ID 13465 Rev 12 9/85 2 STM32 microcontroller family overview In this document, STM32 refers to the following devices: ● Low-density devices: STM32F101xx, STM32F102xx and STM32F103xx microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes. Medium-density devices: STM32F101xx, STM32F102xx and STM32F103xx microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes. ● High-density devices: STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 256 and 512 Kbytes. ● XL-density devices: STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 512 and 1024 Kbytes. ● Medium-density Low-Power devices: STM32L15xx microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes. ● Low Power Medium-density Plus devices:STM32L15xx and STM32L162xx microcontrollers where the Flash memory density is 256 Kbytes. ● Low Power High-density devices: STM32L15xx and STM32L162xx microcontrollers where the Flash memory density is 384 Kbytes. ● STM32F3 Series: – STM32F30xx microcontrollers where the Flash memory density ranges between 128 and 256 Kbytes. – STM32F37xx microcontrollers where the Flash memory density ranges between 64 and 256 Kbytes

STM32USB-FS-Devicefirmware libraryUM04243STM32USB-FS-DevicefirmwarelibraryThissectiondescribesthefirmwareinterface(calledUSB-FS-DeviceLibrary)usedtomanagetheSTM32USB2.0full-speed deviceperipheral.Intherest of thedocument, itwillbereferredtoasUSB-FS_Deviceperipheral.ThemainpurposeofthisfirmwarelibraryistoprovideresourcestoeasethedevelopmentofapplicationsforeachUSBtransfertypeusingtheUSB-FS_DeviceperipheralintheSTM32microcontrollerfamilies.3.1USBapplicationhierarchyFigure1showstheinteractionbetweenthedifferentcomponentsofatypicalUsBapplication and the USB-FS-Device library.Figure 1.USBapplicationhierarchyUserApplicationSTM32_USB-FS-Device_Lib727usb_confusb_descusb_pwrSTM32xxxx_StdPeriph_Driver0YoiH&usb_istrusb_propusb_endpCMSISusb_silnienJEusb_corelusb_init(uenkapaiioou)USB-FS peripheral interfaceJeemousb_intusb_regsusb_memUSB-FSDeviceperipheralHardware (STM32 +Board)MSv31504V1SA10/85DocID13465Rev12
STM32 USB-FS-Device firmware library UM0424 10/85 Doc ID 13465 Rev 12 3 STM32 USB-FS-Device firmware library This section describes the firmware interface (called USB-FS-Device Library) used to manage the STM32 USB 2.0 full-speed device peripheral. In the rest of the document, it will be referred to as USB-FS_Device peripheral . The main purpose of this firmware library is to provide resources to ease the development of applications for each USB transfer type using the USB-FS_Device peripheral in the STM32 microcontroller families. 3.1 USB application hierarchy Figure 1 shows the interaction between the different components of a typical USB application and the USB-FS-Device library. Figure 1. USB application hierarchy MSv31504V1 User Application STM32_USB-FS-Device_Lib STM32xxxx_Std Periph_Driver & CMSIS usb_pwr usb_conf usb_desc usb_istr usb_prop usb_endp usb_core/usb_init usb_sil USB-FS peripheral interface usb_int usb_regs usb_mem Hardware (STM32 + Board) USB-FS_Device peripheral High Layer Application Interface (can be modified by user) Medium Layer STM32_USB-FSDevice_Driver Low Layer (not modified by user) High y ) Medium
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《嵌入式应用开发》课程教学资源(文献资料)STM32 USB Mass Storage学习资料.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)STM32的USB详解.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)STM32F2技术培训——灵活的静态存储控制器(FSMC).pdf
- 《嵌入式应用开发》课程教学资源(文献资料)AN2594 Application note EEPROM emulation in STM32F101xx and STM32F103xx microcontrollers.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)PM0042编程手册——STM32F10xxx闪存编程.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)STM32F107开发板学习笔记.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)Cortex-M3 技术参考手册.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)姿态解算说明(Mini AHRS).pdf
- 《嵌入式应用开发》课程教学资源(文献资料)Embedded Motion Driver V5.1.1 教程.pdf
- 《嵌入式应用开发》课程教学大纲.pdf
- 《Java面向对象程序设计》课程教学资源(书籍文献)Java语言程序设计(基础篇)原书第10版,梁勇著.pdf
- 《Java面向对象程序设计》课程教学资源(书籍文献)Java语言程序设计-进阶篇(原书第8版,梁勇,扫描版).pdf
- 《Java面向对象程序设计》课程教学资源(PPT课件)第3章 Java语言基础(第6版).pptx
- 《Java面向对象程序设计》课程教学资源(书籍文献)Java项目开发全程实录(第三版).pdf
- 《Java面向对象程序设计》课程教学资源(PPT课件)第2章 Java语言开发环境(第6版).pptx
- 《Java面向对象程序设计》课程教学资源(PPT课件)第1章 Java语言概述(第6版).pptx
- 《Java面向对象程序设计》课程教学资源(书籍文献)Java编程思想【美】Bruce Eckel,Thinking In Java(中文版).pdf
- 《高级数据库》课程教学课件(讲稿)Chapter 7 触发器.pdf
- 《高级数据库》课程教学课件(讲稿)Chapter 6 存储过程.pdf
- 《高级数据库》课程教学课件(讲稿)Chapter 4 游标.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)通用串行总线(USB)2.0——STM32F10x USB开发者培训.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)XPT2046用户手册(中文资料).pdf
- 《嵌入式应用开发》课程教学资源(文献资料)W25Q64BV 64M-BIT SERIAL FLASH MEMORY WITH DUAL AND QUAD SPI.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)OV7670-OV7171 CMOS VGA(OmniPixel)CAMERACHIP图像传感器.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)ET2046 低电压IO触摸屏控制电路.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)ENC28J60 Data Sheet Stand-Alone Ethernet Controller with SPI Interface.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)DS1820中文数据手册.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)AT24C02.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)Advanced Monolithic Systems AMS1117 1A LOW DROPOUT VOLTAGE REGULATOR.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)AL422 Data Sheets.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)CH340 中文手册(USB 转串口芯片 CH340).pdf
- 《嵌入式应用开发》课程教学资源(文献资料)DHT11数字湿温度传感器的原理和应用范例.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)RealView编译工具 3.1 版 编译器参考指南.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)PCB高级设计系列讲座——射频与数模混合类高速PCB设计.pdf
- 《嵌入式应用开发》课程教学资源(文献资料)华为技术有限公司硬件工程师手册.pdf
- 《数据库原理与SQL Server》课程教学资源(PPT课件)单元1 数据库基础.ppt
- 《数据库原理与SQL Server》课程教学资源(PPT课件)单元2 数据库安装与配置.ppt
- 《数据库原理与SQL Server》课程教学资源(PPT课件)单元3 数据库设计.ppt
- 《数据库原理与SQL Server》课程教学资源(PPT课件)单元4 数据库建立.ppt
- 《数据库原理与SQL Server》课程教学资源(PPT课件)单元5 数据库查询.ppt
