Audio playback and recording using the STM32F4DISCOVERY
1 Introduction
This application note describes the audio (wave) playback and recording application based
on the STM32F4xx microcontroller and the STM32F4-DISCOVERY board.
The audio data (wave) can be read from the internal Flash memory of the STM32F4xx
microcontroller or on an external USB key (through USB FS core in Host mode). The
recorded wave can be stored only in the external USB key.
The recording process is based on ST MP45DT02 MEMS microphone hardware with a
PDM audio software decoding Library (converting PDM data produced by the microphone to
PCM data stored in the USB key).
The document is structured as follows:
●A description of the principles of the audio playback and recording firmware and how to
run the firmware demonstration are provided in Section 2: Application overview.
●Section 3 describes how to get started with the software and hardware.
The source code of this application is provided in the "STM32F4-DISCOVERY board
firmware package" (V1.1.0 and later) under the following path
'Project\Audio_playback_and_record.
1.1 Reference documents
●STM32F4DISCOVERY high-performance Discovery board data brief
●Getting started with software and firmware environments for the
STM32F4DISCOVERY Kit (UM1467)
●PDM audio software decoding on STM32 microcontrollers (AN3998)
●STM32F40x reference manual (RM0090)
●STM32F405xx STM32F407xx datasheet
The above documents are available at www.st.com/stm32f4-discovery.
The audio playback and record applications support two types of mass storage media. They
can play audio data in the internal Flash of the microcontroller or on an external USB key,
and record data only to an external USB key. This is selected by defines in the main.h file. In
the workspace toolbar, select the project configuration:
●MEDIA_IntFLASH
●MEDIA_USB_KEY
The firmware driver can:
●Play a stored wave from an external USB key or internal Flash
●Record a wave in an external USB key
●Switch from play to record
Figure 1.Audio playback and record architecture
This application is based on a STM32F4xx device and an STM32F4-DISCOVERY board.
The main features of the application are:
●MEMS microphone
●Audio Codec DAC
●Headphone
●USB key (if this the storage media used)
●MEMS accelerometer
4/15Doc ID 022390 Rev 1
AN3997Application overview
MS19887V1
I2C
Buttons
DMA
I2S
I2S
Internal
Flash
I/Os
USB host
Codec
(DAC)
STM32
The main STM32 modules used by this application are:
●USB peripheral: configured in Host mode. Mass Storage Class (MSC) is implemented
to transmit and receive audio data from/to USB key.
●I2S peripheral: configured in Master Transmitter mode and used to transmit audio data
to the external audio codec (DAC). It is also used as a Master Receiver as an input
clock for the MEMS microphone.
●DMA: is used to transmit data from the buffers to the I2S peripheral. This significantly
reduces the CPU load.
●I2C peripheral: is used to control several external devices like the audio Codec and to
obtain data from this device.
●SPI peripheral: used to control the MEMS accelerometer.
●User button: is used to monitor the applications (playback or record).
Figure 2.Audio playback and record modules
Note:This application note is based on the STM32 USB On-The-Go (OTG) host and device
library. For more details about the USB Host stack and a mass storage demonstration,
please refer to the “STM32F105/7, STM32F2xx and STM32F4xx USB On-The-Go host and
device library” user manual (UM1021).
Doc ID 022390 Rev 15/15
Loading...
+ 10 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.