Production programming using SPI Flash as program memory

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
regh
Senior User
Posts: 39
Joined: Thu 2020-11-05 13:50

Re: Production programming using SPI Flash as program memory

Post by regh »

Yes, we have it set up so that firmware updates can be performed from usb (copying over to a tmp folder using fwrite and deleting using fopen(filenam,'U') when the update is done) and we also update some settings (like remembering which was the last file played before shutting down (using fputs). However at the point where the code appears to be corrupting no writing has occurred (there have been reads from the files using fopen and fgets). The program that isn't running does do some writing to the s drive. Don't know if any of this information makes a difference?
User avatar
Panu
VSDSP Expert
Posts: 2816
Joined: Tue 2010-06-22 13:43

Re: Production programming using SPI Flash as program memory

Post by Panu »

Well, if any writing has not occurred yet, then no, not really. But you must be extra careful when writing to the SPI flash, please see:
viewtopic.php?f=15&t=2758
The corruption error occurs after loading usbhost4.
Curious. Maybe there's some dependency of either the SPI flash or the SD card in the USBHOST4 driver, that I've missed.

Hannu, could you try running USBHOST4 from SPI flash in the developer board (set up SPI flash as the S: disk)?

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

Re: Production programming using SPI Flash as program memory

Post by Hannu »

Tested OK.

Code: Select all

reboot 2
copy boot.dlx from here: http://www.vsdsp-forum.com/phpbb/viewtopic.php?f=15&t=2620 to sd card
eject
reboot 4
format SPI flash
copy boot.dlx to SPI flash root and USBhost4.dlx to sys/
eject
reboot to console
usbhost4
play u:*mp3
Important parts: SD card needs to be S: drive and the flash write patch needs to be on root and executed before any flash write.
The symptons look like at some point you wrote to flash without first executing the patch. I tried the formatting and copying part without the patch and got broken filesystem.

Code: Select all

VS1010>reboot 2
C#0d1d at runlevel 2
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 2
SPIF:c217, 16384K
SD:15193 MiB
Relocked (3007)   < ----- Here the D:boot.dlx is copied
C#0d1dI-
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 7
SPIF:c217, 16384K
SD:15193 MiB

VS1010D patch SPI flash write  < ---- D:boot.dlx is executed

VS1010>reboot 4
C#0d1d at runlevel 4
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 4
SPIF:c217, 16384K
SD:15193 MiB

VS1010D patch SPI flash write
Relocked (3007)  < ---- Flash is formatted and F:boot.dlx, F:sys/usbhost4.dlx are copied

C#0d1d
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 15
SPIF:c217, 16384K
SD:15193 MiB

VS1010D patch SPI flash write  <---- F:boot.dlx executes

VS1010>liblist
0: 0x1000:boot.dlx I[0x80..0x10d] X[0x1000..0x1033] Y[0x1000..0xfff] 
1: 0x1034:LIBLIST.DLX I[0x10e..0x17f] X[0x1034..0x10b7] Y[0x1000..0xfff] 

VS1010>usbhost4
USB: 961M USB store

VS1010>devices
D: SD/SD Card
F: SPI Flash c217
I: STREAM
R: ROMDISK
S: SPI Flash c217
U: 961M USB store

VS1010>play u:*.mp3
regh
Senior User
Posts: 39
Joined: Thu 2020-11-05 13:50

Re: Production programming using SPI Flash as program memory

Post by regh »

Managed to track my problem down to gpio settings - I had my development board set to use all of the buttons available, and buttons 2 and 3 are connected to the spi lines that connect to the spi flash. As soon as I try to set the gpio for button 2 as an input I then get the corruption message. I assume there's a note about this somewhere that I've just missed. Anyway, I know I can get the code to run from the flash now and this won't be a problem with the pcb we're designing.
User avatar
Panu
VSDSP Expert
Posts: 2816
Joined: Tue 2010-06-22 13:43

Re: Production programming using SPI Flash as program memory

Post by Panu »

Great that you found the root cause! Glad that it's working now.

-Panu
Post Reply