MP3 encoding data are missing

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
Y_Tanaka
User
Posts: 1
Joined: Thu 2018-08-02 8:00

MP3 encoding data are missing

Post by Y_Tanaka » Sat 2018-08-04 4:48

We are developping a MP3(32KHz 128Kb/s monoral) recording module by using
VS1063a and cortex M3.
We have a fatal problem in encording sequence.
Several times, the reading one frame data (which shoud be the same size)
from SCI_HDAT0 does not match around 40~200 bytes during recording of
approximately one hour. The DSP is worked in x5 clock and SCI clock is
programmed to 3 or 6MHz.
The omission of data seems to have already occurred when read it from the
SCI_DATA0. As a matter of course, the latest Plug-In supported.
What kind of problem following sequence will be considered as possibility?


--- start Encode MP3( 32KHz 128Kbps monoral) sequence ---

SCIEnable(); // enable SCI device
-- SCI CLOCK to 1MHz --
Vs1063aWriteSci(SCI_CLOCKF, val);
Vs1063aWriteSci(SCI_AICTRL0, 32000UL); // 32KHz sampling
Vs1063aWriteSci(SCI_AICTRL1, 0x00);
-- SCI_CLOCKUP to 6MHz--
Vs1063aLoadUserCode(); // patches loading(2017/03/29 full)
Vs1063aWriteSci(SCI_WRAMADDR, CBR | x1000 | 128); // 128KBPS set
: :

wordsn = Vs1063aReadSci(SCI_HDAT1); // read encoded words number
if (wordn > 0)
{
for (i=0; i<wordsn; i++)
{
val = Vs1063aReadSci(SCI_HDAT0);
SetEncodeBuf(val >> 8); // set upper data to buffer
SetEncodeBuf(val & 0x00FF); // set lower data to buffer

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

Re: MP3 encoding data are missing

Post by Panu » Mon 2018-08-06 9:12

Hello!

I don't think that VS1063 guarantees that the is pushed to the buffer exactly one frame at a time. But I suppose that is not the problem?

Could it be that you simply don't read the data fast enough?

Can you give a specific example of what goes wrong, e.g. when you run this...

Code: Select all

wordsn = Vs1063aReadSci(SCI_HDAT1); // read encoded words number

if (wordn > 0) for (i=0; i<wordsn; i++) {
  val = Vs1063aReadSci(SCI_HDAT0);
  SetEncodeBuf(val >> 8); // set upper data to buffer
  SetEncodeBuf(val & 0x00FF); // set lower data to buffer
}
... can you give an example of what is the value of wordsn and what is the value of wordsn the next time you run it?

Also, how long does it take to execute the FOR loop? Can you measure it with an oscilloscope? And how long time is there between two runs of the first line (the one that reads the SCI_HDAT1 register) in the worst case?

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

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

Re: MP3 encoding data are missing

Post by pasi » Tue 2018-08-07 13:05

Where are you saving or sending the encoded data?

If you are saving to SD card, then you may be experiencing large latency between some of the writes. Some cards behave better than some others in this respect.

If it suddenly takes 200-500ms to write a sector, then the FIFO in vs1063a will overflow and you will miss data.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply