WRAM reading problems

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
quickshat
User
Posts: 5
Joined: Fri 2016-07-22 11:21

WRAM reading problems

Post by quickshat » Fri 2016-07-22 11:39

Hi,
i'm using the VS1053 for decoding purposes but i have a problem with reading from the WRAM.
As i understood so far I'm ought to perform a pointer setting method with writing the adresse i want to read to the WRAMADDR register.
After that i can perform a SCIRead with the Wram Adr.

The result of my reading should be the endFillByte, which is always 0 ... a bit stange i guess :( .

It would be nice if you could tell me what i'm doing wrong.

Code: Select all

        private UInt16 WramRead(ushort address)
        {
            ushort tmp1, tmp2;
            SciWrite(SciRegisters.WramAddr, address);
            tmp1 = SciRead(SciRegisters.Wram);
            SciWrite(SciRegisters.WramAddr, address);
            tmp2 = SciRead(SciRegisters.Wram);
            if (tmp1 == tmp2) return tmp1;
            SciWrite(SciRegisters.WramAddr, address);
            tmp1 = SciRead(SciRegisters.Wram);
            if (tmp1 == tmp2) return tmp1;
        }
(it's c#, netmf)
Wram = 0x06
WramAddr = 0x07

everything is working, the audio is getting played but the device never stops decoding until i reset it :/

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

Re: WRAM reading problems

Post by pasi » Mon 2016-07-25 12:12

Endfillbyte will be 0 for most of the audio formats. If will be non-zero for example for IMA ADPCM, g.722, 8-bit linear WAV, FLAC.

Continuing decoding as long as audio data is received until indicated otherwise is the normal and expected operation. :D

Check the cancel procedure from the datasheet.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

quickshat
User
Posts: 5
Joined: Fri 2016-07-22 11:21

Re: WRAM reading problems

Post by quickshat » Mon 2016-07-25 12:22

Thanks for your fast help!

I'll try it now again, maybe my cancelling procedure is wrong...
Do i have to set the Cancle bit only or has the SDINEW bit set to one as well?

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

Re: WRAM reading problems

Post by pasi » Mon 2016-07-25 16:15

You must not change any of the other bits of SCI_MODE when you set SM_CANCEL. (So, setting or clearing bits are usually performed as read-modify-write.)
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

quickshat
User
Posts: 5
Joined: Fri 2016-07-22 11:21

Re: WRAM reading problems

Post by quickshat » Thu 2016-07-28 13:48

Thank you!

It's working now. But is it normal that the play procedure is finalized after i guess 3x-4x times sending the 32Byte array of endFillByte ?
But on the whole the chip is working fine!

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

Re: WRAM reading problems

Post by pasi » Fri 2016-07-29 10:12

Yes, it is normal.

Decoding is stopped whenever SM_CANCEL is detected by the decoder, but each decoder checks for it in a convenient step for that decoder. So, it may take until the next audio frame to detect it. However, because the stream buffer size is around 2040 bytes, there already is a lot of data to be decoded in the stream buffer, so SM_CANCEL should be detected without a lot of endfillbytes.

Note that for the normal end of song you should first send around 2050 endfillbytes before setting SM_CANCEL so that you are sure that all audio data has been read and decoded before ending the playback. Otherwise - especially for low-bitrate songs - the end of the song may be cut off.

Also, if you're canceling play in the middle of a song it is safer to set SM_CANCEL and keep sending the audio data (instead of endfillbyte) until SM_CANCEL clears.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply

Who is online

Users browsing this forum: No registered users