Write application on SPI flash without SD card nor USB

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
MarcoSilenzi
User
Posts: 4
Joined: Tue 2021-04-13 12:29

Write application on SPI flash without SD card nor USB

Post by MarcoSilenzi »

Hello,

I'm developing on VS1010D an application based on usbPlayTest and everything works fine. My application runs from SD card and I also tryed (with success) to load it into SPI flash via USB in "reboot 4" mode.
Now, my target is to load the application into SPI flash without SD card nor USB to reduce product costs.
Is there a possibility to do it? For example via UART?
My system has also another MCU that controls the VS1010D via UART...is it possible to load the application from this MCU into RAM and then reboot to start from RAM? My application is 9KB size and it is inside the SD card with the boot file and config.txt.

Thank you!
User avatar
Panu
VSDSP Expert
Posts: 2818
Joined: Tue 2010-06-22 13:43

Re: Write application on SPI flash without SD card nor USB

Post by Panu »

Hi!

There are a lot of possibilities, but they might involve more work than you think. But first, could you consider bringing SD_CMD, SD_DAT0 and SD_CLK to pads or pins on the PCB? IOVDD, GND and those 3 pins is all that is needed to connect an SD card. You could have an SD card on a separate PCB that you could connect just for production - that would simplify the flow immensely. You could run a prommer program from the SD card, as well as do all sorts of testing and development with those pins available. Could that be a possibility?

-Panu

PS. USB is even more simple, it requires only DP, DN and GND. And for the SPI promming, it uses 12M data rate, so no worries about not using a proper connector, any kind of pin is ok.
Hannu
Senior User
Posts: 176
Joined: Mon 2016-05-30 11:54

Re: Write application on SPI flash without SD card nor USB

Post by Hannu »

I would also recommend running final test and flashing from SD card. It is fastest and easiest. Pads on product and pogopins on test/programming fixture. Power on VS1010 and it executes SD card. The speed limits come from test time and Flash speed.

There is also one gotcha. SD interface pins don't have internal pulls. In your SPI running program, remember set SD-card pins to GPIO out mode. Otherwise you may find unexplainable high current consumption which occurs sometimes on final product and never on your development design.
MarcoSilenzi
User
Posts: 4
Joined: Tue 2021-04-13 12:29

Re: Write application on SPI flash without SD card nor USB

Post by MarcoSilenzi »

Thank you very much Panu! Unfortunately I hard cost constraints, so I would add the circuitry for the SD card or USB only if absolutely necessary.

I saw that Universal Programmer can program SPI flash by loading an image...could I use those programmer in production by adding a connector on the SPI signals? Could I try this solution on the VS1010 board?

Thx
User avatar
Panu
VSDSP Expert
Posts: 2818
Joined: Tue 2010-06-22 13:43

Re: Write application on SPI flash without SD card nor USB

Post by Panu »

Thank you very much Panu! Unfortunately I hard cost constraints, so I would add the circuitry for the SD card or USB only if absolutely necessary.
You don't need to add circuitry for the SD card to your product pcb. Add the circuitry and the SD card to another board, and put just pads for CLK, CMD, DAT, IOVDD and GND to your PCB. Then connect that other board, that has the SD card, capacitors, pull-up resistors and maybe separate LDO and power, to your product pcb during programming. No components need to be added to your product PCB. Only pads on the PCB where you can have a contact with an edge connector or pogo pins in a production jig.
I saw that Universal Programmer can program SPI flash by loading an image...could I use those programmer in production by adding a connector on the SPI signals? Could I try this solution on the VS1010 board?
Not sure if there is support for VS1010 targets.. and anyway, it's a burden to make SPI flash image with boot block, filesystem and the firmware files. In any case, test everything using a VS1010 developer board before you commit your PCB design.

-Panu
MarcoSilenzi
User
Posts: 4
Joined: Tue 2021-04-13 12:29

Re: Write application on SPI flash without SD card nor USB

Post by MarcoSilenzi »

Thanks for your kind response.

I am doing other tests but I have another problem...as I said in the first post I loaded the application in the external flash using the reboot 4 procedure but now, when I turn on the board, my application starts (from external flash) and I can't change the runlevel! I tryed to put the default SD card with no results. How can I reset the external flash and/or go back to factory settings?

Thank you.
Hannu
Senior User
Posts: 176
Joined: Mon 2016-05-30 11:54

Re: Write application on SPI flash without SD card nor USB

Post by Hannu »

Let's unbrick first.

You can wipe your flash with flshtool
Copy flshtool and paramspl.dlx to your SD card sys directory.
Next insert the SD card and reset VS1010 XCS0 grounded (with jumper wire, paperclip or something like that) so it doesn't try to boot from SPI.

devices command should not show SPI flash and SD card should be your S drive.
Initialize and create the F: drive with
flshtool -f
Wipe the filesystem from flash
flshtool -W

On next reboot, you should have empty flash.

Safest way to not brick again is to start your program through s:config.txt. Remember to add [runlevel] tag before it so that it is executed only your desired runlevel. This can be tested with SD card also.

And when starting to populate the flash, rmember to have the boot.dlx patch which fixes SPI flash write bug. Put it first on your SD card, and then on your SPI flash after you have created the file system.
MarcoSilenzi
User
Posts: 4
Joined: Tue 2021-04-13 12:29

Re: Write application on SPI flash without SD card nor USB

Post by MarcoSilenzi »

Thanks Hannu,

it worked perfectly!!
Post Reply