I've enabled my STM32F4 Discovery Board to play MP3 files (using ChibiOS and I2S support from ST libs). There is no display support yet. However, I think the code may already be a good start for people trying to do something similar. Some code for reading ID3v2 tags has been added, too.
The boards DAC is driven through I2S and a circular DMA buffer, which makes playback perfectly smooth.
Only an SD card has to be attached to the board get the code working. Optionally, you can watch player messages on the PC through the UART TX on PA2. More details can be found in the comments at the top of main.c. The SD card currently has to be in the slot/attached when the board is turned on. All MP3 files in the cards root are then played in a loop in the order they are recorded in the FAT. You can press the blue user button to skip the currently playing title.
The sound quality is, IMHO, very impressing.
To build the source I used Code Sourcery Lite + Eclipse Indigo + CDT/GNU ARM plugins on Windows as well as on Linux. You can find the according eclipse project with all sources and a prebuilt binary here:
http://watz.at/F4D_MP3_1.zip
Gruß,
Watz
P.S.: The UART output looks like this:
Code: Select all
SD: Connected to card
SD: File system mounted
Mp3PlayAllFiles: Playing all files in "/"
Mp3PlayAllFiles: FILE "/10-THE~1.MP3"
Mp3Decode: Start decoding "/10-THE~1.MP3"
Mp3Decode: Skipping 2266 bytes of ID3v2 tag
Mp3Decode: Now playing (ID3v2): Within Temptation - The Truth Beneath The Rose
Mp3Decode: 44100 Hz 16 Bit 2 Channels
Mp3Decode: frame 0, bitrate=128000
Mp3Decode: frame 100, bitrate=160000
Mp3Decode: frame 200, bitrate=160000
Mp3Decode: frame 300, bitrate=160000
Mp3Decode: frame 400, bitrate=192000
Mp3Decode: frame 500, bitrate=192000
Mp3Decode: frame 600, bitrate=192000
Mp3Decode: frame 700, bitrate=224000
Mp3Decode: frame 800, bitrate=224000
Mp3Decode: frame 900, bitrate=192000
Mp3Decode: Stop requested
Mp3Decode: Finished decoding
Mp3PlayAllFiles: FILE "/11-FOR~1.MP3"
Mp3Decode: Start decoding "/11-FOR~1.MP3"
Mp3Decode: Skipping 2248 bytes of ID3v2 tag
Mp3Decode: Now playing (ID3v2): Within Temptation - Forgiven
Mp3Decode: 44100 Hz 16 Bit 2 Channels
Mp3Decode: frame 0, bitrate=128000
Mp3Decode: frame 100, bitrate=160000
Mp3Decode: frame 200, bitrate=160000
Mp3Decode: frame 300, bitrate=160000
Mp3Decode: frame 400, bitrate=192000
Mp3Decode: frame 500, bitrate=256000
Mp3Decode: frame 600, bitrate=160000
Mp3Decode: frame 700, bitrate=160000
Mp3Decode: frame 800, bitrate=128000
Mp3Decode: frame 900, bitrate=128000