Making new designs work with VS1011 / VS10xx

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2736
Joined: Tue 2010-06-22 13:43

Making new designs work with VS1011 / VS10xx

Post by Panu » Fri 2010-07-30 13:52

VS1011 is usually very easy to get working. But of course there can be some initial problems in getting the chip to play MP3 with a new PCB and microcontroller design for the very first time.

The problems our customers have experienced are usually quite similar. The usual remedies include:
  • Be very careful with the chip select signals!
  • Select NEW_MODE if it's possible.
  • Don't set "SHARED MODE" if you can connect both XCS and XDCS to your microcontoller.
  • Check that XCS and XDCS are never both "0" at the same time.
  • Check that your chip select signals remain low until the end of the last bit of the last byte of the transmission.
  • Measure XCS, XDCS, SCK, MOSI and DREQ signals with your oscilloscope.
  • Check that when DREQ is physically high or low, your microcontroller can reliably read the pin state. (To test this, pull the DREQ signal high and low on the PCB.) If not, check your microcontrollers GPIO states (data direction, gpio/periph mode, pullup/pulldown).
  • Start the software design by sending the Sine Test sequence with ALLOW_TESTS bit set in the MODE register.
  • Verify that GBUF/CBUF signal is at 1.25 volts.
  • Verify that you can hear a beep. Then send an MP3 file, just as you would send the sine test sequence. At this point you should hear music.
  • If your output is not directly connected to headphones, check that all external audio connections are ok and that any external multiplexers and external audio amplifiers are switched on.
  • If the music plays at the wrong speed, check the CLOCKF register value.
  • If the music is choppy or noisy, double check the XCS/XDCS signals. Also check the SPI bus speed. It should be less than 1/4 (1/6 for reading) of the chip clock.
  • Note that before setting the CLOCKF register clock doubler/multiplier the SPI bus speed must be less than 1/6 of your crystal clock.
  • If the playing mostly works, but sometimes there are failures, check that the clock polarity and phase at the SPI bus are correct.
We will continue to update this list based on your input.

Here's the reference code for doing the sine test:

Code: Select all

/** VS10xx Sine Test Function - Good getting started example */ 
void VsSineTest(){

  /* Reset MP3 chip */
  Mp3PutInReset();       /* Pull xRESET low -> hardware reset */
  Delay(100);            /* 100 ms delay */

  /* Send dummy SPI byte to initialize SPI bus of Atmel microcontroller */
  SPIPutCharWithoutWaiting(0xFF);

  /* Un-reset MP3 chip */
  Mp3DeselectControl();  /* Pull xCS high    */
  Mp3DeselectData();     /* Pull xDCS high   */
  Mp3ReleaseFromReset(); /* Pull xRESET high */
  Delay(100);            /* 100 ms delay     */

  /* VS10xx Application Notes, chapter 4.8 ---------------------------------*/
  /* As an example, let's write value 0x0820 to register 00 byte by byte    */
  Mp3SelectControl();    /* Pull XCS low, now SPI writes go to SCI port     */
  SPIPutChar(0x02);      /* Send SPI Byte, then wait for byte to be sent.   */
  SPIPutChar(0x00);      /* 0x02 was WRITE command, 0x00 is register number */
  SPIPutChar(0x08);      /* This byte goes to MSB                           */
  SPIPutChar(0x20);      /* ..and this is LSB. (0x20=Allow Test Mode)       */
  SPIWait();             /* Wait until Atmel MCU signals SPI write complete */
  Mp3DeselectControl();  /* Pull XCS high, now SPI writes don't go to SCI port. */

  while (!MP3_DREQ)      /* Wait for DREQ = 1                               */
    ; 			 /* Do nothing while waiting for DREQ = 1           */

  /* Send a Sine Test Header to Data port                                   */
  Mp3SelectData();       /* pull XDCS low, now SPI writes go to SDI port    */

  SPIPutChar(0x53);      /* - This is a special VLSI Solution test header - */
  SPIPutChar(0xef);      /* - that starts a sine sound. It's good for     - */
  SPIPutChar(0x6e);      /* - testing your code and the chip. */
  SPIPutChar(0x44);      
  SPIPutChar(0x00);      
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIWait();
  Mp3DeselectData();
  
  Delay (500);           /* 500 ms delay */

  /* Stop the sine test sound */
  Mp3SelectData();
  SPIPutChar(0x45);
  SPIPutChar(0x78);
  SPIPutChar(0x69);
  SPIPutChar(0x74);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIPutChar(0x00);
  SPIWait();
  Mp3DeselectData();

  Delay(500);            /* 500 ms delay */
}  

Please reply by telling us about your experiences in getting a VS10xx to work in your design!

Greets,
Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

sebishome
User
Posts: 1
Joined: Tue 2012-02-28 15:19

Re: Making new designs work with VS1011 / VS10xx

Post by sebishome » Tue 2012-02-28 15:23

I would add:
Make sure the GPIO0/SPIB line is pulled low, preferably via resistor. If you don't you will get inconsistent operation; it will work sometimes and not others.

Apart from that I agree it's a nice easy chip to set up and use.

User avatar
Panu
VLSI Staff. Currently on holiday.
Posts: 2736
Joined: Tue 2010-06-22 13:43

Re: Making new designs work with VS1011 / VS10xx

Post by Panu » Thu 2012-03-29 13:26

Good point. If GPIO0 is high, it will make a boot attempt (which involves toggling DREQ and a few other pins) which might confuse the microcontroller. And of course, if you have a boot eeprom connected, the loaded software can do whatever nasty stuff there happens to be in it...

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply