VS1053 BOB V4 SPI interface not Working.

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
Arun Joe
Senior User
Posts: 24
Joined: Sat 2017-04-22 9:01

VS1053 BOB V4 SPI interface not Working.

Post by Arun Joe » Mon 2017-05-22 15:28

Hi,
I'm trying to interface the VS1053 Bob v4 https://cdn-learn.adafruit.com/download ... torial.pdf form adafruit with my stm32l4 controller.
Mode 0 of SPI interface is used and when I try to read form the SCI_MODE (RW) register, I get only zeroes.
I verified the Sclk and MOSI with the CRO and it all works perfectly.
What could be going wrong? The connected pins includes, VCC to 3.3V,Gnd,MOSI,MISO,CS,DREQ.

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

Re: VS1053 BOB V4 SPI interface not Working.

Post by pasi » Mon 2017-05-22 15:40

Generally: xTEST should be pulled high (or connected to IOVDD). xRESET should be high, XTALI / XTALO should get clock for the chip to leave reset state. Possibly xDCS should be high.

On the Adafruit board RST should be high. Also, you should probably connect SCLK too...
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Arun Joe
Senior User
Posts: 24
Joined: Sat 2017-04-22 9:01

Re: VS1053 BOB V4 SPI interface not Working.

Post by Arun Joe » Mon 2017-05-22 16:15

Hi,
Thank You , I pulled RST high and it is working .
Sclk was connected previously(Sorry that I missed it).

Arun Joe
Senior User
Posts: 24
Joined: Sat 2017-04-22 9:01

Re: VS1053 BOB V4 SPI interface not Working.

Post by Arun Joe » Tue 2017-05-23 10:43

Hi,
Got a new issue now,
I'm trying for Wave PCM recording as described in http://www.vlsi.fi/fileadmin/software/V ... corder.pdf
Below give is the initialization code used,I'm able to write and read back correct values form the registers whereas the DREQ pin do not show any
transition in the oscilloscope and the recording is not starting(HADAT1 = 0 always) .
I do not use level metering , the reason why corresponding lines are commented.

Code: Select all

#ifdef WAVE_PCM_STEREO_RECORDING		
	
		SS_WriteVS1053_Register(VS1053_MODE,0x0804);//Clear SM_ADPCM form Mode0 Register	
		HAL_Delay(2);
	        ReadVal = SS_ReadVS1053_Register(0x00);
		
		SS_WriteVS1053_Register(VS1053_CLOCKF,0xC000);//Increase the clock frequency
		HAL_Delay(2);	
		SS_SPI_ReInit_HighClk();//Reinitialize the spi cloc ot higher clock rate 5 Mhz
		HAL_Delay(2);
		
		SS_WriteVS1053_Register(VS1053_BASS,0x0000);//Set BASS reg to 0
		SS_WriteVS1053_Register(VS1053_AIADDR,0x0000);//Set AI Addr to 0 to stop any previously running app
		SS_WriteVS1053_Register(VS1053_WRAMADDR,0xC01A);//Disable any interrupt
		SS_WriteVS1053_Register(VS1053_WRAM,0x0002);//Disable any interrupt		
		
		LoadVS1053bPlug_in(PCM_48S);//Load the patch 1800
		
		SS_WriteVS1053_Register(VS1053_MODE,RCEORDING_ADPCM);//start Recording in adpcm mode		
		SS_WriteVS1053_Register(VS1053_AICTRL1,1024);//maximum signal level setting
		SS_WriteVS1053_Register(VS1053_AICTRL2,0);//Auto gain Off
	
		//SS_WriteVS1053_Register(VS1053_MODE,RCEORDING_ADPCM|STEREO_RECORDING);//level metering in stereo	
		//SS_WriteVS1053_Register(VS1053_AICTRL0,0x8080);//level metering in stereo
		//HAL_Delay(2);
		
		SS_WriteVS1053_Register(VS1053_AICTRL3,0);
		SS_WriteVS1053_Register(VS1053_AIADDR,0x0034);//Begin Recording
	
	while(HAL_GPIO_ReadPin(SS_DREQ_GPIO_PORT,SS_DREQ_PIN) != GPIO_PIN_SET); //poll for DREQ High
       Recording =TRUE;
