Programming an SPI Flash Using the Promira Serial Platform and the Flash Center Software – Total Phase
Programming an SPI Flash Using the Promira Serial Platform and the Flash Center Software

Introduction

Programming SPI memory devices is a common use case for the Promira™ Serial Platform with SPI Active - Level 1 Application. There are several ways to do this with the Promira Serial Platform with SPI Active - Level 1 Application, including using Control Center™ Serial Software, Flash Center™ Software, or the Promira Software API. Using the Promira platform with the Flash Center Software makes it extremely easy to program EEPROM and flash devices. With one Flash Center click the user can erase, program, and verify an entire device. This article focuses on how to program SPI flash with Flash Center and a Promira platform. Although the following describes the ST Micro SPI Flash M25P32 assembled on the High-Speed SPI Flash Demo Board, similar steps can be used for other devices. The goal of this article is to demonstrate how to program SPI flash and then read back the data

Overview

In this article the Promira platform erases, programs and reads the M25P32. Here the Promira platform is the SPI master and the SPI flash on the SPI Flash Demo board is the SPI slave.

It's first helpful to understand the different 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.

 

M25P32 Details

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 whole memory can be erased using the Bulk Erase instruction, or a sector at a time, using the Sector Erase instruction. For reference, provided below are the M25P32 instructions list and memory map. For additional information about the SPI Flash M25P32 take a look at the M25P32 datasheet.

Figure 1: M25P32 Memory Map

M25P32 Sectors Map

Figure 2: M25P32 Instructions List

Memory Programing and Reading Guidelines

  1. Connect the Promira platform USB connector to the PC USB connector.
  2. Follow the instructions in Section 3.2 - Connectivity of the Promira platform user manual to configure the Ethernet over USB interface.
  3. Download and unzip the latest version of Flash Center. (?)
  4. Connect the Promira platform I2C/SPI connector to the SPI Flash Demo board through the 34-10 cable. (?)
  5. Launch Flash Center. (?)
  6. Connect the Promira platform to Flash Center. (?)
    1. Click Adapters > Add Adapters.
    2. Select the Promira platform.
    3. Click Add to connect to the Promira platform.
  7. Configure Target Power (Pin 4, 6) to 5V; IO Power (Pin 22, 24) to Disable, Level Shift to 3.3V. Enable Target Power. (?)
  8. Click Operations > Choose Target and choose M25P32. (?)
  9. Configure Bit Rate to 12.5 MHz. (?)
  10. Read the memory device (?).
    1. Click Operations > Read Target.

    Figure 3: Promira platform reads from M25P32

  11. Program the M25P32, and read (?).
    1. Click Operations > Program + Verify.
    2. Click Operations > Read Target.

    Figure 4: Promira platform writes to M25P32 and reads

Notes

For additional information, take a look at the Promira platform user manual, Flash Center manual and SPI Flash Demo Board User Manual.

Have more questions? Submit a request