Example: marketing

UM1720 User manual - STMicroelectronics

May 2015 DocID025799 Rev 31/431UM1720 User manualSTM32 Cube USB host library IntroductionSTMCube initiative was originated by STMicroelectronics to ease developers life by reducing development efforts, time and cost. STM32 Cube covers STM32 Version includes: The STM32 CubeMX, a graphical software configuration tool that allows to generate C initialization code using graphical wizards. A comprehensive embedded software platform, delivered per series (such as STM32 CubeF4 for STM32F4 series) The STM32 Cube HAL, an STM32 abstraction layer embedded software, ensuring maximized portability across STM32 portfolio, A consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics, All embedded software utilities coming with a full set of Universal serial Bus (USB) is known to be the defacto standard for communication between Personal Computer (PC) as host and connected USB peripherals.

The Universal Serial Bus (USB) is known to be the defacto standard for communication between Personal Computer (PC) as host and connected USB peripherals. ... Mass-storage class, virtual comport) or particular vendor device. ... usbh_msc.c Mass-storage class handler usbh_msc_bot.c Bulk-Only Transfer (BOT) protocol usbh_msc_scsi.c SCSI commands

Tags:

  Serial, Class, Bulk, Storage, Only, Mass, Serial bus, Storage class

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of UM1720 User manual - STMicroelectronics

1 May 2015 DocID025799 Rev 31/431UM1720 User manualSTM32 Cube USB host library IntroductionSTMCube initiative was originated by STMicroelectronics to ease developers life by reducing development efforts, time and cost. STM32 Cube covers STM32 Version includes: The STM32 CubeMX, a graphical software configuration tool that allows to generate C initialization code using graphical wizards. A comprehensive embedded software platform, delivered per series (such as STM32 CubeF4 for STM32F4 series) The STM32 Cube HAL, an STM32 abstraction layer embedded software, ensuring maximized portability across STM32 portfolio, A consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics, All embedded software utilities coming with a full set of Universal serial Bus (USB) is known to be the defacto standard for communication between Personal Computer (PC) as host and connected USB peripherals.

2 Today with the increasing number of embedded portable devices, USB as a host is no more restricted to PC but it is becoming more present in embedded consumer and industrial devices as embedded host with limited functionality like support of a particular USB class (for example mass - storage class , virtual comport) or particular vendor user manual describes the STM32 Cube USB Host library which is part of the STM32 Cube firmware package that can be downloaded free from ST website ( ). It allows using an STM32 microcontroller as an USB embedded host for communication with USB peripherals of various USB classes (MSC, HID, CDC, Audio and MTP). Note:This document is applicable to all STM32 series that feature an USB OTG peripheral. However, for simplicity reason, the STM32F4xx microcontrollers and STM32 CubeF4 are used as reference platform.

3 To know more about the examples implementation on your STM32 device, refer to the readme file provided within the associated STM32 Cube firmware Rev 3 Contents1 STM32 Cube USB Host library overview .. 62 USB host library architecture and file organization .. host library architecture .. host library file organization .. host core files .. host class files .. 93 Host library core module .. features .. APIs, user callbacks and data structures .. APIs for application .. user callbacks .. APIs for class handlers .. host core data structures and enumerated typedefs .. of the core state machine .. interface with low-level driver .. 194 USB host library class module .. implementation model.

4 mass - storage class (MSC) .. class interface initialization .. control class requests .. class process .. class -specific APIs .. class typical usage flow .. HID mouse and keyboard class (HID) .. class interface initialization .. class requests .. class process .. specific APIs and event callbacks .. class usage flow .. communication device class (CDC) .. 28 DocID025799 Rev 33 interface initialization .. class requests .. class process .. specific APIs and callback functions .. class usage flow .. audio class .. class interface initialization .. class control requests .. class process .. class APIs .. class usage flow .. Media Transport Protocol class (MTP).

