Page 1 of 3

VS1010D Virtual Memory, AAC, WMA and OGG Decoders

Posted: Thu 2018-09-27 13:05
by Panu
Dear Forum Members,

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

Please note that running decoders from RAM consumes most of VS1010 memory and CPU resources. There may not be much left for your own software while songs are playing.

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

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

Posted: Fri 2018-09-28 20:37
by MikeG
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

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

Posted: Mon 2018-10-01 9:24
by Panu
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

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

Posted: Mon 2018-10-01 18:12
by MikeG
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

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

Posted: Mon 2018-10-01 19:08
by MikeG
Hi Panu,

Yes, I have 2 boards with VS1010D.

Mike

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

Posted: Tue 2018-10-02 14:49
by MikeG
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

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

Posted: Wed 2018-10-03 8:01
by Hannu
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.

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

Posted: Wed 2018-10-03 12:02
by Hannu
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.

Firmware and AAC,WMA,OGG Decoders in SPI flash

Posted: Thu 2019-01-31 19:08
by Panu
Dear VS1010 enthusiasts,

Here is a SPI flash driver that allows to use the SPI flash, instead of the SD card, for the storage for firmware (.DLX files). Using this driver you will be able to make a VS1010 product that plays MP3, WAV, WMA, AAC and OGG files so that all the firmware is in the SPI flash.

Instructions:
1) Install the SD card version (from VirtualSD.zip in the first post in this page).
2) Test that it works. You must be able to play the test files (AAC, OGG, MP3) from the SD card.
3) Copy eeprom.img and external.map files to the SD card root from below.
4) Do the promx step again. Note that it says "Programming file "s:eeprom.img" to address 0x000000 (0)".
5) Do a REBOOT 4 to show the SPI flash to the PC.
6) Format the SPI flash using your PC.
7) Copy all firmware to the SPI flash (same firmware as you have in VirtualSD.zip and in your SD card).
8) Create a WANTSYS.TXT file to the root of the SPI flash. If this file is in the SPI flash then the SPI flash becomes the S: drive. (You can remove this file to make the SD card to be the S: drive again.)
9) Reboot
10) Play WMA, AAC, OGG files like you did with the SD card. Firmware now loads from the SPI flash.

Here's an example output that actually plays the TEST.WMA from the SPI flash! So the cached decoders, firmware and WMA content is all in the SPI flash. (Yes, you can play content from the SD card, just use the play D:t* command instead of play F:t*)
C#0d1fc
SPIBOOT
d
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 15
SPIF:c217, 16384K
SD:922 MiB
SpiCacheDrv v5
S to flash
A Little Bit (sample).mp3

VS1010>devices
D: SD/SD Card
F: SPI Flash c217
I: STREAM
R: ROMDISK
S: SPI Flash c217 <--------- NOTICE THIS! S: SYSTEM DISK IS THE SPI FLASH!

VS1010>
VS1010>bootx s:boot.x

Reset virtual memory
BootFromX(BOOT.X)
Loaded 746 bytes.
VLoad Ok.
S1010>S1010>play f:t*
TEST.WMA
-Panu

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

Posted: Fri 2019-02-01 9:48
by Panu
Here's a small update. The functionality is the same, but I cleaned the clocking code a bit. This version of eeprom.img doesn't need to leave anything resident in the RAM; after initialization everything is done and handled by the VS1010D ROM from thereon.

-Panu