Skip to main content
MBertocchi
Associate II
October 29, 2024
Question

a low-price micro STM32 to read .mp3 file from SD Card ?

  • October 29, 2024
  • 5 replies
  • 3001 views

Hello friends,
I write this post to ask for a hand in choosing a low -price micro stm32 that can read an .mp3 file from an SD card. The customer wants a really low cost and therefore I cannot go to use microcontroller with 100 pins, but I have to use a really cheap micro that gives me the opportunity to read a .mp3 file from SD. I ask for your willingness to help me!

5 replies

Andrew Neil
Super User
October 29, 2024

Just read it?

Just reading files from SD Cards can be done (and has been widely done) on simple 8-bit microcontrollers - so (pretty much) any STM32 will be able to do it.

At minimum, all you need is an SPI port.

http://elm-chan.org/fsw/ff/

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
MBertocchi
Associate II
October 29, 2024

thank you friend, take a look at what you forwarded me

QSHAO.1
ST Employee
October 30, 2024

If a SPI port is not enough for your application, you may need a SDIO interface on your STM32.  Anyway, you may install App STM32 Finder from STM32-FINDER - STM32 product finder for mobile devices - STMicroelectronics, and select right MCU for your application.

Andrew Neil
Super User
October 30, 2024

The "MCU Finder" is also available for Windows/Mac/Linux:

https://www.st.com/en/development-tools/st-mcu-finder-pc.html

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Ozone
Principal
October 30, 2024

As pointed out, reading a file (.mp3 or otherwise) is pretty pointless as such.
More important is, what you want to do with it.
The request suggests you need a MCU capable of decoding MP3, and feeding it to an audio amp.
I'm not sure if small and cheap 8-bit MCUs would suffice for this use case.

OTOH, I haven't dealt with MP3 encoding/decoding yet.
You might need to experiment with M0/M0+/M3 cores to check your performance requirements.
File reading (SPI/SDIO) and serial audio data output (SPI, I2S) are relatively light on pin count, you can get away with small packages.
You only need to make sure every interface you need is routed to the available pins, and all interfaces are routable simultaneously.

MBertocchi
Associate II
October 30, 2024

can you tell me exactly if I should use SPI or SDIO? I chose the µ STM32G431KBU6 which reads the .mp3 file and translates it into a DAC value with low precision

Andrew Neil
Super User
October 30, 2024

@MBertocchi wrote:

can you tell me exactly if I should use SPI or SDIO? 


That's entirely up to you - use whichever fits best with your particular project requirements!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
LCE
Principal II
October 30, 2024

And another thing:

So you read an mp3 file from SD-card - that's all you told us until now.

Be precise in your requests...

So you also want some audio output - but don't forget that inbetween file reading and DAC output you must decode mp3 data to something a (probably very cheap, or even the internal) DAC can understand.
So better check for some libraries for decoding, and which STM32 can handle that.

Andrew Neil
Super User
October 30, 2024

@MBertocchi wrote:

 really cheap 


If that's your key concern, note that there are cheap chips & modules which do SD-Card MP3-to-audio direct; eg,

https://www.aliexpress.com/item/1005005212215899.html

https://www.amazon.co.uk/DollaTek-Lossless-Decoders-Decoding-Amplifier/dp/B07M6JWMH6

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.