SPI Flash file access

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
GDN
User
Posts: 3
Joined: Sat 2024-08-31 5:13

SPI Flash file access

Post by GDN »

Hi, We've been using the VS1000 for playback of OGG files for some years now.

The files are stored in SPI flash, control is by an ATMega8 via serial port.

We are looking at allowing some client control of the OGG files, I believe the SPI flash can be presented to a PC as a storage device when connected via USB.
Is there any mechanism to send short text file data stored with the OGG files from the VS1000 to the Mega8 via serial?
I'm looking for a method of getting a dozen or so bytes of config data from the client to the Mega8.

cheers,

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

Re: SPI Flash file access

Post by pasi »

You're not saying it explicitly, but I assume the VS1000 is running the VS1000 Audio Module firmware.

The vs1000 Audio Module firmware source code has a "type" command ('T'), which prints out the contents of the named file. However, this is not enabled (in spiplayer.c and sdplayer.c) by default due to code size. Some other features may need to be disabled to enable the "type" command.

If you build your own version, I suggest also editing the version printout in "usbmass.c" .
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
GDN
User
Posts: 3
Joined: Sat 2024-08-31 5:13

Re: SPI Flash file access

Post by GDN »

Thanks Pasi,

interesting answer, in that it raises other questions:

I didn't realise the VS1000 was able to do much else other than play OGG files.
Are you telling me I'd need to do some VSIDE programming, or, is the T command available in the same manner as the Pxx comand to play OGG files?

I'm not trying to read a text file while playing samples, or any other task. I intend to read an IPv4 address, if present, during startup.
After that, I'm done with the text files function.

Is the storage space a problem if attempting to use the file read function simultaneous with OGG playing, or at any time at all?

cheers,

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

Re: SPI Flash file access

Post by pasi »

GDN wrote: Tue 2024-09-03 4:34Are you telling me I'd need to do some VSIDE programming, or, is the T command available in the same manner as the Pxx comand to play OGG files?
You would need to change the preprocessor directive "#if 0" in spiplayer.c (line 442 in the latest code) to "#if 1" to enable the T command for spiplayer, then recompile (which also creates the 4 boot images of the 4 separate programs and then combines them into a single image spiall.spi ). After that "TFILENAMETXT\n" would print the contents of FILENAME.TXT . It looks like the T command fits into the spiplayer program without removing other functions. (If not, comment out e.g. #define USE_INFO in system.h .)

There is a USE_TYPE define comment in system.h, but the T command doesn't fit in the sdplayer program with all the other options, which is probably why the USE_TYPE define hasn't been used in spiplayer.c .
GDN wrote: Tue 2024-09-03 4:34I'm not trying to read a text file while playing samples, or any other task. I intend to read an IPv4 address, if present, during startup.
After that, I'm done with the text files function.
Reading and printing a predefined number of characters from a predefined file could be made automatic after each filesystem initialization, and the code might be short enough for both uSD and SPI players, but would need to be coded by someone. So, enabling the T command for the SPI player program is easiest.
GDN wrote: Tue 2024-09-03 4:34Is the storage space a problem if attempting to use the file read function simultaneous with OGG playing, or at any time at all?
During actual play isn't easy for other reasons, because only one file can be open at a time, and code can be only run during the "idle time" when the decoder waits for the audio buffer to have enough space for new decoded samples.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
GDN
User
Posts: 3
Joined: Sat 2024-08-31 5:13

Re: SPI Flash file access

Post by GDN »

Thanks Pasi,

I've got it now; even though I'd read through the VS1000 docs, I still assumed the file access and USB functions were in the ROM.

Having got past that, I have to re-compile the boot code, removing functions I don't need to make room for text file reading.

I guess you're completely familiar with this task, me much less so.
Could you tell me the code size limit I've got to aim for?

BTW, obviously, I've inherited this project, so I didn't have to do the original boot code compile,

cheers,

GD.
User avatar
pasi
VLSI Staff
Posts: 2159
Joined: Thu 2010-07-15 16:04

Re: SPI Flash file access

Post by pasi »

Are you using any default module firmware version (possibly v072-uart) at the moment? Are you reprogramming the modules? What does the module print during startup?

Do you use specific 'optional' features other than playing? Loop mode, volume command, info command, start at filemode, etc?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply