2009-06-17 07:35:45     Increase Flash Memory

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-06-17 07:35:45     Increase Flash Memory

Samuel Ayet (SPAIN)

Message: 75882   

 

Hi all,

 

We are developing a video over IP application on a BF537 - STAMP and now that we have more or less finished the software the size of the uClinux Image is about 9Mbytes (it includes ffmpeg, MPlaer, linphone...). Of course that our image don't fit in the 4 Mbytes flash storage of the BF537 - STAMP. Now we want to increase the non volatile memory of the custom board based on the BF537 - STAMP to store the u-boot, our 9Mbytes uClinux Image and some configuration files (about 16kbytes), so we need to increase the non volatile memory up to 16Mbytes (128Mbits). We are thinking in two different ways:

 

1) Remove the Parelel NOR flash of the STAMP (4Mbytes) and put a 16Mbytes SPI Flash (for example the M25P128 from Numonyx) and put in it the u-boot, the compressed image of 9Mbytes and the config files. The BF537 will boot first from SPI Flash the u-boot and then u-boot will boot the kernel compressed image stored in SPI. The cons that I have read of this solution is that will boot slower than a typìcal STAMP with the Paralel NOR Flash. I don't know how much time will spend booting from Serial NOR Flash, but just with spending a max of about 10 seconds to boot will be fine for us, we don't need a fast boot.

 

2) Removing the Paralel NOR Flash of the STAMP (4Mbytes) and put a SPI Flash of 512kbytes (M25P40) or 256kbytes (M25P20) to store the u-boot. Then put a NAND flash of 16Mbytes to store the image and the config files. The BF537 will bot from SPI Flash the uboot, and then the uboot will boot from the NAND Flash (faster than SPI). The cons of this solution are the price of using two kinds of memory without needing a fast boot and the need of more space for two memory chips.

 

 

Also we have thougth in a SD/MMC based storage, but we don't know if it's achievable.

 

This is our first Blackfin Based Design so I think you will have more experience in doing this things and here is the questions:

 

What is the best way for you to do it? 1) or 2)?

 

Do you know any other ways?

 

What are the pros and cons that you think of the different ways?

 

 

 

Thank you!

 

P.D. Sorry but I can't explain me in less words...

QuoteReplyEditDelete

 

 

2009-06-17 07:56:17     Re: Increase Flash Memory

Mike Frysinger (UNITED STATES)

Message: 75883   

 

i think your speed requirements would be satisfied with SPI flash alone -- it isnt going to be fast, but it should be under 10 seconds.

 

another option may be to use a larger parallel flash and use GPIOs to handle the higher address lines.  as long as you dont go crossing the higher address boundaries frequently (i.e. dont need to toggle the higher address lines with GPIOs), the speed difference should be pretty much the same.  of course the downside is that parallel nor flash tends to be more expensive than SPI/NAND flashes.  the CM-BF537 and CM-BF527 boards do this already in u-boot and the kernel to get larger flashes.

 

SD/MMC over SPI is doable, but not nearly as stable as SPI/NAND storage currently.  plus the form factor of that will probably be much larger ?

QuoteReplyEditDelete

 

 

2009-06-17 09:41:30     Re: Increase Flash Memory

Robin Getz (UNITED STATES)

Message: 75892   

 

Samuel:

 

SPI flash is the way to go if you want to test things on the STAMP - just connect something to the SPI header - there is no need to "remove" anything..

 

-Robin

QuoteReplyEditDelete

 

 

2009-06-17 13:10:18     Re: Increase Flash Memory

Steve Strobel (UNITED STATES)

Message: 75913   

 

Samuel Ayet wrote:

> ...put a 16Mbytes SPI Flash (for example the M25P128 from Numonyx) and

> put in it the u-boot, the compressed image of 9Mbytes and the config files.

> The BF537 will boot first from SPI Flash the u-boot and then u-boot will boot

> the kernel compressed image stored in SPI. The cons that I have read of this

> solution is that will boot slower than a typìcal STAMP with the Paralel

> NOR Flash. I don't know how much time will spend booting from Serial NOR Flash,

> but just with spending a max of about 10 seconds to boot will be fine for us,

> we don't need a fast boot.

 

We are doing exactly what you describe on several custom designs based on the BF537 stamp.  U-Boot comes up almost immediately, does a countdown for two seconds, then starts loading the uClinux image into memory.  We load 13.5MB even though our image isn't (yet) that large, which takes about 16 seconds.  Linux then boots, which takes about 4 seconds and all of our apps start up which takes another 6.  All together, it takes about 30 seconds from power up to having a fully-functional system.

 

Boot time isn't critical in our application, but it would certainly be nice to reduce it so I would be willing to try some things that might help you determine what design to go with.  Obviously the biggest factor in our case is the time spent reading from the SPI flash chip itself.  That is done using the U-Boot command "eeprom read $(loadaddr) 0x80000 0xD80000".  I think U-Boot is configured to clock the SPI interface at 25MHz.  As I recall, the chip is spec'ed at 75MHz, so we also tried it at 50MHz and couldn't get it to work at that speed.  It is located only about 1/4" from the BF537, but I can't remember what else is on that SPI bus, so the limitation might be due to loading.

 

Best case in our application, we could make U-Boot skip the countdown and save two seconds, then clock the SPI twice as fast and save eight seconds for a total startup time of 20 rather than 30 seconds.  If you loaded only 9MB rather than 13.5MB you could shave off maybe another 2.5 seconds.  If your apps load faster than ours, you might get it down to 15 seconds.

 

Steve

QuoteReplyEditDelete

 

 

