recording audio through codec

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
MOUNIKA MADURI
User
Posts: 15
Joined: Fri 2018-01-19 11:17

Re: recording audio through codec

Post by MOUNIKA MADURI » Tue 2018-01-23 13:17

In the player1063.c code there are UI commands but i didi not find GUI apk anywhere

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

Re: recording audio through codec

Post by Henrik » Tue 2018-01-23 14:20

Hello!

I would need to see the following three things:
1) The exact error messages.
2) Your main function that calls the subroutines of player1063.c.
3) Your implementation of WriteSci(), ReadSci() and WriteSdi().

If you are getting errors sometimes, check:
A) SPI bus polarity (default polarity is data change at falling clock edge, read data at rising clock edge, see SDI Timing Diagram and SCI Timing Diagram in VS1063 Datasheet). If this is incorrect, sometimes the system seems to almost work, but there are sometimes errors.
B) SPI speed. It should be max. 1/7 of VS1063's internal clock speed. So, initially 12.288 MHz / 7 = 1.75 MHz or lower. Then, after you set SCI_CLOCKF you can make SPI speed higher (e.g. if you write 0xe430 to SCI_CLOCKF, your maximum SPI speed will be 61.44 MHz / 7 = 8.77 MHz).
C) Timing of chip select signal(s).

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

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

Re: recording audio through codec

Post by Henrik » Tue 2018-01-23 14:21

MOUNIKA MADURI wrote:
Tue 2018-01-23 13:17
In the player1063.c code there are UI commands but i didi not find GUI apk anywhere
You need to create your own GUI. The example code just shows how to interface with VS1063.

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

MOUNIKA MADURI
User
Posts: 15
Joined: Fri 2018-01-19 11:17

Re: recording audio through codec

Post by MOUNIKA MADURI » Wed 2018-01-24 6:38

This is the main code i am using
void setup() {
Serial.begin(9600);
vs_setup();
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
if (VSTestInitHardware() || VSTestInitSoftware())
{
printf("Failed initializing VS10xx, exiting\n");
exit(EXIT_FAILURE);
}
}
void loop()
{
VSTestHandleFile("/my_file.mp3", 1);
VSTestHandleFile("/my_file.mp3", 0);
}

below are the sci and sdi functions

uint16_t ReadSci(uint8_t address)
{
uint16_t resultvalue = 0;
uint16_t aux = 0;
vs_deselect_data();
vs_select_control();
vs_wait();

SPI.transfer(VS_READ_COMMAND);
SPI.transfer(address);
aux = SPI.transfer(0xFF);
//Serial.println(aux);
resultvalue = aux << 8;
aux = SPI.transfer(0xFF);
//Serial.println(aux);
resultvalue |= aux;

vs_deselect_control();
vs_wait();

return resultvalue;
}

void WriteSci(uint8_t address, uint8_t highbyte, uint8_t lowbyte)
{
//vs_deselect_data();
vs_select_control();
vs_wait();

delay(2);
SPI.transfer(VS_WRITE_COMMAND);
SPI.transfer(address);
SPI.transfer(highbyte);
SPI.transfer(lowbyte);
vs_deselect_control();
vs_wait();
}

int WriteSdi(const u_int8 *d, const u_int8 n)
{
int i;
if(n>32)
return -1;
while(!digitalRead(VS_DREQ));
vs_select_data();
for(i=0;i<32;i++)
SPI.transfer(*d++);
vs_deselect_data();
return 0;
}

MOUNIKA MADURI
User
Posts: 15
Joined: Fri 2018-01-19 11:17

Re: recording audio through codec

Post by MOUNIKA MADURI » Wed 2018-01-24 6:42

Rebooting...

'!�B/c␔�␅8�!␌c�4�There is something wrong with VS10xx SCI registers
Failed initializing VS10xx, exiting
abort() was called at PC 0x400e249b on core 1

Backtrace: 0x4008727c:0x3ffca970 0x4008737b:0x3ffca990 0x400e249b:0x3ffca9b0 0x400d11db:
0x3ffca9d0 0x400d1054:0x3ffca9f0 0x400e1863:0x3ffcaa10
Rebooting...

'!�B/c␔�␅8�!␌c�4�There is something wrong with VS10xx SCI registers
Failed initializing VS10xx, exiting
abort() was called at PC 0x400e249b on core 1

Backtrace: 0x4008727c:0x3ffca970 0x4008737b:0x3ffca990 0x400e249b:0x3ffca9b0 0x400d11db:
0x3ffca9d0 0x400d1054:0x3ffca9f0 0x400e1863:0x3ffcaa10

Rebooting...
()k32%�����Chip is VS1063

***getting strucked here

MOUNIKA MADURI
User
Posts: 15
Joined: Fri 2018-01-19 11:17

Re: recording audio through codec

Post by MOUNIKA MADURI » Wed 2018-01-24 14:27

Can you please help me..

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

Re: recording audio through codec

Post by pasi » Wed 2018-01-24 15:01

Have you read viewtopic.php?f=10&t=58 ?

Do you have all the voltages present?
Does xRESET go high?
Is xTEST high?
Do GBUF/LEFT/RIGHT bias to 1.2V?
What is your SPI clock speed?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

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

Re: recording audio through codec

Post by Henrik » Wed 2018-01-24 15:07

Hello!

"There is something wrong with VS10xx SCI registers", as it says, means that your SCI communication is not working. Look at the portion of the code of player1063.c that gives the error message, add debug printouts. Question: What do you get from SCI_AICTRL1 and SCI_AICTRL2 instead of the correct numbers?

Then recheck your SPI communication:
  1. Are you using correct value in SCI_MODE register bit SM_SDISHARE? (See VS1063 Datasheet Chapter SCI_MODE.)
  2. SPI bus polarity (default polarity is data change at falling clock edge, read data at rising clock edge, see SDI Timing Diagram and SCI Timing Diagram in VS1063 Datasheet). If this is incorrect, sometimes the system seems to almost work, but there are sometimes errors. [In your code, this seems to be right, but you may still want to test other values for SPI.setDataMode().]
  3. SPI speed. It should be max. 1/7 of VS1063's internal clock speed. So, initially 12.288 MHz / 7 = 1.75 MHz or lower. Then, after you set SCI_CLOCKF you can make SPI speed higher (e.g. if you write 0xe430 to SCI_CLOCKF, your maximum SPI speed will be 61.44 MHz / 7 = 8.77 MHz).
  4. Timing of chip select signal(s). [I couldn't find errors in the source code for ReadSci(), WriteSci, and WriteSdi().]
If you don't succeed, I suggest recording an oscilloscope or similar read-out for one SciWrite() operation, then of one SciRead() operation so that all 32 clocks are clearly visible. The required pins would be chip select(s), MOSI, MISO, and clock.

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

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

Re: recording audio through codec

Post by Panu » Wed 2018-01-24 17:38

Hi!

When you debug your SPI communications, please check the "MCU Howto" link below.

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

MOUNIKA MADURI
User
Posts: 15
Joined: Fri 2018-01-19 11:17

Re: recording audio through codec

Post by MOUNIKA MADURI » Thu 2018-01-25 11:32

SPI communication is working well

can i get the code example of codec interface with microcontroller for voice recording through line in and send to the file in controller and play back that audio through headphone out

Post Reply