
UM1000
Demonstration applications
Doc ID 17964 Rev 1
3.8.3 Wave
player
demo
The STM8L15x microcontroller has an embedded DAC which can be used to generate
output signals.
In this demo, any wave file stored under the USER folder in the microSD card can be
opened using the file system PetitFatFS and transferred to the internal RAM by block (512
bytes) using the DMA and the SPI interface. Timer 4 (TIM4) triggers the DAC to generate
the wave signal. The voice sampling period is read from the Wave File Header. An audio
amplifier is connected to the DAC interface to play the stored wave files. This demo reads all
wave files from “USER” directory and displays only the .WAV files having the following
format:
●
Audio Format: PCM (an uncompressed wave data format in which each value
represents the amplitude of the signal at the time of sampling.)
●
Sample rate: may be 8000, 11025, 22050 or 44100 Hz.
●
Bits Per Sample: 8-bit (Audio sample data values are in the range [0-255]).
●
Number of Channels: 1 (Mono)
The maximum wave files number that can be read from the microSD card is 3 files selected
by alphabetic order.
When the Stored wave is selected from the Audio Player submenu by pressing the
SEL
on
the joystick, The following message remains displayed unless
SEL
is pressed.
Figure 44.
Stored wave message
When
SEL
is pressed, the system checks if an SD card memory is available in the
connector CN15. If there is no card detected, the Stored Wave demo will not start and the
message shown in
is displayed on the LCD for two seconds then the Audio Player
submenu is
displayed again
.
Figure 45.
Stored wave message
Otherwise, if SD card is detected in the connector CN15 the available wave interface is
displayed as shown in
.
Figure 46.
Available wave message
Audio Player
Stored Wave
SD Card Not
Present
Available Wave
USER/xxxxx.WAV
www.BDTIC.com/ST