Problems with OGG Vorbis Encoder

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
quickshat
User
Posts: 14
Joined: Fri 2016-07-22 11:21

Problems with OGG Vorbis Encoder

Post by quickshat »

Hi,

we are currently implementing our last features for our device, which uses the VS1053 as a slave decoder/encoder.
We want it to record an audio signal coming through Line_In_L (we have already checked that the signal is correct) and therefore we are trying to use the OGG encoder.
I've managed it to load the plugin file correctly w. the address being 0x3400.
Additionally i have checked your example c implementation and the one from Adafruit and tried both with the following result.
When i now start the recording, the device continuously provides me with the same 16-bit word on HDAT0 (0x2034) - not even the OGG header is sent.
The HDAT1 seems to do its job - but for this conjecture i have no verification.
I also run the chip with same electrical and timing(12.288 MHz) characteristics as the typical application on the datasheet shows.

Maybe you can help me out with this?

Thanks in advance and best regards,
quickshat
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: Problems with OGG Vorbis Encoder

Post by pasi »

If I recall correctly, the starting address should be 0x34, not 0x3400.

Do you have the decoding working? How confident are you that your SCI read and write routines are correct?

What are the SCI writes you perform before loading the Ogg Vorbis Encoder Application?

If you read SCI_AUDATA before loading the application, what is the value you get? If you see 0xac45, check the state of GPIO0 and GPIO1. If the Real-Time MIDI mode has started, it will interfere with the application loading.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
quickshat
User
Posts: 14
Joined: Fri 2016-07-22 11:21

Re: Problems with OGG Vorbis Encoder

Post by quickshat »

Hi,

thanks for your fast answer.

Decoding is working fine and I have now replaced the starting address with 0x34 manually but this makes no difference. SCI operations should work, because i am able to change the volume of the device correctly.

Here is an code excerpt of the init routine:

Code: Select all

SciWrite(SciRegisters.Clockf, 0xC000);
SciWrite(SciRegisters.Bass, 0);
SoftReset();
SciWrite(SciRegisters.AiAddr, 0);
SciWrite(SciRegisters.WramAddr, 0xC01A);
SciWrite(SciRegisters.Wram, 0x02);
ushort audata = SciRead(SciRegisters.Audata);

ushort addr = LoadPlugin("oggrec.img");
Debug.Print("[AudioModule] Loaded plugin @0x" + addr.ToString("X"));

SetBits(SciRegisters.Mode, new[] { 14, 12, 11 }, new[] { true, true, true }); // <- this sets bits 14,12,11 of the MODE register to 1,1,1
SciWrite(SciRegisters.AiCtrl0, 0x8000);   
SciWrite(SciRegisters.AiCtrl1, 0x1024);  
SciWrite(SciRegisters.AiCtrl2, 0x0000);
SciWrite(SciRegisters.AiCtrl3, 0x0000);
SciWrite(SciRegisters.AiAddr, 0x34);

WaitForDreq();
Debug.Print("[AudioModule] Recording initialized");
Additionally i've read the content of AUDATA as you can see in the code and it contains: 0x1F40
quickshat
User
Posts: 14
Joined: Fri 2016-07-22 11:21

Re: Problems with OGG Vorbis Encoder

Post by quickshat »

It seems like i found the major problem.
When loading a plugin, we are streaming from an SD card with an Filestream and a BinaryReader. The Reader provides us with functions like ReadByte(), ReadUint16 etc. and then advances the current position in the stream automatically. But now i found out that ReadUnit16 isnt the same as:

Code: Select all

uint16 data;
data = plugin.ReadByte();
data <<= 8;
data |= plugin.ReadByte();
which caused the error. Now i recieve many bytes with an obvious high entropy and a correct header but the file isn't playable on a windows machine with VLC MediaPlayer or alternatives.
I guess i have to figure that one out aswell.
If i am going to encounter more problems with that i will let you know.
Thank you for your help!
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: Problems with OGG Vorbis Encoder

Post by pasi »

If you attach a file we can check if the reason is missing data. This often happens when the storage cannot accept new data and both the FIFO on the vs1053b and in your controller overflows.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply