CARDS
ON THE TABLE
Almost
everyone knows how to use and program an SD
card. There are a number of examples freely
available. The embedded file system library
(EFSL) is very popular. I used bits and pieces
of my old code for the initialization and reading
of files. My code covers only FAT16, but it’s
rather small and uses very little RAM.
I
put the open-source software for MP3 decoding
into a separate directory (\fixpt) as part of
CrossWorks for an ARM project. The compiler
is based on GNU. There is a nice debugger in
the package for easy development. Rowley offers
a fully functional, time-limited evaluation
version.
I
was positively surprised that I had only a few
compilation errors. After commenting out some
unnecessary statements, everything compiled
smoothly.
I
haven’t used the dynamic memory allocation,
but I have a rather static memory assignment.
As a result, my mp3_init function is different,
but you can do it either way. A dynamic allocation
is more elegant because you can free up the
memory for other uses.
My
SD_play_mp3() function is based on the open
source example. Only three functions from the
package are called: MP3FindSyncWord(), MP3Decode(),
and MP3GetLastFrameInfo(). I created the myFillReadBuffer()
function to handle the readings from the SD
card and filling the input buffer.
I
usually use the “It’s not you, it’s me” approach
when something doesn’t work. After fixing some
bugs in my code, everything worked fine and
I didn’t have a need to go any deeper into the
MP3 code. If you’re curious about how it’s done,
browse through the code and read the comments.
If
it doesn’t work, you’re not hitting it with
a big enough hammer. If your hardware is identical
or similar to mine, you might first try to load
the hex code using the Philips ISP utility.
If it works and you need to make changes, you
can rebuild the sources. Remember to turn on
the optimization for the MP3 code in the GNU
compiler. The “–Os” option worked for me.
There
is no embedded video included in the project
yet, but don’t be surprised if it’s as easy
to do in the near future as it is to do today
with embedded audio (that’s if Moore’s law still
applies).
I’ve
always admired people with artistic ability.
Although embedded system design is more of a
craft than an art, you can still make everything
work well and look good.