It seems like you've been watched by big brother... NedWatch
 
 

This page has a new entrance redirector: http://go.to/hardwaremp3
This page is moving to a new host: http://home.hetnet.nl/~victorvanacht/

         Hardware MP3-player 

This page is still

recent updates are coloured in magenta.


I started this project in Spring 1997 together with a friend of mine, in the time that real time audio (de-)compression was state-of-the-art in electronics. Back then you couldn't buy your personal, portable MP3-player at every corner of the street, and Intel's Pentium @ 133MHz was just able to run WinAmp in high-quality mode. I thought it would be nice (and very interesting) to build my own stand alone MP3-player, without the drawbacks of a standard IBM-compatible desktop computer: monitor necessary, harddisk necessary, keyboard necessary, power consumption, noise of the fan, long boot-time, etc.

My MP3-player had to meet the following requirements:

Therefor I chose the following set up:
Because Texas Instruments provides DSP Starter Kits (DSK) for their TMS320C31 floating point digital signal processor, including some development software such as an assembler and a debugger, I decided to use this Starter Kit. The additional electronics were to be placed on a daughter board for this DSK. (actually it looks more like a motherboard without a processor :-) ).
After choosing the electronic components a Printed Circuit Board (PCB) has been designed. I used the program 'EdWin' to design the daughter board. The board itself is approximately 20cm x 30cm, dual sided and has Surface Mounted Devices (SMD) on it. I manufactured the board my self, in my home-made photographic etching-tank.
After vigorous visual en electrical testing (and correcting some lay-out errors :-( ) I could test the daughter board together with the DSP. And of course... the thing didn't work. It took me three weeks to solve all timing problems. (Damn 8255 wants adress stable before !RD or !WR is applied, and !RD and !WR must be deactivated before the adress is changed. Just like the ATA-interface. Of course the LCD-display wants just the opposite. Furthermore there were some glitches in the !Ready-line for the DSP when the waitstate-generator on the daughterboard was taken over by the waitstate-generator on the DSK. And why are R43 and R44 on the DSK not mounted?)
But at this moment I believe that the hardware and GAL-software is pretty much bug-free.
Some changes have been made in the interfacing between the on-chip serial port of the TMS320C31 and the AD1859 Digital to Analog Converter, in order to make DMA-controlled WAV-playing possible. This means that the data can be send to the DAC with zero CPU overhead.
 
 

Software

The software for the MP3-player can be devided into several parts: Biggest problem with the software is that some how it has to be multi-tasking & real-time. One of the big issues in Operating Systems... (For example when the interrupt handler is reading one sector from the CD it has to wait for the data, but still the music must continue, so the interrupt handler must be interruptable(!). And of course while the interrupt handler is waiting for CDROM-data, the user-interface is not allowed to read from the CD (for example go into a subdirectory). And vice-versa.)
The main part of the software is programmed in C (using Texas Instruments optimising C compiler), but the low level device drivers and the MPEG layer 1,2,3 decoder are programmed (or will be programmed) in assembly, for speed reasons.
Before I started this project I had allready a little experience in designing microprocessor boards and ATA/ATAPI device controlling: I built an audio CD player using standard ATAPI CDROM drives and a Zilog Z80 microprocessor. This design won the fifth price in "Elektuurs Internationale Programmeer Wedstrijd" in 1997.
I also did some pre-research in the ISO 9660 filestructure and Joliet extention: I more or less reprogrammed CDROM.SYS and MSCDEX.EXE on a IBM-compatible PC for testing. Starting from this file it was very easy to translate it to the DSP-board.
Furthermore I programmed an MPEG 1 Audio Layer 1+2+3 decoder on a PC, in C (not real-time) to understand the structure of an MPEG bitstream. I also wrote the most CPU-intensive parts (namely the IMDCT and the windowing algorithm) in TMS320C31 assembly (without testing) to check whether this processor was able to decode an MP3-file in real time.

Most interesting part of the software is of course the MPEG audio layer 1+2+3 decoder. Although I did not debug and test the decoder I wrote as a test-case in C (note that no code is taken from other decoders to program this one!), and are not started yet with programming the MPEG decoder for the DSP-board, I think I have a pretty good idea of how it can be implemented. The most CPU-intensive parts of the decoding process for layer 1 and 2 are some sort of inverse Fourrier transform (called an Inverse Modified Discrete Cosine Transform (IMDCT)) and a windowing operation.

An other interesting part of the software is the real-time multi-tasking operating system. Multi-tasking is implemented as follows: The functionality of the MP3 player is now devided into multi-tasking processes and the main program as follows: The menu oriented user interface is programmed in such a way that it is implemented very memory-efficient. Using tables which contain the texts of the menu entries, the adresses of the menu entry handling routines, and parameters for these handling routines. In this way the complete code and data of an 'average menu option'  takes only about 30 bytes (10 32bit words).
If you are interested in a document containing information about hardware & software revisions and bug-fixes, click here. Note: Beware that downloading any of the files on this page is strictly for personal, non commercial use only!!!


Photographs

Via E-mail, I received some requests for photographs of the current MP3-player-project. Click here for more pictures.

I borrowed a digital camera and made some more pictures of the Hardware MP3-player project
 
 
The DSP-daughter-board (component side) with the Texas Instruments 'C31 DSK (component side) mounted.
On the DSP-daughter-board are clearly visible: 
  • The stereo 18bits 48KHz DAC and some analog electronics (bottom right) 
  • 1 MByte 0 waitstate SRAM (under DSK) 
  • Adres decoder and waitstate generator in two GALs (top left) 
  • Adresbus and databus buffers, 8255A, IDE-port, keyboard-connector, LCD-display connector and EPROM (not mounted) (left of DSK) 
  • The powersupply (top right) is not finished yet 
The MP3-player under development:
On the left the computer I use for writing the software. Next to it the (temporary) power supply for the DSP. On top of that an ATAPI-CDROM-player, and on top of that the keyboard. Next to that the DSP daughterboard with the DSK-board mounted. Also notice the uploading connector (LPT-port) in the DSK. 

Further more al kind of things are visible in the background such as a soldering iron, audio power amplifier, alarm clock, and some other (un)useful stuff.

Again, more pictures of the project can be found here!!!
 


Documents and Sources

I was asked to put all the sources of the Hardware MP3-player on-line. Well... here they are!

Download (parts of) sources of the Hardware MP3-player:

While designing the hardware and programming the software for the MP3-player other documents have been used. If you are interested you can download those documents yourself:
 

Interesting Links

Really interesting