Microcontroller examples for VS1073, VS1063, VS1053, VS1003, VS1011
Microcontroller examples for VS1073, VS1063, VS1053, VS1003, VS1011
It gives me great pleasure to annouce that we have prepared examples of generic microcontroller code that shows how to control four of our slave ICs. The codes show how to play back and record sound with VS1073, VS1063, VS1053 (and VS8053), VS1003 or VS1011 as the slave processor.
The four examples are available at VLSI's Microcontroller Source Code Example page
http://www.vlsi.fi/en/support/software/ ... tware.html.
Individual package links are below:
VS1073: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1063: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1053: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1003: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1011: https://www.vlsi.fi/fileadmin/app_notes ... n_play.zip
We hope these examples will help people to more easily get in touch with our ICs, and particularly the special situations where file transfers are interrupted etc.
Kind regards,
- Henrik
[Edit 2025-04-04: VS1073 added to the list.]
[Edit 2025-04-04: Added direct links to all examples]
The four examples are available at VLSI's Microcontroller Source Code Example page
http://www.vlsi.fi/en/support/software/ ... tware.html.
Individual package links are below:
VS1073: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1063: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1053: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1003: https://www.vlsi.fi/fileadmin/app_notes ... layrec.zip
VS1011: https://www.vlsi.fi/fileadmin/app_notes ... n_play.zip
We hope these examples will help people to more easily get in touch with our ICs, and particularly the special situations where file transfers are interrupted etc.
Kind regards,
- Henrik
[Edit 2025-04-04: VS1073 added to the list.]
[Edit 2025-04-04: Added direct links to all examples]
Good signatures never die. They just fade away.
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
For me personally, those examples were very helpful. Why is "vs10xx_uc.h" not used for software development but only for microcontroller development?
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Hi,
I am working on VS1053 mp3 codec IC.
So, What is motto, i have to fetch MP3 data from SD card and have to fed to the VS1053b using Micro controller.
Still what i have done, i have intefaced SD card and vs1053 with MCU of TI MSP430FG439.
I got success to listen sine test.
It works properly at different frequencies.
Main Issues :: could not play song on vs1053..
First, i have gone through datasheet and I followed steps what you have mentioned in that.
Even i didn't get output. Then I followed steps which are mentioned in the FAQ.
I played with clock register and spi clock .. but again i get disappointed.
I have implemented code as per datasheet and FAQ check points. I have also debugged code step by step.
Even every function works properly, there is no output.
I have one doubt, what i am doing, i have taken a buffer of 512 bytes containing random numbers. This bytes is transmitted through SDI interfacing. What i am thinking by doing this i will get some noise or any garbage sound at the end of ear speaker. Is it correct way to debug...?
Or for debugging i have to transmit only audio data ..?
Here i am attaching code which i have implemented for VS1053.
i want your guidance to troubleshoot the issue ...
THANK YOU..
CHETAN
I am working on VS1053 mp3 codec IC.
So, What is motto, i have to fetch MP3 data from SD card and have to fed to the VS1053b using Micro controller.
Still what i have done, i have intefaced SD card and vs1053 with MCU of TI MSP430FG439.
I got success to listen sine test.

Main Issues :: could not play song on vs1053..

First, i have gone through datasheet and I followed steps what you have mentioned in that.
Even i didn't get output. Then I followed steps which are mentioned in the FAQ.
I played with clock register and spi clock .. but again i get disappointed.

I have implemented code as per datasheet and FAQ check points. I have also debugged code step by step.
Even every function works properly, there is no output.
I have one doubt, what i am doing, i have taken a buffer of 512 bytes containing random numbers. This bytes is transmitted through SDI interfacing. What i am thinking by doing this i will get some noise or any garbage sound at the end of ear speaker. Is it correct way to debug...?
Or for debugging i have to transmit only audio data ..?
Here i am attaching code which i have implemented for VS1053.
i want your guidance to troubleshoot the issue ...
THANK YOU..

