Skip to content

Simple WAV/MP3 player with a STM32F411 "Black Pill", using I2S DAC and USB OTG

Notifications You must be signed in to change notification settings

deividAlfa/STM32F411-Black-pill-USB-WAV-MP3-player

Repository files navigation

STM32F411 "Black Pill" USB WAV/MP3 Player

Project description

This is just a training project that reads, parses and plays WAV/MP3 files using PCM5102A I2S DAC.
Uses a STM32F411CE "Black Pill" board running at 96MHz.
MP3 decoding is done with the library "Spirit MP3 decoder", freely available from ST.

For simplicity, only 44.1KHz, 16-bit stereo files are supported.
MP3 format is not checked! It assumes your MP3 is on the correct format.
Any bitrate should work, either VBR or CBR.
WAV files are checked and skipped if not valid.

PCM5102A connections are as follows:

  • SCK: Unconnected, uses self-generated PLL clock. Pull this pin to gnd in the DAC.
  • BCK: PB13
  • DIN: PB15
  • LRCK: PB12

Few waveforms:





The SWO output is enabled on PB3, you can see the debug messages using SWO console.
You can see them without debugging, just connect the ST-Link utility, open "Prinf via SWO viewer", setting clock to 96000000Hz.

For more details, check:

  /Inc/files.h
  /Inc/i2sAudio.h
  /Src/files.c
  /Src/i2sAudio.c

How to use

Connect a FAT32-formatted USB drive with wav/mp3 files in the root folder (/), it will automatically start playing all files found in a loop .
Press "Key" button (PA0) to skip current song.

Firmware

You can download already compiled binaries in the Release folder (mp3 player.bin file)
If you want to compile your own:

  • Download STM32 Cube IDE
  • Clone or download the code
  • Open STM32 Cube IDE, import existing project and select the folder where the code is.
  • It should recognize it and be ready for compiling or modifying for your own needs.

The code is stripped from most ST libraries, so you need to regenerate them.
Inside the IDE, open cubeMX (Double click the .ioc file) file and click on the code generation button.

CubeMx will make new code, and now it will compile correctly.

About

Simple WAV/MP3 player with a STM32F411 "Black Pill", using I2S DAC and USB OTG

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published