Microcontroller examples for VS1063, VS1053, VS1003, VS1011

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
User avatar
Henrik
VLSI Staff
Posts: 1041
Joined: Tue 2010-06-22 14:10

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1

Post by Henrik » Fri 2015-11-27 11:51

Hello Virag!

It sounds that you are very close to a working system! Getting SCI register writes and reads working, and getting the sine test working tells you seem to have many things correct.
viragdoshi wrote:Then I tried to play several mp3 and a couple of wmv files. The wmv file did not produce any output at all, and in case of the mp3 file, the output was a distorted version of the original track.
I would be extremely grateful if someone could please help me debugging the said problem.
Check the following things (in approximate order of likelihood):
1) Check that you don't have the old, incorrect SparkFun board where XTEST is floating. It must be connected to IOVDD.
2) Check that you respect DREQ. When DREQ is high you may send from upto 32 bytes of data before checking it again. Never send more than 32 bytes without rechecking DREQ.
3) Check that you send the correct amount of data. Check that your pointer arithmetic is correct. It is very easy to accidentally send half or double the amount of data, or from a slightly incorrect place.
4) Check that your SPI clock polarity is correct: send data on the falling clock edge, VS10xx reads data on the rising edge by default.
5) Check that your writes to the SDI bus don't accidentally go to the SCI bus.

If you are still having trouble after checking these, I'd appreciate oscilloscope pictures of the SDI bus when sending data, including clock, data, and DREQ signals. Those very often help us to solve the issue.

Kind regards,
- Henrik
Good signatures never die. They just fade away.

viragdoshi
User
Posts: 3
Joined: Thu 2015-11-26 2:48

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1

Post by viragdoshi » Fri 2015-11-27 12:34

Hi, Henrik,

Thanks a lot for your prompt reply. It seems that I misinterpreted the datasheet, and was writing data at the rising edge of the clock cycle. Once I corrected the said error, the module worked like a charm.

Thanks a lot,
Virag

User avatar
Henrik
VLSI Staff
Posts: 1041
Joined: Tue 2010-06-22 14:10

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1

Post by Henrik » Fri 2015-11-27 13:48

viragdoshi wrote:Thanks a lot for your prompt reply. It seems that I misinterpreted the datasheet, and was writing data at the rising edge of the clock cycle. Once I corrected the said error, the module worked like a charm.
Good job! I knew you were close to a working system!

Can you tell us what exactly in the datasheet threw you off? If there are ambiguities we'd like to hear of them for future updates.

Kind regards,
- Henrik
Good signatures never die. They just fade away.

viragdoshi
User
Posts: 3
Joined: Thu 2015-11-26 2:48

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1

Post by viragdoshi » Sat 2015-11-28 1:24

Hi Henrik,

I went back to the datasheet, turns out, there was no ambiguity in the way that it was written.

I don't quite recall, but perhaps I read the description for SO, instead of SI.

Thanking you,
Virag

fgomes
User
Posts: 9
Joined: Mon 2016-01-11 15:53

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1

Post by fgomes » Mon 2016-01-11 16:10

Hi, I have the VS1053 working with the ESP8266 MCU to play web radio streams. This is my first project with this chip. It works great, but from time to time the sound changes, and stays very high and with a high level of distortion. I'm only sending the stream to the VS1053 chip, not commands, I just send commands in the beginning, to configure it.
I've noticed that when it changes to that high distortion state, if I read the registers it has some strange values, for example the SCI_STATUS register is typically zero in this situation while normally it is 0x40! I've made a detection algorithm that periodically reads SCI_STATUS and if it is zero it resets the chip and reprogram it, this works but it is unpleasant, since I still hear a loud noise before the detection algorithm detects the problem (I'm running it once per second). Any idea of why this happens? It seams to me that it occurs more frequently with some AAC streaming stations then with MP3 streaming stations - for example with this station it occurs every few seconds: 192.152.23.24:8450 - AAC 64kbps.

Any help would be appreciated! :-)

Best regards

Fernando

User avatar
Panu
VLSI Staff
Posts: 2418
Joined: Tue 2010-06-22 13:43

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1

Post by Panu » Mon 2016-01-18 10:55

Hi and welcome to the Forum!

I think the root cause is that the VS1053 receives something that is not valid stream. This can be due to a bit error somewhere in the transmission or in the SPI bus. Please see the "MCU Howto" link below to see if you notice anything that you do differently than what is suggested there.

Another possibility is that the station sends metadata additionally to the stream. For example, do you parse, handle and remove ICY-Metadata? Shoutcast and Icecast use it to send song names etc.

-Panu

PS. Please post your questions as separate threads. Someone will move this into a separate thread soon.
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

dawidos145
User
Posts: 10
Joined: Mon 2016-11-07 21:34

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1011

Post by dawidos145 » Tue 2016-11-08 20:05

Hi Panu, and everyone, i have still problem with write some function to playMp3 file from my sd card. On this moment i read file in main function. I use FATFS chan. SD card and vs1011 are they on the same spi line, but another CS pin.
on this moment i have function wich read file from array, but is to small and i hear only some second.
I dont know how i can read file and play long mp3.

This is my function for play file from array, can someone help me to write another function ? i don`t have idea...

Code: Select all

int SendStreamForDecode(u_int8 * pStream,u_int32 streamSize)
{
    u_int32 i,j,k,m;

    j = streamSize / 32;
    m = 0;

    for ( i = 0; i <= j; i++ )
    {
            for (k=0; k < 32; k++)
            {
            	while (DREQ_EQUAL_ZERO);
            	SPIPutChar(pStream[m]);
            	m++;
            }
    }

    while (m < streamSize)
    {
    	while (DREQ_EQUAL_ZERO);
    	SPIPutChar(pStream[m]);
        m++;
    }



	return 0; // Ok
}
heare is SPIputchar functin

Code: Select all

uint8_t SPIPutChar(uint8_t outB){

	u8 Data = 0;
          /* Wait if TXE cleared, Tx FIFO is full. */
           while ((SPI2->SR & SPI_SR_TXE) == 0);
           SPI2->DR = outB;
           /* Wait if RNE cleared, Rx FIFO is empty. */
           while ((SPI2->SR & SPI_SR_RXNE) == 0);
       	   Data = SPI2->DR;
           return Data;
}

User avatar
Panu
VLSI Staff
Posts: 2418
Joined: Tue 2010-06-22 13:43

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1011

Post by Panu » Tue 2016-11-08 20:14

Hi!

Henrik and I are both at the electronica 2016 fair in Munchen for the week, so we can't visit the forum or do much debugging this week.

Just a quick check, although we've probably discussed this before: do you use SHARED_MODE?

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

User avatar
Henrik
VLSI Staff
Posts: 1041
Joined: Tue 2010-06-22 14:10

Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1011

Post by Henrik » Thu 2016-11-17 14:20

Hello dawidos,

let's continue this discussion in this thread:
viewtopic.php?f=11&t=2014

Kind regards,
- Henrik
Good signatures never die. They just fade away.

Post Reply

Who is online

Users browsing this forum: No registered users