Proton BASIC Compiler - MP3 Player

  • Pic® Basic

  • MP3 Player

    My MP3 Player Project.

    Thanks for the guys that have given me good feedback on my project. A few years ago I had some time on my hands and wanted to build a MP3 player. At the time there were not many projects and I came across YAMP and others which used some dsp to exotic chips to play MP3 files. I came across VLSI on the internet who had a smart solution and I looked at this design and though it could work. Only problem is that they are in Finland and I was down under in Africa. I could order over the internet but the price was mmmmmmm pricey. Even the courier costs were high. So I left it for a while

    About 2 years ago I found the above module at a local parts importer and I bought one admittedly I blew up the first one and got a second one. Why did I get it? Simple it had everything in it I wanted.

    VLSI MP3 chip
    VINCULUM processor
    Audio ready
    Easy to work with
    Fat 32 stack built in
    USB stack built in
    Software freely available to hack
    Free C compiler with all libraries

    MP3 licence is built into chip. You pay for it when you purchase the chip.

    Although I am not to much of a C freak I have not played with the C libraries. I am a Proton freak and insanely enjoy working with it. I show you step for step on how to get this unit going and how you can build a simple micro circuit to get it going as a stand alone unit.

    The audio section accepts a normal headset or earphones and with the advent of all the stand alone speakers for the Ipods and others they work very well with this unit.

    OK so what about the sound quality. To be honest I never wanted to go into audio. I suffer from tinnitus and have a 5% loss in one ear. Tinnitus is a hearing problem. You keep hearing Christmas Beatles singing in you ears permanently. One doctor told me that its like feedback in a amplifier. Sound out of the speakers and returns through mike and then the squeal. Anyway back to the project.

    I found the sound quality to be superb. Connecting it to a Hi-Fi gave very good results. Even if you have saved your MP3's to 320kbs. If you know how to use the unit you can set the bass and treble manually through registers in the VLSI chip. With the C compiler you can add a few little ad ons like a equalizer on a LCD display, low battery indicator ect.

    I started by first trying to get the unit interfaced to my pc so I could see all the commands that are in use. I really struggled for a while.

    I am not going to include common diagrams as I am sure that you can build them yourself. I first built a MAX232 interface. Here is one tip: connect cts to gnd.

    I decided to opt for the rs232 connection as I found it easier to work with. The unit in factory default settings runs at 9600 baud. You can change it to run at a higher lower speed. In fact there is a utility that you can run to change some default settings, save the file, and reload the firmware.
    I found a document that shows the settings for hyper terminal. So after building the max232 interface and connecting it up to the pc you run hyper terminal and set it up as follows.

    Now its time to run through that mighty manual what commands do you give this unit to get it playing. First of all of course you need some mp3's on a usb stick. Copy a few songs onto your usb drive and plug it into the unit. Give it 5 seconds to find the files ad then load up hyper terminal. You can enter E and it should echo back. When you switch on it will show the firmware version and a prompt. Now and enter the following commands:



    If you have a speaker connected you will hear the song.

    Above you can see all the commands the monitor accepts. There is no long file names so when it looks at the files it will add its own file names. The centre column is the hexadecimal numbers if you have chosen binary mode. The first column is the ASCII input and the arrow shows carriage return.
    The volume is weird. They have made it so that 0 is full volume and 255 is off. As always CHECK THE MANUAL.

    OK a quick tip here. When you purchase your unit it might have old firmware in it. The latest (and I think the last one) is 3.68. When you insert the memory stick it will first flash a red colour then green and the flicker green and green stays on. The earlier firmware did not do it and I thought my unit was faulty until I got the unit going. Eh how do you change the firmware. Oh easy. There are two ways. You can get the firmware off the website and rename it as in the manual says put it on the usb stick and it will update it itself.

    If you mess up like me did. You can get the programmer software off the site and manually program it. The nice thing is you cant mess up. It has a permanently loaded common boot loader and you can just reprogram through the serial port and oh yes there is a small jumper on board in the box next to the USB socket which you have to set first and restore when finished.

    You can also use the few dos commands that is embedded like dir. This will list all songs on the memory stick. Have a look at the manual and see what it capable of. I am not going to go much into the DOS commands as to say they are cool. My only gripe is of course long file names. As we know this is a copyright issue and nobody can use it till the court case is over with Microsoft.

    MP3 Tags:
    What is a mp3 tag? It is information embedded in the mp3 file like the song name, singer, album, genre and much more. VMUSIC2 will churn out the tag info but just a few lines. According to the tag guys the tag info can be up to 256 characters per line and I am not sure as to how many lines can be embedded. The following information will be displayed

    OK we are not finished. I started play the music and got weird stuff to nothing. Remember when ripping a MP3 to go onto the internet so that your program can get the names from the available databases. I will rip my CD's with windows media player because I am used to it. Go on the internet insert the CD program gets info, rips and saves to hard drive. easy as that.

    OK so what about the songs on my hard drive that don’t have names. I have ROXIO suite and in it it has a song rename or id3 tag edit program. This program uses Gracenote database. Gracenote has technology that if it cannot find the name of the song it will play the song and try and identify it that way. There are many programs on the internet that will edit your tag info but beware. Different formats work differently and store the info differently. So be care full how you do it and if you do not get it right try a different program. Most programs will find the album cover for you to and embed it in the song.

    Here again I am not going into much detail. If you use PROTON then you will be capable of building your own dev board. My first attempt was as PIC18F452 because I used tact switches for the commands. I ran out of pins very quickly. My next board was an PIC16F877 which used one 8 pin port using the software keypad routine. You can use any screen you like but I found a nice white on blue screen that uses the TA6963 chip set. Of course I used a boot loader so I could write and upload directly. I built my board using vero board but if you have the resources I would strongly recommend you go to PCB layout way. I don’t know but after playing around with this project I find the 16F877 to be better than the 18F452. Both chips running 20mhz. The response of the chip was much faster and I could feel there was something different between the two. Just my 2c worth.
    Connecting the VMUSIC2 to the pic is simple, run the tx of the module to rx on the PIC and rx of the module to tx on the PIC and remember to connect the CTS pin to ground. When I want to program the PIC I just unplug the module and when finished I plug it back and test.
    I discovered that the PIC18F452 has a pin that can be used for low battery indicator and can be used to switch the unit off.

    Using a graphical screen you can make a nice picture and display it at start up.
    It so simple. Set up the software to run a serial port at 9600.
    When you issue a command you will code it:


    As simple as that. You add the \r as a carriage return. When you want to read its

    HSerIn 200,err1,[Wait("T $"),Hex2 hold2]

    This is the command to read the seconds. Wait for the T space $ then read the next number which is a hex number. Convert to decimal and print. Remember there is a high byte and a low byte which must be combined. If it does not read it within 200 milliseconds it will jump to error routine.

    This should give you a rough idea how to code the software. My code is such a mess Ill be ashamed to show you BUT it works the way I want it and I think that is important. One day Ill fix up all my self made bugs and do a proper program.

    If anyone wants to help make a nice menu system they are welcome to share it with me.

    As you can see I learnt a lot about MP3 doing this project and it was fun. Not to mention the hundreds of hours I spent on the net researching MP3, ID tag info and lots more. Proton has made really simple and EASY to work with this unit. Thanks to Crownhill and Les for a superb compiler.

    Watch for my next tutorial.

    Copyright of all manufacturers and owners are acknowledged.