VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
User avatar
Panu
VLSI Staff
Posts: 2586
Joined: Tue 2010-06-22 13:43

VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by Panu » Thu 2018-09-27 13:05

Dear Forum Members,

Here is a binary software package that adds support for AAC, WMA and OGG decoding in the VS1010D.

The VS1010D contains hardware and software support for virtual memory, which is implemented with a Translate Look-aside Buffer type of cache controller in the 4 kiloword instruction RAM memory of VS1010D. The TLB allows VS1010D to run programs whose size is 16 kilowords instead of the 4 kilowords of RAM that is physically on the chip.

The TLB virtual memory controller arranges the instruction RAM memory into 64 stripes of 64 words each. When a fetch occurs to a nonpresent memory address, a non-maskable page fault interrupt is generated. The VS1010D ROM contains a handler that loads a stripe of instructions from a SPI NOR flash using SPI flash dual data read opcode 3B, which is supported in a wide variety of SPI NOR flashes. The stripe contains a simple checksum to protect against reading from corrupted or unprogrammed memory.

We have tested the functionality with the following flash ICs: Adesto 25SF321, Macronix MXIC 25L128 3SF, Winbond W25X32VSIG, Winbond 25Q32DWSIG, and Macronix MXIC 25L400. Additionally, SPI flash chips with 64K erase blocks such as Spansion S25FL127 can be used as virtual memory storage, but with 64K erase block size, there can never be any writable FAT partition on the flash, so they are not recommened.

Taking advantage of the virtual memory controller, binary images for AAC, WMA and OGG decoders have been compiled and are distributed here. Please download the package and extract it to the root of a microSD card. Then from the command line, run PROMX command to write the cache images to the SPI flash. Please beware, this operation will overwrite and corrupt any existing FAT partition in the SPI flash.
VS1010>promx
Starting VS1010C external SPI Flash prommer v2014-01-14...
Serial Flash RDID: manufacturer c2, type 20, density 18
Serial Flash REMS: c217

Opened map file "s:external.map"
Programming file "s:sys/vr1.i" to address 0x010000 (65536)
Erase 4 KiB sector 16 ( 64 - 68 KiB), ok. Writing data .
Erase 4 KiB sector 17 ( 68 - 72 KiB), ok. Writing data .
Erase 4 KiB sector 18 ( 72 - 76 KiB), ok. Writing data .
Erase 4 KiB sector 19 ( 76 - 80 KiB), ok. Writing data .
Erase 4 KiB sector 20 ( 80 - 84 KiB), ok. Writing data .
Erase 4 KiB sector 21 ( 84 - 88 KiB), ok. Writing data .
Erase 4 KiB sector 22 ( 88 - 92 KiB), ok. Writing data .
Erase 4 KiB sector 23 ( 92 - 96 KiB), ok. Writing data .
Erase 4 KiB sector 24 ( 96 - 100 KiB), ok. Writing data .
Erase 4 KiB sector 25 ( 100 - 104 KiB), ok. Writing data .
Erase 4 KiB sector 26 ( 104 - 108 KiB), ok. Writing data .
Ok
Programming file "s:sys/vr2.i" to address 0x020000 (131072)
Erase 4 KiB sector 32 ( 128 - 132 KiB), ok. Writing data .
Erase 4 KiB sector 33 ( 132 - 136 KiB), ok. Writing data .
Erase 4 KiB sector 34 ( 136 - 140 KiB), ok. Writing data .
Erase 4 KiB sector 35 ( 140 - 144 KiB), ok. Writing data .
Erase 4 KiB sector 36 ( 144 - 148 KiB), ok. Writing data .
Erase 4 KiB sector 37 ( 148 - 152 KiB), ok. Writing data .
Erase 4 KiB sector 38 ( 152 - 156 KiB), ok. Writing data .
Ok
Programming file "s:sys/vr3.i" to address 0x030000 (196608)
Erase 4 KiB sector 48 ( 192 - 196 KiB), ok. Writing data .
Erase 4 KiB sector 49 ( 196 - 200 KiB), ok. Writing data .
Erase 4 KiB sector 50 ( 200 - 204 KiB), ok. Writing data .
Erase 4 KiB sector 51 ( 204 - 208 KiB), ok. Writing data .
Erase 4 KiB sector 52 ( 208 - 212 KiB), ok. Writing data .
Erase 4 KiB sector 53 ( 212 - 216 KiB), ok. Writing data .
Erase 4 KiB sector 54 ( 216 - 220 KiB), ok. Writing data .
Erase 4 KiB sector 55 ( 220 - 224 KiB), ok. Writing data .
Erase 4 KiB sector 56 ( 224 - 228 KiB), ok. Writing data .
Erase 4 KiB sector 57 ( 228 - 232 KiB), ok. Writing data .
Ok
Map file "s:external.map" closed
After promming the flash, you can reboot the VS1010D into a simplified command line mode that allows only limited amount of user code to be loaded into the RAM as most of the RAM is used to load the virtual decoder. The reboot can be done by command BOOTX S:BOOT.X
VS1010> bootx s:boot.x

Reset virtual memory
BootFromX(BOOT.X)
Loaded 746 bytes.
VLoad Ok.
S1010>
Note that the prompt changes from "VS1010>" to "S1010>" as a visual cue to note that the shell has changed to a "simplified" shell - only raw UART console transport is supported, there's no backspace and less memory is available for programs, but the virtual memory loader and extended audio format support is available.

