SPI Flash problems

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

SPI Flash problems

Post by regh »

Hi. We're having some problems running an SPI flash on a custom PCB. We think the problem could be related to the device not have a REMS command, as stated in the hand book. From our research, there do not seem to be many devices which support the expected REMS response format and have some questions about alternatives:
(a) What happens if we have a device which returns a size value interpreted as a value much bigger than the actual size? (i.e. it's treated as 2048 kB but is really much smaller).
(b) If we use a device which does not support the REMS command, or does not return the size exponent expected, how do we tell the VS1010 what the actual device size is?

The chip on the development board seems to be out of stock everywhere.
Hannu
Senior User
Posts: 176
Joined: Mon 2016-05-30 11:54

Re: SPI Flash problems

Post by Hannu »

Hi.

So you are sure that the REMS isn't working? and the problem isn't with the board like some line stuck at high or low?

There are a few ways to go around the problem. VS1010 tries to read bootrecord from block 0, that program can set correct size and init SPIflash. another is to just have correct size of filesystem and use the existing part of the flash.

If I understood correctly, you get some SPI flash device with wrong size? Can you execute own programs from SD card?

So my strategy would be poke the SPIflash hardwareInfo to have correct totalSectors publish it through USB and format to correct size and then create master image with flshtool and use it to create clones.
Something like this could be used as basis for the poking operation and publishing it through USB for formatting

Code: Select all

#include <SpiFlash.h>
...
MyPokerFunction(DEVICE *dev, u_int16 mykB){
SPIFLASH_HWINFO *hw = (void*)&(dev->hardwareInfo);
hw->reservedSectors = myKb;
hw->totalBlocks = (myKb*2) - RESERVED_SECTORS;
VODEV('U') = dev;
UsbBootLoopNoReturn();
}
flshtool can be found: viewtopic.php?f=15&t=2630

I'll try to find some time to add size setting feature to flshtool, but not now.

And remember to have the boot.dlx patch so that flash write doesn't break if you boot from SD.

I hope this helps you.
regh
Senior User
Posts: 43
Joined: Thu 2020-11-05 13:50

Re: SPI Flash problems

Post by regh »

Hi Hannu

Thanks for your response, this is useful if we have to use different flash.
We managed to get our device working by changing the flash to one that supported the Rems command in the format the VS1010 wants. Do Vlsi have a list of supported flash chips that will work straight out of the box (don't need any boot images made)?
Hannu
Senior User
Posts: 176
Joined: Mon 2016-05-30 11:54

Re: SPI Flash problems

Post by Hannu »

Nice to hear that you found more compliant flash.

There is no list available as so far everything has worked almost nicely. Only exception was SPI NAND flash and even that can be made to bootstrap itself to read only. There is a thread how Panu got it usable state.

It is enough to just have normal read function and write protection remove function if the flash is normally write protected and writing is wanted.
Filesystem determines the usable size of the disk. And after the filesystem is created, REMS really doesn't matter. And after there is file system, boot.dlx can do all the wanted tricks and patches.

So far no-one hasn't written FAT12 format for VSOS as usually the filesystem is created by PC or ready images are written to the flash.

Anyway I'll keep this feature in mind when I write more tools which work with flashes.
User avatar
pasi
VLSI Staff
Posts: 1795
Joined: Thu 2010-07-15 16:04

Re: SPI Flash problems

Post by pasi »

A random tidbit: To determine the FLASH size, REMS is used instead of RDID, because in RDID the FLASH Size information byte is manufacturer-defined. At least one unnamed manufacturer has decided to use the size byte as Binary Coded Decimal (BCD) instead of normal hex value.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply