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