Support Question of the Week: What are the Guidelines to Program SPI Flash Using the Cheetah SPI Host Adapter and the Flash Center Software? (Part 1)

This week’s article is about using a CheetahTM SPI Host Adapter for programming SPI EEPROM and flash devices, which can be done using CheetahTM GUI Software, Flash CenterTM Software, or the CheetahTM Software API. This example will use the ST Micro SPI Flash M25P32 mounted on an SPI Flash Demo Board, and the Flash Center Software to program SPI flash devices and then read back the data.

Using the Cheetah SPI Host Adapter with the Flash Center software makes it easy to program SPI EEPROM and SPI Flash devices. With one Flash Center Software click, erase, program, and verify an entire device. Note – with some modification, this example can be used for other devices.

Overview of the Flash Center Software

In this example, the Cheetah adapter erases, programs and reads the M25P32. Here the Cheetah adapter is the SPI master and the SPI flash on the SPI Flash Demo board is the SPI slave.

First, we will go over the operations options provided by Flash Center. Specifically, there are three programming modes: Program + Verify, Program, and Program (No Erase). In addition there are Read Device, Verify, and Erase operations.

  • Program + Verify - Writes data to one or more attached memory devices and then reads back the data to verify it for correctness. If the device is an SPI Flash, an erase cycle will be performed first. The erase will cover only those sectors, which will be written. Note that it is possible to erase more data than is written if a write ends in the middle of a sector. A warning will be logged if this is the case. Also, if the data to be written is large enough to require the entire device to be erase, and the memory device has an “erase all” instruction, the software will use the “erase all” instruction.
  • Program - Writes data to the device, but does not perform the verification step. If the device is an SPI Flash, an erase cycle will be performed first, with the same caveats as Program + Verify.
  • Program (No Erase) - A special mode for SPI Flash devices. It writes data to the device, but does not perform an erase cycle. This is useful if multiple memory images are to be programmed to the device. Use FF as the pad value when loading each memory image to avoid corrupting previously written data. Because the device may have been programmed prior to this operation, it does not perform the verification step.
  • Read Device - Reads the contents of the selected device and replaces it in the current contents in the data buffer.
  • Verify - Verifies the contents of the selected devices against the contents of the data buffer.
  • Erase - Allows the user to erase the entire memory device or allows the erasure of portion of it. For partial erasure, users can specify the start addresses and length in the erase parameters dialog as either a decimal value or as a hexadecimal value.

Details about the M25P32 SPI Flash

The 32 Mbit (4M bytes) SPI Flash M25P32 found on the SPI Flash Demo Board has 64 sectors. Each sector has 256 pages or 65,536 (64K, 0x10000) bytes. Each page has 256 bytes. Therefore, the memory has 16,384 pages or 4,194,304 (0x400000) bytes. The entire memory can be erased using the Bulk Erase instruction, or one sector at a time using the Sector Erase instruction. For reference, the M25P32 instructions list and memory map are provided below. For additional information about the SPI Flash M25P32, please refer to the M25P32 datasheet.

 

M25P32 Memory Map Figure 1: M25P32 Memory Map

 

M25P32 Instructions List Figure 2: M25P32 Instructions List

 

Part 2 of this article provides the instructions for programming an SPI device.

For more information, please refer to the following documents:

Cheetah Adapter User Manual
Flash Center Manual
High-Speed Flash Demo Board User Manual
Programming SPI Flash Using Cheetah Adapter and Flash Center
Total Phase Products
Product Selector Guide

We hope this answers your question. If you have other questions about our Cheetah, SPI Host Adapter or other Total Phase products, feel free to email us at sales@totalphase.com or submit a request for technical support.

Leave a Reply