STMicroelectronics AN2394 STR7/STR9 Audio Generation with PWM Application Note

This application note describes how to use PWM hardware to generate a .WAV audio file. It is targeted for STR7/STR9 microcontroller users.


STMicroelectronics AN2394 STR7/STR9 Audio Generation with PWM Application Note - cover page
Brand
STMicroelectronics
Category
microcontrollers
Document type
Application Note
Language
English
Pages
13
File format
PDF
File size
174 KB
Published
07 August, 2012
Updated
30 September, 2023
Models
STR7, STR9
MD5 checksum
47167AB72278604D2AE2E9C884BF668F

About this manual

This document describes a method for audio playback on STR7 and STR9 microcontrollers using Pulse Width Modulation (PWM) to simulate a Digital-to-Analog Converter (DAC). It details the requirements for .WAV file formats, specifically supporting PCM, 8-bit mono audio at sample rates of 8000, 11025, 22050, or 44100 Hz. The solution utilizes a system timer to manage data reading and a PWM timer to generate the analog signal, which is then filtered and amplified.

What's inside

  • WAV file format
  • Audio playback
  • STRx PWM description
  • Implementation example with STR711F
  • Hardware description
  • Firmware description
  • Revision history

Specifications

Supported Sample Rates8000/11025/22050/44100 Hz
PWM Output Duty Cycle Range0% to 100%
Recommended Low-Pass Filter Cutoff Frequency4 kHz
Example Flash MemoryM25P64 (64-Mbit)
Example Audio AmplifierTS4871

Frequently asked questions

How is the audio signal generated without an on-chip DAC?

The built-in Pulse Width Modulation (PWM) module is used to generate a signal whose pulse width is proportional to the amplitude of the sample data.

What is the recommended cutoff frequency for the low-pass filter?

The filter cut-off frequency is set to 4 kHz to ensure the PWM carrier is removed while passing the audio spectrum.

Download PDF (174 KB)

More STMicroelectronics Manuals


View all STMicroelectronics manuals →