Googling around I've stumbled in a forum where some people were posting about their mp3 player projects. Some guys were just stiffing a whole PC in some custom made enclosure to have in the living room, others would even attach an alphanumeric lcd to the printer port so they could have a sort of visual interface.
What caught my attention were the projects were you could use these hard-to-get-mp3-decoder-chips.
So that's when I decided: "I'll build a standalone MP3 player!"
At that time I remember only having two options as decoder chips: Micronas MAS3507D or VLSI Solution VS1001K and independently of which one I choose I wouldn't find one in a 2000 Km radius...
Suddenly I had 4 quests in my life:
- Get my hands on one of these mp3 decoder chips.
- Build a board with the mp3 chip + audio DAC.
- Feed the mp3 decoder board with some music (and enjoy the beautiful sound).
- Build some controller board with some heavy mass storage (I really mean heavy when I say it! the main goal was to use a laptop IDE hard disk but all I had back then was a heavy 3.5'' hard disk).
Quest number one turned out to be easy. I was living with a cousin at that time (we both were studying electronics engineering out of hometown) and he was dating a girl that had her father in Germany near a local shop where they actually had the mas3507d. Great! Her dad bought us 2 Micronas chips and sent by mail (and also 2 Micronas audio DACs). (My cousin also ended up joining the mp3 player adventure, which without him I would stuck in the first quest for some time!).
While waiting for the package to arrive, I started quest number two.
The MAS3507D datasheet had this reference design, so I took it, ripped of some unneeded stuff (like auxiliary audio inputs) and used it in my board. The scary thing was that the chips were SMD. Developing a home-made pcb for smd was something I had never done, but after about 3 or 4 tries I was able to etch an almost perfect double sided PCB using UV sensitive boards.
Soldered all the components and the there I was, with a perfect mp3 decoder board that was just missing the... mp3 decoder! The chips arrived some days after, soldered them and I was ready to provide my ears with some music.
|The finished mp3decoder board! Left is MAS3507D, right is DAC3550; Top connectors: I2C, SPI, Power supply; Right connectors: Lineout and Speaker out.|
Quest number three was about to start: feed the beast!
The beautiful thing of this decoder board was the simplicity to make it work.
The board is fed with the mp3 bitstream in a 'crippled' 2 wire SPI interface (mosi, clk) and a "i'm busy" signal telling that the chip buffer is full. The output are two stereo connectors: line out and speaker out.
To test the board all I has to do was connect the 3 wires to a computer parallel port and code a simple program that grabbed an mp3 and bit-streamed it in the parallel port.
And... well, I can say that it did work! A sort of something that I can call half-second music, half-second silence was flowing in the air.
What was happening was the mp3 that I selected to be the One, had a high bitrate encoding and the computer plus the parallel port couldn't handle the job. Maybe if I did some assembly coding it would play higher bitrate mp3s but that was not the point. I just simply searched eMule for a small and low bitrate mp3 and tested it. Funny that the first hit was the theme song from a Portuguese TV show named "Batatoon". And there it was, playing perfectly in the mp3 decoder board (as perfect as it could get with only 96kbps bitrate)!
The board also has a second connector for an I2C interface. It allows to control internal registers of the mas3507 like volume, treble, bass, balance, ... (and really needed in a latter chip revision to start the decoder! I know this because after some days a badly connected power supply destroyed the first mas3507 and when using the second one (and I'm glad I had a second one!), the music was gone! so after reading through the datasheet and setting a specific bit in some register, the board was back to life).
Having a working mp3 decoder board, all that was left was the last quest: Have a full working system with space to store a bunch of music.
This is where the 68000 comes in. I grabbed my 68000 system, cleaned all the dustin it and attached an IDE harddisk.
I think I've aged about 2 years just for cutting the 40 pin IDE cable and connecting each signal to the 68000 bus (in breadboards). One word: tedious!
"Let the coding start"!
For who never programmed 68k assembly this can sound weird, but the truth is that it is pleasure to code those lines! The instruction set is so vast and there are a lot of addressing modes!
And so I've codded the IDE driver, partition and FAT32 reader. I could soon play some tunes!
When it came to the part of connecting the mp3 decoder board, problems appeared! How the hell am I going to send the bitstream?
Ideia number 1: Serialize the bitstream in software and send it bit by bit through some sort of parallel port (and I've wired a simple 8-bit latch).
Result: The 68k running at 8MHz didn't have horsepower to do the IDE access and send bit by bit clock by clock the bitstream. And to make things worst I wasn't using any kind of interrupts, so the bigger the buffer was, the longer the pauses were.
This is understandable because the cpu is not intended to do SPI with its 16-bit wide databus!
> FAIL <
Ideia number 2: Use the same setup but using the 'busy' pin from the mas3507d to interrupt the CPU for data.
Result: It worked... better, but not good! The main loop would just fill in the buffer while the interrupt routine dumped it to the mp3 board. It was almost smooth playing, but time to time I could hear the music stop. High bitrate mp3 (320kbps) still didn't play...
> FAIL <
Idea number 3: Send 1 or more bytes of data to 'something' that could serialize it and then send to the mp3 decoder.
Result: The 'something' was the big question mark. It could be a 8-bit shift register, clocked at some frequency, being fed by the 68k with some glue logic. But I wanted something that I had at that time in my junkyard, so I picked this little PIC16F84A and thought "this thing has enough pins for a 68k 8-bit data transfer plus 2 for spi and its fast enough to serialize the data!".
The connection was pretty simple: one pic interrupt pin for a write signal from the 68k, the 'busy' signal was directly connected to the 68k to request data and pic port B was used to receive the data from the 68k.
At that time I thought in wire up two 8-bit shift registers and have a 16-bit serial shifter (or use a PIC with more pins). Sending 16-bit at time would reduce in half the effort needed by the cpu to feed the data, but...
> SUCCESS <
But the full working system was already a monster (in size)... It was working good but it was way far from a portable mp3 player.
After some time playing around with this thing I had shifted away from my main goal so I decided to go back on track.
The main goal was to have a portable mp3 player and from what I had at that moment was failing in some important aspects: It was huge it was heavy and it was consuming lots of amp's!
Trying to figure a way to solve all of these issues I came up with some ideas:
- Get rid of the 68000 - Ended up using a 40pin PIC18F452. It had lots of IOs and I2C and SPI port.
- Get rid of the 3.5'' IDE harddisk - These disks need two power supplies: +12V and +5V. Final goal was to use a laptop harddisk that only require +5V. The interface is the same so when the time comes I could simple switch disks.
- Make everything smaller - The prototype mp3decoder board ended up being bigger than expected (well, its a prototype!).
- Add a display and some buttons!
So the ultimate goal was making a small board with the max size of a laptop harddisk.
And then I stated to develop the prototype board for the PIC18F455. The final board had the following specifications:
- PIC18F452 as main controller.
- 32Kb SRAM as buffer.
- 64Kb serial eeprom for settings and other stuff.
- RS232 port for firmware upgrade/development.
- LCD port (ended up using a 4x20 alphanumeric LCD)
- Infrared port (used an universal IR remote as controller, so there were only two push-buttons: reset and bootloader entry).
- 40 Pin Parallel ATA (IDE port)
- 8 bit expansion port.
- SPI and I2C connectors (to mp3decoder board)
- IR led, harddisk led
|Controller board prototype. Top connectors are: Power supply, power supply to mp3decoder board, SPI, I2C, RS232. Bottom left connectors are: expansion port, lcd connector and the IDE connector. (MAX232 is M.I.A.!)|
I coded everything up in C (IDE driver, FAT32 access functions, LCD driver and IR driver).
When I had the code practically finished, I placed everything in 'small' acrylic box.
That box was part of my car about 2 years in a row! At that time the first car mp3 CD players were becoming cheap, but why would one carry a bunch of CD's when all would fit in a single harddisk? It was something that caught attention and the remote control was something I really loved in it.
The good points were: huge capacity, fast and easy user interface (custom made!) and a sweet universal remote control.
There were also disadvantages, starting by the fact that when I needed to add music I had to connect the harddisk to the computer. The initial idea was to use that expansion port to to the transfer interface (possibly using the parallel port), but that never got completed.
In summary, the final board never got made... And I gave up also because flash memory prices were dropping fast, while available memory capacities were rising faster.
A few years later the mp3 players industry exploded! I ended up buying a car radio with a USB connector where I could just plug anything with mass storage...
|The full system connected. Almost 10 years later I've connected the player.|
|The systen boots, initializes the hard disk, LCD and MAS3507D but then it gets stuck in the "Loading settings"... I guess the serial eeprom is no more! What is also no more is the source code... where the hell did I store it?|
In the next post I'll talk about the other real big project where the 68000 was the king!