February 2019 UM2195 Rev 1 1/43
1
UM2195
User manual
USB device audio streaming
Expansion Package for STM32Cube
Introduction
The universal serial bus (USB) is a widely and frequently used communication protocol. In
addition to enabling robust and fast data transfer, it has evolved to encompass data
interfacing for various application fields, such as audio streaming for data playback and
recording.
This user manual is associated with the X-CUBE-USB-AUDIO Expansion Package that
supplements the STM32Cube™ firmware library. It describes the X-CUBE-USB-AUDIO
firmware and how to use the library for audio playback or recording.
This user manual covers the following topics to aid in the use of the Expansion Package:
Introduction to STM32Cube™
USB Audio Class overview
Software architecture
Structure list used
Sequence diagrams showing USB audio playback interactions
.
www.st.com
Contents UM2195
2/43 UM2195 Rev 1
Contents
1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Acronyms and abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Introduction to STM32Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 USB audio streaming overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1 Protocol overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 USB audio function description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 USB audio streaming expansion architecture . . . . . . . . . . . . . . . . . . . 17
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.3 Expansion global architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.4 Detailed architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.5 Buffer model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.6 Hardware related components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4 USB audio streaming expansion for STM32Cube™
library programming guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.1 Expansion examples initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 USBD-Audio 10 class interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3 Common USB streaming structures and session structure . . . . . . . . . . . 28
4.3.1 Generic node structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.2 USB input/output node structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.3 USB feature unit node structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.4 Speaker node structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3.5 Microphone node structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Compilation and user flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5 Example description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.1 STM32446E-EVAL board standalone playback example . . . . . . . . . . . . . 35