2009-06-17 13:15:07     Re: Increase Flash Memory

Mike Frysinger (UNITED STATES)

Message: 75914   

 

the Blackfin SPI bus maxes out at 1/4 of SCLK, so the fastest it could ever be is 133/4 -> 33mhz

 

you didnt say what version of u-boot you're using ... make sure your eeprom implementation uses DMA to transfer.  look at the latest spi_flash.c driver in trunk (you should be able to drop it into any version of u-boot iirc).

QuoteReplyEditDelete

 

 

2009-06-17 14:58:21     Re: Increase Flash Memory

Frank Van Hooft (CANADA)

Message: 75915   

 

We are also using an SPI serial flash as the only flash memory on our board. One advantage not already mentioned here is that it makes the PCB layout much easier. After all, the SPI flash has only 4 signal lines, compared to a lot more than that for any parallel flash, plus they don't overlap with any SDRAM signals.

QuoteReplyEditDelete

 

 

2009-06-17 15:40:16     Re: Increase Flash Memory

Steve Strobel (UNITED STATES)

Message: 75917   

 

On boot, U-Boot prints the following version info.  I think the SVN rev is from our local repo:

 

    U-Boot 1.1.6-svn63 (ADI-2008R2-pre) (Mar 19 2008 - 07:43:49)

 

I just put the scope on the clock line.  While copying the flash to memory, the clock runs in bursts.  While running, the clock rate is 25MHz.  Each burst contains eight low-going clock pulses and takes about 312nS.  It then remains high for about 740nS.  In other words, it is active only about 42% of the time.  If using DMA would increase that to 100%, it could cut about nine seconds off of our boot time.

 

Thanks, Mike, for the info about using DMA.

 

Steve

QuoteReplyEditDelete

 

 

2009-06-17 15:48:28     Re: Increase Flash Memory

Steve Strobel (UNITED STATES)

Message: 75918   

 

I just stumbled across some old notes I took about booting U-Boot from the SPI flash and thought they might be interesting to someone:

 

I was concerned about how long it would take to boot from SPI flash, since its starts up with only a 186KHz SPI clock speed. To load the 120KB U-Boot LDR file, it would take at least 5.5 seconds at that rate. Considering that U-Boot can read the same 120KB in 67mS using a 25MHz clock speed, that seemed like a waste.  Apparently, however, the loader file speeds up the clock rate partway through. It appears to run at 186KHz for the first 16mS while it loads the first four blocks of the loader file (the first three small, the fourth larger). It then switches to 12.5MHz for 91mS, waits for 20mS (maybe while zeros memory), then clocks at ???MHz for 28mS. The total transfer time is only 156mS, so it isn't a major factor in boot time.

 

If you have trouble getting the Blackfin to boot at all from SPI flash, make sure that the MISO line is pulled up.  The Blackfin tries to autodetect the address sized used by the SPI flash by writing an 8, then 16, then 32-bit address and watching for a response on the MISO line. The flash should ignore addresses that are too short, leaving MISO high-Z. A pullup makes it read 0xFF until a valid address is sent.

 

Steve

QuoteReplyEditDelete

 

 

2009-06-17 18:30:27     Re: Increase Flash Memory

Robin Getz (UNITED STATES)

Message: 75922   

 

Steve:

 

Have a look at:

 

https://docs.blackfin.uclinux.org/doku.php?id=fast_boot_example

 

To get an idea of boot times.

 

-Robin

QuoteReplyEditDelete

 

 

2009-06-18 05:59:52     Re: Increase Flash Memory

Samuel Ayet (SPAIN)

Message: 75956   

 

Ok Thank you all for the information and support.

 

If you told me that you are working with the SPI Flash (M25P128) solution I'm really convinced that we will take this solution. Also, we have space limited in the board we are designing despite of the fact that we are using 64Mbytes of ram in only one chip (MT48LC32M16) instead of 2x 32Mbytes (2x MT48LC32M8) like in the BF537 - STAMP, so 4-wire SPI will be the best way to reduce memory buses in our board.

 

I have lost the count of the boot time, but if yo told me that I will spend about 20 (without using DMA) and then I will save 9 seconds, 11 seconds will be ok. Our application also don't have time requierements of boot time but of course it can't spend 1 minute... so 10 to 15, even 20 seconds will be enough for us. Also I saw in the fast_boot_example a SPI boot uClinux of 1.4s so a boot of 10 to 20 seconds I think will be achievable.

 

When I told 'Remove the Paralel Flash', I meant to do it in the design of our custom boards based on the STAMP, not in the STAMP. Sorry for the confusion, but don't worry, I won't remove the paralel flash of the STAMP.

 

Now we have to build an ad-on card of the M25P128 and when we have it ready to run (I hope about 1 week), I will ask about things I have to change in the u-boot (use of DMA) and in the board resources file (maping the spi flash) because I'm not sure of what to change and where to change, but I will ask you this after read some information of what and where to change things to add the SPI Flash in the u-boot and in the board resources and also after have the SPI - Board.

 

Samuel

QuoteReplyEditDelete

 

 

2009-06-18 07:10:02     Re: Increase Flash Memory

Mike Frysinger (UNITED STATES)

Message: 75960   

 

there are schematics available in the hardware project on this site for SPI flash cards that you should be able to leverage

QuoteReplyEditDelete

 

 

2009-06-18 07:55:10     Re: Increase Flash Memory

Samuel Ayet (SPAIN)

Message: 75963   

 

Yes, I have seen them and I have them. There is a M25P SOIC16 chip in the STAMP SPI FLASH that is exactly the same of what I will use. Thank you!

Attachments

    Outcomes