CHETAN
Code: Select all
////////////////////////////////// CODE ////////////////////////////////////
/*
* Description ::
* This code is implemented for interfacing of vs1053 with MSP430 MCU.
*
*/
#include <msp430xG43x.h>
#include "spi.h"
#include "system.h"
#include "sd.h"
#include "type.h"
#include "vs1053_mp3.h"
unsigned int i,j;
// Following buffer containg data which is fetched from sd card (card containing mp3 files) and is stored in // buffer
// This bytes has to transmit to the vs1053.
uint8_t Buff[512]={
255,
255,
255,
254,
210,
127,
249,
178,
41,
236,
169,
190,
110,
177,
171,
103,
218,
141,
50,
40,
4,
244,
84,
203,
233,
14,
146,
30,
75,
122,
104,
170,
242,
226,
38,
138,
82,
202,
149,
38,
181,
163,
214,
222,
165,
127,
255,
255,
222,
214,
148,
250,
127,
122,
25,
107,
247,
219,
254,
101,
122,
122,
111,
171,
59,
105,
82,
185,
54,
111,
255,
255,
255,
255,
171,
45,
191,
64,
67,
128,
37,
18,
148,
141,
203,
255,
251,
146,
96,
189,
0,
3,
86,
102,
215,
211,
48,
43,
104,
74,
140,
219,
61,
45,
162,
109,
13,
161,
157,
97,
172,
208,
237,
161,
71,
179,
172,
52,
249,
9,
180,
45,
183,
86,
235,
180,
216,
25,
165,
50,
132,
6,
58,
237,
6,
157,
228,
174,
3,
70,
236,
96,
236,
8,
44,
64,
211,
33,
87,
30,
10,
168,
59,
49,
53,
33,
137,
29,
190,
183,
85,
221,
107,
17,
250,
233,
110,
62,
224,
81,
117,
23,
57,
206,
53,
63,
206,
97,
227,
121,
222,
179,
255,
251,
133,
172,
102,
223,
122,
181,
176,
240,
197,
74,
223,
144,
104,
137,
177,
139,
136,
168,
88,
78,
10,
149,
96,
117,
13,
223,
121,
163,
42,
127,
255,
255,
249,
32,
9,
1,
184,
148,
146,
77,
181,
127,
254,
173,
63,
78,
187,
115,
99,
108,
79,
26,
204,
199,
130,
64,
3,
24,
56,
30,
52,
110,
17,
134,
60,
171,
174,
194,
242,
163,
168,
113,
132,
111,
169,
108,
241,
225,
207,
106,
127,
173,
189,
126,
149,
247,
172,
231,
191,
234,
117,
169,
186,
108,
139,
249,
223,
163,
167,
182,
157,
189,
105,
119,
95,
255,
255,
255,
255,
255,
244,
66,
255,
213,
84,
202,
212,
220,
114,
199,
101,
215,
125,
160,
104,
241,
144,
20,
29,
16,
160,
0,
176,
204,
15,
77,
140,
76,
2,
18,
98,
162,
194,
0,
99,
11,
45,
25,
3,
4,
169,
141,
32,
10,
158,
7,
26,
152,
136,
90,
39,
150,
16,
65,
29,
192,
52,
33,
128,
132,
196,
11,
148,
4,
128,
144,
18,
83,
98,
248,
130,
206,
69,
3,
84,
144,
50,
161,
17,
38,
138,
99,
209,
80,
153,
89,
1,
28,
4,
113,
20,
38,
207,
149,
154,
68,
147,
101,
40,
50,
248,
183,
8,
240,
101,
197,
47,
123,
58,
205,
145,
73,
147,
99,
226,
16,
5,
176,
38,
193,
188,
1,
145,
29,
29,
243,
6,
248,
141,
3,
40,
22,
22,
52,
196,
3,
51,
39,
236,
255,
83,
189,
157,
248,
254,
46,
50,
96,
27,
198,
69,
136,
33,
112,
70,
97,
140,
232,
85,
234,
111,
127,
122,
96,
119,
104,
111,
193,
125,
3,
127,
32,
5,
162,
124,
117,
137,
204,
50,
217,
39,
255,
250,
171,
87,
255,
82,
4,
76,
192,
209,
101,
130,
32,
50,
6,
230,
131,
177,
52,
10,
129,
239,
255,
166,
239,
};
uint8_t *buff_addr = Buff;
unsigned int data_main;
unsigned int parameter_value;
unsigned int sci_mode;
unsigned int hdat0, hdat1;
uint8_t efb_lsb;
void main(void)
{
// MSP430 MCU Configuration
Sys_Clk_Config(); // 1
// SPI Initialization Functions
SPI_Pin_Config(); // 1
SPI_Init(); // 2
//VS1053b MP3 Module Configuration
VS1053_GPIO_Config(); // 1 //
vs1053_Hardware_Reset(); // 2
VS1053_SCI_Register_Config(); // 3
// for testing purpose
// vs1053_Sine_Test(126);
XDCS_LOW; //XDCS LOW
__delay_cycles(600); // delay of 100 micro sec
while(!(P3IN & DREQ)); // checking status of DREQ pin
vs1053_SDI_Write(0); // sending zero as per FAQ
vs1053_SDI_Write(0);
// here is code for transmitting buffer data
for(j=0; j<16; j++)
{
for(i=0; i<32; i++)
{
vs1053_SDI_Write(buff_addr); // this function transmits only 32 bytes
buff_addr = buff_addr +32;
}
}
// as per datasheet , 2048 bytes of endFillByte[7:0] should transmit at the end of file
parameter_value = Read_Extra_Param(endFillByte);
efb_lsb = parameter_value & 0x00ff;
for(i=0; i<2048; i++)
{
SDI_Write(efb_lsb);
while(!(P3IN & DREQ));
}
__delay_cycles(600000); // delay of 100 msec
sci_mode = VS1053_SCI_Read(SCI_MODE);
sci_mode = sci_mode | SM_CANCEL;
VS1053_SCI_Write(SCI_MODE, sci_mode);
// sci_mode = VS1053_SCI_Read(SCI_MODE);
// VS1053_SCI_Write(SCI_MODE, (sci_mode | SM_RESET));
hdat0 = VS1053_SCI_Read(HDAT0); // here both registers HDAT0/1 gets clear.
hdat1 = VS1053_SCI_Read(HDAT1);
XDCS_HIGH;
while(1); //Infinite loop
} // End of main function
//////////////////////////////////// FUNCITON DEFINTION ////////////////////////////////////
#include "vs1053_mp3.h"
///////////////////////////////////////////////////////////////////////////////////////////
void vs1053_Hardware_Reset(void)
{
XRST_LOW; // here we providing reset by using software
__delay_cycles(600000); // delay of 100 msec
XCS_HIGH; // Disable VS1053 module (NEEDED)
XRST_HIGH;
__delay_cycles(600000);
VS1053_SCI_Write(SCI_MODE, SM_RESET); // SOFTWARE RESET
_delay_cycles(60000); // delay of 10 msec
while(!(P3IN & DREQ)); // DREQ bit should be high
}// end of vs1053_Init() function
//////////////////////////////////////////////////////////////////////////////////
void VS1053_SCI_Register_Config(void)
{
// There are two separates wires connected to the XCS & XDCS PINS OF VS1053 that's why i have not // // // selected SM_SDISHARE MODE.
VS1053_SCI_Write(SCI_MODE, (SM_SDINEW | SM_TESTS ));
VS1053_SCI_Write(SCI_STATUS, SS_VER); // 4 FOR VS1053
VS1053_SCI_Write(SCI_BASS, 0X00F6);
VS1053_SCI_Write(SCI_AUDATA, 0X0010); // SAMPLE RATE = 44.1 KHz
VS1053_SCI_Write(SCI_AIADDR, 0X0000); // NO user application
VS1053_SCI_Write(SCI_VOL, 0X7f7f); // , medium volume 0x7f7f, MIN VOL = 0xfefe
VS1053_SCI_Write(SCI_CLOCKF, 0x9800);
}// End of function
/////////////////////////////////////////////////////////////////////////////////////
void VS1053_SCI_Write(unsigned char addr, uint16_t data)
{
XCS_LOW; //ENABLE THE VS1053 MP3 MODULE
SPI_Send_Data(SCI_WR); //Transmitting write instruction to the vs1053 mp3 module
SPI_Send_Data(addr); //Transmitting address to the MP3 module
SPI_Send_Data(data >> 8); //Transmitting Higher Byte
SPI_Send_Data(data & 0xff); //Transmitting Lower Byte
while(P3IN & DREQ); // Wait until DREQ goes to high
XCS_HIGH; //DISABLE THE VS1053 MP3 MODULE
}// end of function
/////////////////////////////////////////////////////////////////////////////
uint16_t VS1053_SCI_Read(unsigned char addr)
{
unsigned int data;
XCS_LOW;
SPI_Send_Data(SCI_RD);
SPI_Send_Data(addr);
SPI_Send_Data(0xff);
__delay_cycles(6000);
data = SPI_Receive_Data();
data = data << 8;
// while(P3IN & DREQ);
SPI_Send_Data(0xff);
__delay_cycles(6000);
data = data | SPI_Receive_Data();
XCS_HIGH;
return data;
}// end of function
//////////////////////////////////////////////////////////////////////////////////////////
void vs1053_Sine_Test(unsigned char n)
{
XDCS_LOW; // XCS high means XDCS low
//XDCS is interface data chip select pin is used to select SDI mode
// whereas XCS is chip select pin is used to select SCI mode
SPI_Send_Data(0x53);
SPI_Send_Data(0xef);
SPI_Send_Data(0x6e);
SPI_Send_Data(n);
SPI_Send_Data(0x00);
SPI_Send_Data(0x00);
SPI_Send_Data(0x00);
SPI_Send_Data(0x00);
XDCS_HIGH; // XCS low means XDCS high
}// End of vs1053_Sine_Test() function
/////////////////////////////////////////////////////////////////////////////
void vs1053_Sine_Test_Exit(void)
{
XDCS_LOW; // XCS and XDCS are internally logically inverted
// Here, XCS high means XDCS low
__delay_cycles(600);
SPI_Send_Data(0x45);
SPI_Send_Data(0x78);
SPI_Send_Data(0x69);
SPI_Send_Data(0x74);
SPI_Send_Data(0x00);
SPI_Send_Data(0x00);
SPI_Send_Data(0x00);
SPI_Send_Data(0x00);
XDCS_HIGH; // XCS low means XDCS high
}// End of Sine Test Exit function
////////////////////////////////////////////////////////////////////////////////////
void vs1053_SDI_Write(uint8_t *addr)
{
unsigned char i;
XDCS_LOW; //XDCS LOW
__delay_cycles(60);
while(!(P3IN & DREQ));
for(i=0; i<32; i++)
{
SPI_Send_Data(*addr++);
}
__delay_cycles(6);
while(!(P3IN & DREQ)); // DREQ should check every 32 bytes transmission
XDCS_HIGH; //XDCS HIGH
__delay_cycles(60);
}
// 2048 zeros are sent to the vs1053 to confirm file is ended to decode
void Send_2048_Zeros(void)
{
unsigned int i;
XDCS_LOW;
while(!(P3IN & DREQ));
for(i=0; i<2048; i++)
{
SPI_Send_Data(0);
}
XDCS_HIGH;
}// end of function
///////////////////////////////////////////////////////////////////////////////////////////
unsigned int Read_Extra_Param(unsigned int param_addr)
{
unsigned int param_value;
// for reading endFillByte
VS1053_SCI_Write(SCI_WRAMADDR, param_addr);
param_value = VS1053_SCI_Read(SCI_WRAM);
return param_value;
}// end of function
/////////////////////////////////////////////////////////////////////////////////////
void SDI_Write(unsigned char data)
{
XDCS_LOW;
__delay_cycles(60);
SPI_Send_Data(data);
while(!(P3IN & DREQ));
XDCS_HIGH;
__delay_cycles(60);
}
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Hi!
I am worried about the timing of your chip select signals. You say that your XCS and XDCS signals are "internally inverted". That does not make much sense. If you only have one chip select signal which you use for selecting control(0) or data(1) then you should set SCI_SHARED in the SCI_MODE register and only use the xCS signal. But it is recommended to use separate signals for xCS and xDCS so that they can both be inactive(1) at the same time and you can at that time use the SPI bus for non-vs10xx traffic.
-Panu
I am worried about the timing of your chip select signals. You say that your XCS and XDCS signals are "internally inverted". That does not make much sense. If you only have one chip select signal which you use for selecting control(0) or data(1) then you should set SCI_SHARED in the SCI_MODE register and only use the xCS signal. But it is recommended to use separate signals for xCS and xDCS so that they can both be inactive(1) at the same time and you can at that time use the SPI bus for non-vs10xx traffic.
No. VS10xx must detect the headers of some of the supported formats (MP3 or WMA or WAVE (RIFF) or AAC or OGG or MIDI), and random numbers don't create any supported headers. I suggest that you find the "Audible Hello" source code for microcontrollers from this forum and try that. All people have been successful in hearing MP3 by porting that code.i have taken a buffer of 512 bytes containing random numbers. This bytes is transmitted through SDI interfacing. What i am thinking by doing this i will get some noise or any garbage sound at the end of ear speaker. Is it correct way to debug...?
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Hi,
I am working with VS1053 to play a song as a slave. I used MIcrochip pIC18F87J50 for master. I did read the library supported by VLSI including: vx10xx_uc.h, player.h and player1053.c.
I have some confusions. In this library, there are some functions I cannot find anywhere: WriteSci(), ReadSci(), WriteSdi(). And the pdf document dose not mention it also. Do I need to build my own these functions based on the microcontroller and the hardware I used?
Thank you.
I am working with VS1053 to play a song as a slave. I used MIcrochip pIC18F87J50 for master. I did read the library supported by VLSI including: vx10xx_uc.h, player.h and player1053.c.
I have some confusions. In this library, there are some functions I cannot find anywhere: WriteSci(), ReadSci(), WriteSdi(). And the pdf document dose not mention it also. Do I need to build my own these functions based on the microcontroller and the hardware I used?
Thank you.
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Yes, exactly! You need to define these functions for your microcontroller, then the code will work.
-Panu
-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Hello,
I am trying to use the sample project in record mode, but I am not seeing any data being output from the VS1063A.
I have verified that the WriteSCI and ReadSCI functions work correctly (as suggested in VSTestInitSoftware (); function).
Here is my code setup:
What am I missing?
Thx,
Danny
I am trying to use the sample project in record mode, but I am not seeing any data being output from the VS1063A.
I have verified that the WriteSCI and ReadSCI functions work correctly (as suggested in VSTestInitSoftware (); function).
Here is my code setup:
Code: Select all
/* Start initialization with a dummy read, which makes sure our
microcontoller chips selects and everything are where they
are supposed to be and that VS10xx's SCI bus is in a known state. */
ReadSci(SCI_MODE);
/* First real operation is a software reset. After the software
reset we know what the status of the IC is. You need, depending
on your application, either set or not set SM_SDISHARE. See the
Datasheet for details. */
WriteSci(SCI_MODE, SM_SDINEW|SM_SDISHARE|SM_TESTS|SM_RESET);
while (!(GPIOB_PDIR & 0x100000)); //Wait till DREQ goes low
LoadUserCode();
WriteSci(SCI_AICTRL0, 48000U); // 48 kHz
WriteSci(SCI_AICTRL1, 1024U); // Manual gain at 1.0x
WriteSci(SCI_AICTRL3, 0x60); // Stereo MP3
WriteSci(SCI_WRAMADDR, 0xE0A0); // Set bitrate to CBR 160 kbit/s
// WriteSci(SCI_MODE, ReadSci(SCI_MODE) |
// SM_ENCODE | SM_LINE1); // Set record parameters
WriteSci(SCI_MODE, ReadSci(SCI_MODE) |
SM_ENCODE ); // Set record parameters
WriteSci(SCI_AIADDR, 0x50); // Activate recording
if ((n = ReadSci(SCI_HDAT1)) > 0) {
int i;
u_int8 *rbp = recBuf;
n = min(n, REC_BUFFER_SIZE/2);
for (i=0; i<n; i++) {
u_int16 w = ReadSci(SCI_RECDATA);
*rbp++ = (u_int8)(w >> 8);
*rbp++ = (u_int8)(w & 0xFF);
}
sendLength = sendto(sock, recBuf, n, 0, (sockaddr *)&remote_sin, sizeof(sockaddr_in));
index += sendLength;
// fwrite(recBuf, 1, 2*n, writeFp);
//now we can send the data in recBuf via ethernet connection
fileSize += 2*n;
} else {
/* The following read from SCI_RECWORDS may appear redundant.
But it's not: SCI_RECWORDS needs to be rechecked AFTER we
have seen that SM_CANCEL have cleared. */
if ((ReadSci(SCI_MODE) & SM_CANCEL) && !ReadSci(SCI_RECWORDS)) {
printf("playerState = psStopped\n");
//playerState = psStopped;
}
}
if (fileSize - nextReportPos >= REPORT_INTERVAL) {
u_int16 sampleRate = ReadSci(SCI_AUDATA);
nextReportPos += REPORT_INTERVAL;
printf("\r%ldKiB %lds %uHz %s %s ",
fileSize/1024,
ReadVS10xxMem32Counter(PAR_SAMPLE_COUNTER) /
(sampleRate & 0xFFFE),
sampleRate & 0xFFFE,
(sampleRate & 1) ? "stereo" : "mono", "mp3"
//afName[audioFormat]
);
// fflush(stdout);
}
What am I missing?
Thx,
Danny
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Please disregard my question I found a mistake in the SPI routines.
Thx,
Danny
Thx,
Danny
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Hi Panu,
I had problem in software reset. The code is shown below. My confusion is what SPI speed is suitable for the device in startup phase. I think the problems may be caused by SPI speed is too high and the device cannot respond.
Please give some recommendation
Thank you
I had problem in software reset. The code is shown below. My confusion is what SPI speed is suitable for the device in startup phase. I think the problems may be caused by SPI speed is too high and the device cannot respond.
Please give some recommendation
Thank you
Code: Select all
int VSTestInitSoftware(void)
{
u_int16 ssVer;
/* Start initialization with a dummy read, which makes sure our
microcontoller chips selects and everything are where they
are supposed to be and that VS10xx's SCI bus is in a known state. */
ReadSci(SCI_MODE);
/* First real operation is a software reset. After the software
reset we know what the status of the IC is. You need, depending
on your application, either set or not set SM_SDISHARE. See the
Datasheet for details. */
WriteSci(SCI_MODE, SM_SDINEW|SM_TESTS|SM_RESET);
/*SM_SDISHARE = 0; use seperating XDCS and XCS*/
/* A quick sanity check: write to two registers, then test if we
get the same results. Note that if you use a too high SPI
speed, the MSB is the most likely to fail when read again. */
WriteSci(SCI_HDAT0, 0xABAD);
WriteSci(SCI_HDAT1, 0x1DEA);
if (ReadSci(SCI_HDAT0) != 0xABAD || ReadSci(SCI_HDAT1) != 0x1DEA) {
printf("There is something wrong with VS10xx\n");
return 1;
}
/* Check VS10xx type */
ssVer = ((ReadSci(SCI_STATUS) >> 4) & 15);
if (chipNumber[ssVer]) {
printf("Chip is VS%d\n", chipNumber[ssVer]);
if (chipNumber[ssVer] != 1053) {
printf("Incorrect chip\n");
return 1;
}
} else {
printf("Unknown VS10xx SCI_MODE field SS_VER = %d\n", ssVer);
return 1;
}
/* Set the clock. Until this point we need to run SPI slow so that
we do not exceed the maximum speeds mentioned in
Chapter SPI Timing Diagram in the Datasheet. */
WriteSci(SCI_CLOCKF,HZ_TO_SC_FREQ(12288000)|SC_MULT_53_35X|SC_ADD_53_10X);
/* Now when we have upped the VS10xx clock speed, the microcontroller
SPI bus can run faster. Do that before you start playing or
recording files. */
/* Set up other parameters. */
WriteVS10xxMem(PAR_CONFIG1,PAR_CONFIG1_AAC_SBR_SELECTIVE_UPSAMPLE);
/* Set volume level at -6 dB of maximum */
WriteSci(SCI_VOL, 0x0c0c);
/* Now it's time to load the proper patch set. */
LoadPlugin(plugin, sizeof(plugin)/sizeof(plugin[0]));
/* We're ready to go. */
return 0;
}
Re: Microcontroller examples for VS1063, VS1053, VS1003, VS1
Hi,
I debug the code and found that the problem is the following code. It means that the microcontroller cannot read again the SCI_HDAT0 and SCI_HDAT1 registers.
Maybe the problem is SPI speed, I change the speed to <= 400kHz, nothing changed
???
I debug the code and found that the problem is the following code. It means that the microcontroller cannot read again the SCI_HDAT0 and SCI_HDAT1 registers.
Maybe the problem is SPI speed, I change the speed to <= 400kHz, nothing changed
???
Code: Select all
/* A quick sanity check: write to two registers, then test if we
get the same results. Note that if you use a too high SPI
speed, the MSB is the most likely to fail when read again. */
WriteSciSlow(SCI_HDAT0, 0xABAD);
WriteSciSlow(SCI_HDAT1, 0x1DEA);
if (ReadSciSlow(SCI_HDAT0) != 0xABAD || ReadSciSlow(SCI_HDAT1) != 0x1DEA) {
printf("There is something wrong with VS10xx\n");
return 1;
}