I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Account Search
How Can I Optimize Programming Multiple Images into Different Sectors of an SPI Flash Memory?

Question from the Customer:

I saw your knowledge base article that describes how to program multiple images into SPI flash at a different offset, and I used it for the Aardvark I2CSPI Host Adapter: Programming a Single Sector of an SPI Flash Using the Cheetah Adapter and Flash Center. I followed the instructions in that article, but found the write times to be too long. In my case, the first image size is 500 kB. It took around 1-2 minutes to program the file into offset 0, sector 0.  The second image is only 4 kB, but it took five minutes to program it into offset 3F0000, sector 63 of the flash.

Is there a way to improve the speed? Can I directly tell the Flash Center Software which offset addresses for programming different sectors?

Response from Technical Support:

Thanks for your question! The Flash Center Software provides advantages to quickly erase, program and verify I2C and SPI memory devices. However, the architecture of the Flash Center tool causes it to start at offset 0, which includes when you are programming a different sector within a device.  As shown in step 13 of that knowledge base article, you are filling the earlier sectors with 0xFF or all "ones" to not change the previously programmed values.

 Example of Programming Sectors Using the Flash Center Software
Figure 1: Example of Programming Sectors Using
the Flash Center Software

The Flash Center algorithm then writes the 0xFF values to the sectors 0 through 62 before writing to the 63rd sector. In effect, you are programming the whole device and programming the last sector can take as long as programming the entire image.

We do have more tools available, and they will make your work much faster. For your project, we recommend using the Aardvark Software API, which supports the C, C#, VB, .NET and Python programming languages. The API provides working examples that you may use as-is or modify to meet your specific needs. One example file provided, aaspi_eeprom.py, is specifically for programming an EEPROM.  You can easily adapt this program for your use in programming your flash device.

For example, for your SPI flash memory, you could choose a specific offset directly in your code to start the write process to the flash device. This way, writing pages or sectors would be much faster than with the Flash Center Software - you can start the write cycle at any page within the device. For more information about API software, please refer to section 5 of the Aardvark I2C/SPI User Manual.

You can also look at a Promira Software API example, which we provide for our Promira Serial Platform, that programs the N25Q series of flash memory devices from Micron.  The Promira API is different from the Aardvark API - it is an applicable reference and provides useful guidelines. For details about Promira API, please refer to section 6 of the Promira Serial Platform User Manual.

 Promira Serial Platform for programming selector sector of SPI memory devices
Figure 2: Promira Serial Platform

The Promira Serial Platform - this is an advanced, robust device that provides additional advantages, such as support for dual and quad IO SPI for writing and reading, a greater range of speed and many more features that can benefit your projects.

Additional resources that you may find helpful include the following:

We hope this answers your question. If you have other questions about our host adapters, serial platforms or other Total Phase products, feel free to email us at sales@totalphase.com, or if you already own one of our devices and have a technical question, please submit a request for technical support.

Leave a Reply