[Part 4] Multi-Core MP3 Player with RP2350

Multi-Core implementation for my MP3 Player Project (with demo video)
3 min read

This is part 3 about my MP3 player project. If you missed part 1, part 2, or part 3 you may want to browse those for context.

Once again, I’m trying to build an MP3 Player, that also includes FM Radio, GPS, and maybe some games.

Multi-Core Playback

I’m using embassy-rp, and the rp2350 has two cores. As I mentioned in the last post, I had a single-core implementation that wouldn’t allow for doing anything while the music was playing.

That’s now solved. I’m fully utilizing both cores. The first core, does UI/UX and some i2c operations for user controls, and commanding the fm radio. The 2nd, does music streaming from the SD card into the VS1053.

The 2nd core sits in a command loop, waiting to receive a command from the first core. When music playback or file listing is commanded, it performs that task. When playing audio, it sits in a loop, reading the file in 1024 byte chunks and sending them to the VS1053. When you press pause (handled by core 0 in the UI), it sets an AtomicBool to indicate that we need to interrupt the media loop, and a 2nd one to indicate pause status. The interrupt flag is also used to stop playback or indicate a song change.

When the pause flag is set, we pause the playback timer and sit in a loop, waiting for the user to continue.

Next Challenge: Improved Music Indexing

Assuming we can store media data in ram on average for ~128 bytes each (song titles, names, albums), at 2000 songs, that’s 256kb taken just for songs.

Additional brainstorming: Maybe, we can set up a decent sized (maybe low double digit kb) ring buffer in ram, to enable some SD operations while playback is running. We could load a certain amount of bytes into ram before we start playing, and then we refill it before we reach the end. That way - instead of the consistent sd read -> write to vs1053, we’re doing some sort of sd operation (if needed), and writing to the vs1053 from the ring buffer.

If we did that, maybe we can utilize a custom database on the SD card, instead of needing to store it all in RAM.

It might work like:

  • fill ring buffer
  • in loop:
    • perform ops (e.g. list files, read art, metadata)
    • write to vs1053

Next Steps

  • VS1053 Line In / Multiplexer for FM
  • Load executables from SD Card (games, etc)
  • Prototype PCB Designs
  • Compact PCB designs
  • Case Designs

Feedback

Found a typo or technical problem? report an issue!

Subscribe to my Newsletter

Like this post? Subscribe to get notified for future posts like this.