5 Interface initialization .. class control requests .. class process .. user application APIs and callbacks .. class usage flow .. 345 Using the USB host library .. host library configuration options .. the host library in standalone mode .. the host library in RTOS mode .. operation in RTOS mode .. the low interface file .. Host Controller BSP functions .. Host controller HAL driver callbacks .. host library low-level interface APIs .. 416 Revision history .. 42 List of tablesUM17204/43 DocID025799 Rev 3 List of tablesTable host core files .. 8 Table drivers files .. 9 Table APIs for application .. 11 Table user callbacks events.. 11 Table APIs dedicated to class handlers.

6 12 Table handle structure .. 13 Table device structure .. 15 Table host status .. 15 Table interface APIs .. 19 Table event callback functions .. 20 Table class handler structure .. 21 Table used for USB MSC implementation .. 22 Table host mass storage class handlers .. 23 Table commands .. 24 Table class specific APIs .. 24 Table used for the implementation of the HID class .. 25 Table class requests .. 26 Table APIs and event callbacks .. 27 Table class requests .. 29 Table class APIs and callback functions .. 29 Table class control requests .. 31 Table class APIs .. 32 Table APIs and callbacks .. 34 Table host library configuration options .. 35 Table Host controller (HCD) HAL driver callbacks.

7 40 Table configuration options .. 40 Table revision history .. 42 DocID025799 Rev 35/43UM1720 List of figures5 List of figuresFigure USB host library.. 6 Figure host library architecture .. 7 Figure .. 13 Figure descriptor .. 14 Figure state machine.. 18 Figure structure .. 21 Figure state machine .. 23 Figure MSC class usage .. 25 STM32 Cube USB Host library overviewUM17206/43 DocID025799 Rev 31 STM32 Cube USB Host library overviewThis document describes the STM32 Cube USB host library middleware USB host library sits on top of the STM32 Cube USB host HAL driver. This library offers the APIs used to access USB devices of various USB host module can be used for the implementation of the major USB classes: mass - storage class (MSC) Human interface mouse and keyboard class (HID) Communication device class (CDC) Audio class (AUDIO) Media Transfer protocol class (MTP)In addition to the above-listed classes, the users can build their own class using the available library library is built with the possibility to work in standalone mode or in RTOS mode.

8 The library also supports multi-instance, as it can work simultaneously on two or more USB host 1. STM32 Cube USB host libraryh^ , h^ , D D^ ,/ h /Kh h^ , , > h^ , h^ , > LJ06 9 DocID025799 Rev 37/43UM1720 USB host library architecture and file organization422 USB host library architecture and file USB host library architectureFigure 2 shows an overview of the library 2. USB host library architectureAs seen in Figure 2, the USB host library is organized into two main parts: the core and the class host core handles the core services of the library which are mainly used for the following: Device connection/disconnection management and standard enumeration, Host pipes control and USB transfer management (control, interrupt, bulk , isochronous).

9 The core block can be schematically subdivided into two main sub-blocks: The core APIs which are called from the user application or from a class driver, The core process which handles the host state class drivers are used for the implementation of the various USB classes.$SSOLFDWLRQ670 &XEH +$/ 'ULYHUV 86% +RVW )6 +6 ,3 *3,2 /RZ /HYHO *OXH ,QWHUIDFH XVEKBFRQI F &RUH $3,V&RUH 3 URFHVV VWDWH PDFKLQH &ODVV +DQGOHU&ODVV $3,V86% +RVW &RUH86% +RVW &ODVV 'ULYHUV([ 0 DVV VWRUDJH 5($' :5,7(([ +RVW ,QLW 6 WDUW 8 VHU FDOOEDFNV670 &XEH 86% +RVW /LEUDU\ 06Y 9 USB host library architecture and file organizationUM17208/43 DocID025799 Rev 3A class driver can be seen as the following: A set of class specific APIs (for example disk_read, disk_write) which can be called from an application layer.)))]]

10 A class handler which is called from the core host state machine (Core Process) to handle the class operation ( class initialization, class de-initialization, class process).Both the host core and the class drivers call user callback functions following some defined events (for example device connection/disconnection, data reception).The USB host library interfaces with the STM32 Cube HAL drivers using an interface template file implementing the low-level interface layer is provided in the library. The user can customize the sections in the file that are related to board support package USB host library file USB host core filesThe USB host core files are located in the Core folder (STM32_USB_Host_Library\Core). Ta b l e 1 lists the core files.