VS1063A Sample rate was not right at codec mode

Designing hardware that uses VLSI Solution's devices as slave codecs such as an external MP3 decoder chip for a host microcontroller.
Post Reply
kanprin
User
Posts: 3
Joined: Wed 2011-09-28 11:26

VS1063A Sample rate was not right at codec mode

Post by kanprin » Wed 2011-09-28 12:01

hi all:
when I set up my device with vs1063a at codec mode, the sample rate of encoding is not right, the decoding is all right.
I want to set it to 16KHz, but never effact, it seems was fixed to 8KHz.

here's my setting:

vs1063_hardware_reset();
vs1063_write_reg(SCI_CLOCKF,0XC800);
vs1063_write_reg(SCI_AICTRL0, 8000);
vs1063_write_reg(SCI_AICTRL1, sysMicGain);
vs1063_write_reg(SCI_AICTRL2, 0);
vs1063_write_reg(SCI_AICTRL3, 0x8013);//PCM mode,left chanel
vs1063_write_reg(SCI_MODE, vs1053_read_reg(SCI_MODE) | SM_RESET | SM_ADPCM | SM_LINE_IN);

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

Re: VS1063A Sample rate was not right at codec mode

Post by pasi » Wed 2011-09-28 16:10

kanprin wrote: I want to set it to 16KHz, but never effact, it seems was fixed to 8KHz.
..
vs1063_write_reg(SCI_AICTRL0, 8000);
The encoding rate is always taken from AICTRL0, so put 16000 there to get 16kHz. (Might sound obvious after you read the explanation below.)

The codec mode playback rate is taken from the wav header unless headers are disabled using the appropriate aictrl3 bit. The playback rate detected from the wave header is independent from the encoding rate, because by the time it is known (after you have sent the wave header), the encoding has already been initialized and the rate can not be changed anymore.

20110930: it seems in codec mode without headers the playback rate is actually the ADC rate (48/24/12kHz), not the requested rate. Workaround: wait until DREQ rises, then write the desired playback rate to SCI_AUDATA. (See also the vs1063a-patches package for mp3 encoding fix.)
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply