VS1053 playback speed is too fast

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
b.borisov
User
Posts: 3
Joined: Sat 2015-11-21 20:17

VS1053 playback speed is too fast

Post by b.borisov » Sat 2015-11-21 20:40

Hello,

I use in my project VS1053 for playing MP3 files. The problem is that when I play a file the play speed is faster than normal and the audio sounds bad.
The file is read from SD card, with a chunk size 512b. After that I send these 512 bytes to VS1053 using 32bytes blocks.
I noticed that if I put ~4ms delay after the whole 512b block is sent to VS1053 and before the next reading from SD, the sound is better, but still with some noise.
I've checked that DREQ is handled correctly(when VS1053 sets it to low the MCU stops sending).
More details about the configuration:
->Stream mode is not activated (SM_STREAM is set to 0).
->SPI clock is 4MHz.
->SM_SDINEW=1
->SM_SDISHARE=1
-> External oscillator is 12MHz

Do you any idea what I'm doing wrong?

b.borisov
User
Posts: 3
Joined: Sat 2015-11-21 20:17

VS1053 playback speed is too fast

Post by b.borisov » Sat 2015-11-21 20:43

Hello,

I use in my project VS1053 for playing MP3 files. The problem is that when I play a file the play speed is faster than normal and the audio sounds bad.
The file is read from SD card, with a chunk size 512b. After that I send these 512 bytes to VS1053 using 32bytes blocks.
I noticed that if I put ~4ms delay after the whole 512b block is sent to VS1053 and before the next reading from SD, the sound is better, but still with some noise.
I've checked that DREQ is handled correctly(when VS1053 sets it to low the MCU stops sending).
More details about the configuration:
->Stream mode is not activated (SM_STREAM is set to 0).
->SPI clock is 4MHz.
->SM_SDINEW=1
->SM_SDISHARE=1
-> External oscillator is 12MHz

Do you any idea what I'm doing wrong?

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

Re: VS1053 playback speed is too fast

Post by Panu » Sun 2015-11-22 9:03

This is caused by the VS1053 skipping chunks due to bad data. You probably have some bug in SPI signaling, the chip selects or handling of the DREQ signal. Please check the link "MCU Howto" below.

You say that you are using the SHAREd chip select mode. Are you really sure you want to do that?


-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
pasi
VLSI Staff
Posts: 1457
Joined: Thu 2010-07-15 16:04

Re: VS1053 playback speed is too fast

Post by pasi » Mon 2015-11-23 17:58

Check that you are not changing the chip select signals while the SPI is still transmitting.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

b.borisov
User
Posts: 3
Joined: Sat 2015-11-21 20:17

Re: VS1053 playback speed is too fast

Post by b.borisov » Thu 2015-11-26 13:27

Hello,

thanks a lot for your answers. The problem is solved. Panu was right, I had a bug in my SPI driver and DREQ handling and because of this I was sending bytes to VS1053 in spite of DREQ was set to low.

I really appreciate you expert advises!

bianchi
Senior User
Posts: 245
Joined: Mon 2013-12-30 4:15

Re: VS1053 playback speed is too fast

Post by bianchi » Tue 2016-01-05 0:13

Do you mind if I see your Init code ?
I tried to make "hello" and sine test, but it gave me "tuck" tuck tuck only...
I use ATMEGA128...I reuse my init code from VS1003

Code: Select all

unsigned char VS1003B_Init()
{
	unsigned char retry;
	PORT_INI();
	PORT_DREQ();
	//VS1003B_DDR &=~_BV(VS1003B_DREQ);
	//VS1003B_DDR =(0<<VS1003B_DREQ);
	VS1003B_XCS_H();
	VS1003B_XDCS_H();
	VS1003B_XRESET_L();
	_delay_ms(20);
	VS1003B_XRESET_H();//ʹÄÜоƬ	//chip select
	VS1003B_SPI_Low();//ÏÈÒÔµÍƵ²Ù×÷	//low speed
	_delay_ms(20);//ÑÓʱ	//delay
	
	
    usart_pstr("VS1003B_Init function ! \n");	
	retry=0;
	
	
	
	
	while(VS1003B_ReadCMD(SCI_CLOCKF) != CLOCK_REG)//дʱÖӼĴæÆ÷	//set PLL register
	{
		
		
		
		VS1003B_WriteCMD(SCI_CLOCKF,CLOCK_REG);
		if(retry++ >100 )return 1;
		// usart_pstr("VS1003B_ReadCMD(0x03) != CLOCK_REG \n");
		_delay_ms(20);
	}
	
	
	
	VS1003B_WriteCMD(SCI_AUDATA,0x000a);
	VS1003B_WriteCMD(SCI_AUDATA,0xac45);
	
	retry=0;
	while(VS1003B_ReadCMD(SCI_VOL) != 0xfefe)//ÉèÒôÁ¿	//set Volume
	{
		VS1003B_WriteCMD(SCI_VOL,0xfefe);
		if(retry++ >100 )return 1;
		
	}

	//VS1003B_WriteCMD(SCI_AUDATA,0xac45);
	VS1003B_WriteCMD(SCI_AUDATA,0x3164);

	retry=0;
	while(VS1003B_ReadCMD(SCI_VOL) != DefaultVolume)//ÉèÒôÁ¿	//set Volume
	{
		VS1003B_WriteCMD(SCI_VOL,DefaultVolume);
		if(retry++ >100 )return 1;
	}
	VS1003B_WriteCMD(SCI_BASS,0x0800);//Bass treble off

	retry=0;
	while(VS1003B_ReadCMD(SCI_MODE) != 0x0820)//дmode¼Ä´æÆ÷	//set mode register
	{
		VS1003B_WriteCMD(SCI_MODE,0x0820);
		if(retry++ >100 )return 1;//
	}

	_delay_ms(20);

	VS1003B_SoftReset();

	_delay_ms(20);

	VS1003B_SPI_High();
	
	return 0;
}
Anything I miss here ?
Thanks

joonseo05
User
Posts: 1
Joined: Tue 2017-09-26 8:50

Re: VS1053 playback speed is too fast

Post by joonseo05 » Tue 2017-09-26 8:54

i bought 2 vs1053 and one is working fine but has too much noise, and the other one doesnt have any noise but it plays the song too fast so it sounds like noise.. what am i doing wrong? i used same sd card and same mp3 files and same code by example "fileplayer"

User avatar
pasi
VLSI Staff
Posts: 1457
Joined: Thu 2010-07-15 16:04

Re: VS1053 playback speed is too fast

Post by pasi » Tue 2017-09-26 12:10

Check the soldering.

Playing too fast could be an issue with the DREQ signal, or maybe xTEST is floating (should be pulled high to IOVDD).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply