VS1003B Issue

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
picman
User
Posts: 3
Joined: Wed 2015-12-16 5:10

VS1003B Issue

Post by picman » Wed 2015-12-16 5:31

Hi, I am using the VS1003b on a new board. It is connected to a STM32F7, but I could not use the hardware SPI interface (all pins on the MPU are used) so I had to do a software SPI.

so.... I have written the registers on a reset and rewrite them before playing a file.

Code: Select all

while (READ_DREQ==0);
	VS1003B_WriteCMD(VS1053_REG_MODE, VS1053_MODE_SM_RESET| VS1053_MODE_SM_SDINEW    ); 
	vs1003b_delay(1000);
	while (READ_DREQ==0);
	VS1003B_WriteCMD(VS1053_REG_CLOCKF,0x9BE8); // set multi to 2.0X
	vs1003b_delay(1000);
	VS1003B_WriteCMD(VS1053_REG_VOLUME,0x1414); 
	vs1003b_delay(1000);
	VS1003B_WriteCMD(VS1053_REG_AUDATA,0xAC45); //0xac45
	vs1003b_delay(1000);
	VS1003B_WriteCMD(VS1053_REG_STATUS,0x0000); 
	vs1003b_delay(1000);
	VS1003B_WriteCMD(VS1053_REG_BASS,0x7af6); /* Bass/treble disabled */
	vs1003b_delay(1000);
and this is what I read back....

[0] MODE: 0x800
[1] STATUS: 0x30
[2] BASS: 0x7AF6
[3] CLOCKF: 0x9BE8
[4] DECODE TIME: 0x5
[5] AUDATA: 0xAC45
[6] WRAM: 0x0
[7] WRRAM_ADDR: 0x0
[8] HDAT0: 0x0
[9] HDAT1: 0x0
[a] AIADDR: 0x0
VOL: 0x1414
All good I think.
Now I send a test tone, and I can hear it....
Now I send an mp3... sometimes it starts to play, most times not.
If it starts to play then it will stop within 20 seconds at the most, with a repeating scratched record effect.



Code: Select all

uint8_t spi_transfer(uint8_t byte)
{
	uint8_t counter=8;				
	
	while(counter--)
	{
		if(byte & 0x80)
		{
			MOSI_HIGH;				
		}
		else
		{
			MOSI_LOW;			
		}
		byte	<<= 1;
		CLK_HIGH;			

		if(READ_MISO==GPIO_PIN_SET)				
		{
			byte |=1;
		}
		
		CLK_LOW;			
	}
	return byte;
}


This is my SPI routine, and it seems to work... Clock pol? if I swap the clock round it doesn't work.

I am loading into ram 3MB of an MP3 file (tried many dif files) then sending it to this function

Code: Select all

void vs1003b_play(uint8_t *data, uint32_t len)
{
	uint8_t *p;
	uint32_t i;
	uint32_t tt;
	p=&data[0];

	while(p <= &data[len - 1])
	{
		while(READ_DREQ==0)
		{

		}

		DCS_LOW; 
		for(i=0;i<32;i++)
			spi_transfer(*p++); 
    DCS_HIGH;
	}
}

Which then plays the audio, but stops with the stutters with out getting to the end of the buffer,
sometimes it plays at the wrong speed slow mainly, but some times it plays at the right speed then stops...

could not get a wav or midi file to play at all.


Has anyone had this problem.... HELP!!!

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

Re: VS1003B Issue

Post by pasi » Wed 2015-12-16 18:23

How fast is the software SPI?

Have you tried without writing SCI_BASS and using SC_CLOCKF=0x8000?

Have you measured CVDD, IOVDD and AVDD?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

picman
User
Posts: 3
Joined: Wed 2015-12-16 5:10

Re: VS1003B Issue

Post by picman » Thu 2015-12-17 17:14

Hi, thanks for the response, I checked all the voltages and made a silly mistake, both the CVDD and the AVDD are at 2.5V.
The main problem was reading the data from the SDCARD now fixed and it plays fine. :D
On the new prototype I will fit the 2.85V regulator I missed off for AVDD.

What problems can I expect running CVDD and AVDD at 2.5V?

Are there any example MIDI and wav files I can try?

One other thing, can I play single midi notes from the spi interface instead of the uart? if so is there any special commands to send to play the notes?

Many thanks

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

Re: VS1003B Issue

Post by Henrik » Fri 2015-12-18 12:58

Hello!

Others will have to help with the rest of your questions, but...
picman wrote:What problems can I expect running CVDD and AVDD at 2.5V?
CVDD at 2.5V is right at the recommended typical rating, so no problem there.

AVDD at 2.5V will almost certainly limit the maximum output current and probably also slightly limit the voltage range of the earphone output. So if you play very loud sounds, particularly with low-ohm earphones, you will end up with more noise and distortion than specifcied in the datasheet. Functionally I think everything should still be ok.

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

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

Re: VS1003B Issue

Post by pasi » Fri 2015-12-18 14:03

You may get occasional analog startup problems and reduced performance when AVDD is 2.5V, but the chip should still be functional. And 2.5V for CVDD is fine. So it does not really explain your issues.

MIDI files should be format 0 (converter source code is available). I have attached one test file.

You can start the Realtime MIDI mode using a small patch, then send the midi bytes through SDI as long as you send 0 before each midi byte. Effectively you will send 16-bit bytes.

See VS1003b/VS1033c/VS1053b Real-Time MIDI Input Application from http://www.vlsi.fi/en/support/software/ ... tions.html .
Attachments
1980mix421.mid
Format 0 MIDI file for testing
(131.31 KiB) Downloaded 65 times
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

picman
User
Posts: 3
Joined: Wed 2015-12-16 5:10

Re: VS1003B Issue

Post by picman » Sat 2015-12-19 1:02

To be safe I bolted on a VS1003 module that has its own regulators so it seems to work fine..

Now on to real-time midi ......

So I reset the chip, and doing a soft reset with the commands

[0] 0x0800 MODE:
[1] 0x0040 STATUS:
[2] 0x0000 BASS:
[3] 0x9800 CLOCKF:
[4] 0x0000 DECODE TIME:
[5] 0xAC44 AUDATA:
[8] 0x0000 HDAT0:
[9] 0x0000 HDAT1:
[a] 0x0000 AIADDR:
0x0000 VOL:
[c] 0x0000 AICTRL0:
[d] 0x0000 AICTRL1:
[e] 0x0000 AICTRL2:
[f] 0x0000 AICTRL3:

play the sine wave(works), reset it again for good luck, and upload the real-time midi patch.
registers now are..

[0] 0x4800 MODE:
[1] 0x0840 STATUS:
[2] 0x0000 BASS:
[3] 0xC000 CLOCKF:
[4] 0x0000 DECODE TIME:
[5] 0xAC44 AUDATA:
[8] 0x0000 HDAT0:
[9] 0x0000 HDAT1:
[a] 0x0000 AIADDR:
0x0303 VOL:
[c] 0x0000 AICTRL0:
[d] 0x0000 AICTRL1:
[e] 0x0000 AICTRL2:
[f] 0x0000 AICTRL3:

but if I then send the midi command 0x9000, 0x3e00, 0x4000 I hear nothing?
Also tried 0x0090 0x003e 0x0040
Voltages are fine and I can hear the sine wave on boot.Scope traces show what I am sending is correct, and I am waiting 400ms before sending the next note...

I have read all the midi problems on this site and tried most things but no luck getting sound from the midi.

I can play midi files, and mp3 and wav's ok...

Post Reply