Here is an example code for a microcontroller and a VS1003B chip, which says "Hello" repeatedly on the VS1003B. For easy compiling, this is a single .c file, which contains all the necessary definitions, except register definitions of the AT89C51ED2/RD2 microcontroller, to which this is targeted. The "Hello" word comes from a small bitrate MP3 file, which is included as an array of 1695 bytes.

Now, all the microcontroller specific stuff is in the beginning (mostly SPI transfer functions) so it should be quite easy to port to other microcontrollers. This one was written for the SDCC compiler, which uses the "code" reserved word to put arrays in the code ROM. Your compiler is probably different.

This code is free for use for all purposes with one requirement: If you succesfully port this code to another microcontroller, you are honor-bound to reply to this post and attach your code!

Looking forward to hearing about you success!...

-Panu

P.S. - For VS1011, change the CLOCKF value to 0x9800.- For VS1053, change the CLOCKF value to 0x8800, and please check from the datasheet of VS1053 for the procedures about what is the proper way to send data to VS1053.

Hi! Here's another version of the audible hello, this time for a generic 8051 microcontroller (no hardware SPI port). It works for example with AT89C4051 so it should work with just about any 8051 microcontroller.

This code makes a simple software SPI port and sends the SCI commands and SDI data with it. Note that the software SPI port is not fast enough to send high bitrate MP3, but it is useful for configuring the VS1053 and testing.

Edit: There is a bug in the software SPI Port function "SpiTransfer()" in the "hello.c" file!! Data input (register reads) give incorrect values with the way the function was written. The correct way is:

Hi, there. I just brought up a Sparkfun VS1033D board (BOB-08792) last night on Arduino. Thanks to Panu and Rui for the hello world code, which provided an excellent reference when troubleshooting my own.

One thing I would recommend for Rui is to clean up "SPIWait". In Panu's example, it waits for the SPI transfer to complete, which is necessary because SPDAT=(c) is non-blocking. On Arduino, SPI.transfer() blocks on SPSR.SPIF, so no further waiting is needed. Since these are the best getting-started examples out there, it will help to have them as clean as possible for other people learning this hardware.

As an aside, I am affected by the elsewhere-documented problems with the floating TEST pin with this board, so I have to work around a flaky DREQ signal. For CBR MP3 streams, I manage the delay manually based on bitrate, which is good enough to make plenty of progress. I am going to ask Sparkfun to make the blue-wire fix themselves and send me a replacement. We'll see how that goes!

So, I've tried this code on both the breakout board from sparkfun like jc00 and a breakout board from MDFly.com (which has the XTest pulled high and all GPIOs pulled low) connected to an arduino. Both boards perform the same. They both just beep over and over again. Any ideas? I suppose it could just be zipping through the array if it never sees the DREQ pin go low but not sure why it wouldn't. I'm planning on taking my circuit to work tomorrow to see what the o-scope says but just wanted to see if you all had any thoughts being the masters that you are .

FYI, I'm using the arduino in 5V mode, I have translated the voltage to 3.3V on the MISO, CLK, CS, and DCS pins using voltage divider. I have checked my wiring so many times but I just cannot make either board perform. Even sine test is splotchy (takes a long time to turn on).