From this command prompt, MP3, WAV, AAC, OGG and WMA format music files can be played normally with the PLAY command:
S1010>play s:t*
TEST.WMA
TheRobotsA_192kbps.aac
TheRobotsM_192kbps.mp3 ok
TheRobotsO_270kbps.ogg
TheRobotsA_125kbps.aac
S1010>
This operation is supported in VS1010D devices, and at the moment the system disk S must be the SD card. We're working on being able to have all the firmware and decoders in the SPI flash, but at the moment, SD card must be used.

All music files must be played from a microSD or SD card, since it's the only storage which is fast enough to feed the music data files to the system with the overhead of loading the cache pages from the SPI flash. SPI flash cannot be used for data storage during extended format playback as the page fault interrupt must have exclusive access to the SPI0 bus.

The system is suitable for UART controlled playback of AAC, OGG and WMA songs, as well as MP3 and WAV songs, from the SD card. For other types of applications please inquire case by case, as we must think about how much instruction RAM there is left for user code when the virtual decoders are running. This can actually be quite a lot if not all bitrates and variants of all WMA, OGG and AAC files need to be supported, potentially even more than in a normal VS1010 system without virtual memory. But especially to support all WMA variants - especially in very low bitrates - a lot of memory must be set aside for that.

As always, please experiment with the system and let us know how we can improve it and help you.

-Panu
Attachments
VirtualSD.zip
SD card image with precompiled binaries for Virtual Memory, AAC, WMA and OGG support for the VS1010D
(2.35 MiB) Downloaded 19 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

MikeG
User
Posts: 18
Joined: Fri 2018-08-03 17:27

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by MikeG » Fri 2018-09-28 20:37

Hi Panu,

So, I downloaded the new code and installed it on the SD card per your instructions. Everything seems ok, My terminal screen matches the images that you posted. Using the boot.x s:boot.x command, the terminal shows that each file is playing but I get no sound. So, in virtual mode I get no sound. If I reboot, the VS1010 goes into normal mode and it plays the mp3 and skips the other files. I can try it on my other developer system later, it's at home.

Mike

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

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by Panu » Mon 2018-10-01 9:24

Hmm. Interesting. I wonder what is different between my and your experience and if your procedure is different than my procedure.

My procedure, after programming the flash and all is:
- Turn on VS1010
- MP3 song starts to play, sound is heard
- Press Enter on UART terminal program (TeraTerm) to get command prompt access to UART, VS1010> prompt is shown
- Give command bootx s:bootx
- S1010> prompt is shown
- type p l a y [Space] s : t * [TAB]
(note that TAB key and not the ENTER key is pressed to terminate the command)
All versions of the test song now play, one after the other

Is there something different between my and your procedure? Can you try the exact same procedure on your VS1010D board? Does it play? If not, then there must be something different in my sd card or flash or something, that I must find out! And if it does play, then need to find out what is the extra step that must be added to the procedure. I suspect that the initial playing of MP3 file at bootup might do something magical. Or maybe it is the TAB key; if [Enter] sends both CR and LF in your terminal, the CR starts the playback and the LF then immediately cancels it.
I can try it on my other developer system later, it's at home.
You have TWO boards with VS1010D?

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

MikeG
User
Posts: 18
Joined: Fri 2018-08-03 17:27

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by MikeG » Mon 2018-10-01 18:12

Hi Panu,

Yes, I follow your procedure exactly. The UART terminal shows that all 3 songs are being played and it ends with an "ok" but I am getting no sound. I do get sound in step 2 of your procedure, when I first start up the board it plays the mp3 so I know that the system will play sounds. I'm going to reload the files from your zip file onto the SD card and retry the entire procedure.

Mike

MikeG
User
Posts: 18
Joined: Fri 2018-08-03 17:27

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by MikeG » Mon 2018-10-01 19:08

Hi Panu,

Yes, I have 2 boards with VS1010D.

Mike

MikeG
User
Posts: 18
Joined: Fri 2018-08-03 17:27

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by MikeG » Tue 2018-10-02 14:49

Hi Panu,

I've run both boards now. They both have the same behavior. It appears that the reason I was not hearing any sound is that the Line out connection has some type of an issue. Yesterday, I was using a Piezo speaker eval board and speaker attached to the line out connector. It's been working fine with this setup prior to updating to virtual mode. Today I have been using a Bose Soundlink speaker attached to the line out and into the aux on the soundlink. In virtual mode, when I type the play command, I hear maybe a second of sound and then nothing. Just for fun, I decided to plug into the headphone jack. I get sound! In virtual mode, all three songs play, .ogg, .acc, and .mp3. Also, the speaker connections, JPL and JPR work fine too. So, the question is, what happens to the line out?

Mike

Hannu
Senior User
Posts: 44
Joined: Mon 2016-05-30 11:54

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by Hannu » Wed 2018-10-03 8:01

Hello Mike,

The VS1010 dev board line out and HP connectors have one difference. When analog audio signal is coming from HP connector, it has DC offset of GBUF. While line out signal doesn't have that offset. See schematics http://www.vlsi.fi/fileadmin/products/v ... ev1_42.pdf page two.

So in this case six passive components and connector know when you are using virtual memory. I'll try if I can reproduce this situation.

Hannu
Senior User
Posts: 44
Joined: Mon 2016-05-30 11:54

Re: VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Post by Hannu » Wed 2018-10-03 12:02

I made few tests...

Powered through USB, VHIGH pin, listened with headphone line out and HP connector.

So far I haven't found anything differ between virtual and normal mode. Robots play just nicely.

Post Reply