#endif //WAVE_PCM_STEREO_RECORDING
What could be possibly going wrong?

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

Re: VS1053 BOB V4 SPI interface not Working.

Post by Henrik » Tue 2017-05-23 14:10

Hello!

After you write 0x34 to SCI_AIADDR, what value do you get if you read registers SCI_MODE (0), and SCI_STATUS (1)?

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

Arun Joe
Senior User
Posts: 24
Joined: Sat 2017-04-22 9:01

Re: VS1053 BOB V4 SPI interface not Working.

Post by Arun Joe » Tue 2017-05-23 14:55

Hi,
The values in registers after 0x0034 is loaded to SCI_AIADDR are
SCI_MODE (0) = 0x1800
SCI_STATUS (1) = 0x0048

Regards,
Joe

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

Re: VS1053 BOB V4 SPI interface not Working.

Post by Henrik » Tue 2017-05-23 15:10

Hello Joe!
Arun Joe wrote:Hi,
The values in registers after 0x0034 is loaded to SCI_AIADDR are
SCI_MODE (0) = 0x1800
SCI_STATUS (1) = 0x0048
SCI_MODE looks good, but SCI_STATUS does not. Bit 3 should be clear. What I think is that you start loading the code, or, to be precise, disable interrupts so quickly after boot that the VS1053 firmware hasn't yet had time to turn analog drivers fully on. Try writing 0x0040 to SCI_STATUS right after the two "Disable any interrupt" lines, and see whether that helps.

EDIT: Maybe that's not the reason after all. I verified from the source code that the bit should be cleared by the software. Could you first write 0x34 to SCI_AIADDR, then wait for at least one millisecond, then read contents of SCI_AIADDR back? If the value is 0, then the software has started because it clears the register. If you still read 0x0034, then I think that your LoadPlugin() implementation might be broken, or perhaps SPI communication is unreliable.

Kind regards,
- Henrik

PS. My 1033rd message. When released, VS1033 added AAC-LC and General Midi as new audio formats, as well as EarSpeaker spatial processing to the functionality of the hugely popular VS1003.
Good signatures never die. They just fade away.

Arun Joe
Senior User
Posts: 24
Joined: Sat 2017-04-22 9:01

Re: VS1053 BOB V4 SPI interface not Working.

Post by Arun Joe » Wed 2017-05-24 10:09

Hi ,
I followed the first method you suggested
SCI_MODE looks good, but SCI_STATUS does not. Bit 3 should be clear. What I think is that you start loading the code, or, to be precise, disable interrupts so quickly after boot that the VS1053 firmware hasn't yet had time to turn analog drivers fully on. Try writing 0x0040 to SCI_STATUS right after the two "Disable any interrupt" lines, and see whether that helps.

and I'm getting 0x0041 in SCI_STATUS (1).
The recording is also happening, I captured the recorded values to a file(in PC) and found the valid Wave header there with chunk size values that
has to be edited as per the size of the file.

Code: Select all

RIFF´J  WAVEfmt   €» î data²J  
I calculated the size with the file size and replaced those characters with the ASCII equivalent and LSB first and saved the file with .wav
extension on my PC. When I play it, I hear nothing but a creaky sound for few seconds.
The mic circuit I made is from page 26 of adafruit tutorial.https://cdn-learn.adafruit.com/download ... torial.pdf
How do you suggest me to proceed now?

Regards,
Joe

Arun Joe
Senior User
Posts: 24
Joined: Sat 2017-04-22 9:01

Re: VS1053 BOB V4 SPI interface not Working.

Post by Arun Joe » Wed 2017-05-24 12:59

Hi ,
I have also tried the second method and the value that comes up on SCI_AIADDR is 0 and SCI_MODE (0) = 0x1800
SCI_STATUS (1) = 0x0041.
I read only 512 byte at a time and the recording time is for 3 minutes whereas I hear audio for only few seconds that too some creaky sound.
Is it because the data is not read fast enough?
Regards,
Joe

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

Re: VS1053 BOB V4 SPI interface not Working.

Post by pasi » Fri 2017-05-26 10:28

Can you send an example recording?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply

Who is online

Users browsing this forum: Bing [Bot]