2017-01-12 04:28 AM
Hello to everyone,
I've been searching in the web to find and example of this typicall aplication of reporducing MP· files from a USB stick, with the stm32f4 discovery board.
At first I found the code (
http://vedder.se/2012/12/stm32f4-discovery-usb-host-and-mp3-player/
) but I work with keil and I didn't succes to make it work with Keil.Looking harder I've found and example with keil.
http://shuji009.blog.eonet.jp/default/2012/03/stm32f4mp32-30df.html
The explanations are in japanese so I had to translate them with google. And even I followed the instructions of the programmer:(
which are: comment AUDIO_MAL_MODE_NORMAL and uncomment AUDIO_MAL_MODE_CIRCULAR in stm32f4_discovery_audio_codec.h file
and also: uncomment AUDIO_MAL_DMA_IT_HT_EN in the same file )
I can't make it works.
The japanese code breaks(HardFault_Handler) in the mp3.dec file, in the function 'HMP3Decoder MP3InitDecoder(void)' after executing the AllocateBuffers
Anyone could help to make it work?
Thanks in advance
2017-01-12 11:33 PM
I have found another code. This time in german
http://mikrocontroller.bplaced.net/wordpress/?page_id=2272
but I still haven't get to port it to keil:(
2017-01-13 12:08 AM
Looking inside the ST documentation it seems that they have already done an specific library code for MP3, but it's not populated. How you can get this library?
2017-01-13 12:09 AM
If an imported (and supposedly working) project fails, the problem is most probably outside the source code.
A too small stack is a good candidate for hardfaults. I would check what the 'AllocateBuffers' function actually does. Or, the author has changed the linker script/file and adapted the stack/heap sizes to make it work. You will need to port those changes to your environment, then.
Changing compiler optimization settings (upwards) is also known to 'break' certain code ...
2017-01-13 04:34 AM
Got it!
The following changes are needed to make it work.
in stm32f4_discovery_audio_codec.h file:
Enable # define AUDIO_MAL_MODE_CIRCULARAlso enable #define AUDIO_MAL_DMA_IT_HT_EN.#define AUDIO_MAL_MODE_NORMAL needs to be commented out.IN
stm32f4_discovery_audio_codec.c
EVAL_AUDIO_TransferComplete_CallBack((uint32_t)pAddr, Size);
Now it still sounds as double speed but I solve it.
2017-01-13 05:07 AM
Many thanks AvaTar!, you were right I have changed the stack size in the startup_stm32f4xx.s
Stack_Size EQU 0x00001000
And now it works without crashing.
But it still doesn't produce any noise. I will continue testing.
2017-01-16 01:35 AM
Hello Mr Feixas,
which project did You make work?
1. Benjamin's robotics STM32F4 Discovery USB host and MP3 player
OR
2. Japanese blog
Daily work (memo)
STM32F4 Migrating MP3 (2) ~ For the time being
I tried both to some extent, but I could not make them work.
Actually I'm lost since first part of the application, that is USB host MSD and then FAT32 File System.
Thank You,
Giacomo
2017-01-16 01:50 AM
Hello Mr.Zaffini.
The japanese blog project is the one which worked for me.
You have just to download it and add the project folder inside the 'Project' library of the st given library for the discovery board -> STM32F4-Discovery_FW_V1.1.0\Project
And then apply all the changes I explained before.
2017-01-18 07:23 AM
Thanks Mr. Feixas.
I'll try harder with stm32f4-discovery board next weekend following Your advices.
Since You accomplished building a mp3 player, i wonder if a bigger project is of Your interest,
I saw on YT this one which took my attention, it has added resources and a custom shield
linking to this site page
http://motionplayer.wiki.fc2.com/
which has source code link and other resources.
Thank You again,
Giacomo