I2C SPI USB CAN eSPI Cable Testing View All Quick Start Guides User Manuals Software Downloads Knowledge Base Videos Case Studies App Notes White Papers Sales Support About Us
Products Blog Sales Support Contact Search
Programming 4 Byte Address Mode SPI Flash Using Cheetah Adapter and Flash Center
Programming 4 Byte Address Mode SPI Flash Using Cheetah Adapter and Flash Center

Introduction

Programming SPI memory devices is a common use case for the Cheetah Adapter. There are several ways to do this with the Cheetah adapter, including using Cheetah GUI, Flash Center, or the Cheetah API. Using the Cheetah SPI Host Adapter 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 4 byte address mode SPI flash with Flash Center and Cheetah adapter. Although the following describes the Micron SPI Flash N25Q256A 3.3V SOIC 16 assembled on the Flash SOIC-16 Socket Board, similar steps can be used for other devices. The goal of this article is to demonstrate how to program 4 byte address mode SPI flash and then read back the data

Overview

In this article the Cheetah adapter erases, programs and reads the N25Q256A. Here the Cheetah adapter is the SPI master and the SPI flash on the socket 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.

4 Byte Address Mode SPI Memory Details

SPI devices with size of 128 Mb (16 MB) and below (such as N25Q128A) uses addresses that only require 3 bytes, and therefore they have one address mode: 3 byte address mode.

SPI flash devices with memory size of 256 Mb (32 MB) and above (such as N25Q256A) use addresses that require up to 4 bytes, and therefore they have two address modes: 3 byte address mode and 4 byte address mode. This includes memory with the size of 256Mb (32 MB), 512 Mb (64 MB), 1Gb (128 MB), and 2 Gb (256 MB).

Some of the SPI flash devices (such as N25Q256A) have multiple Read instructions including: Read and Fast Read.

  • Read - is used for reading without dummy bytes.

  • Fast Read - is used for reading with dummy bytes

Flash Center Parameter Details

Many memory devices are included in the Flash Center’s parts list by default. Each memory device is described with programming parameters in an XML file. The 4 byte address mode SPI devices have two specials programming parameters: extendedAddressingEnableInstruction and addressWidth. There are several 4 byte address mode devices included in Flash Center, such as the N25Q256A, and these parameters are already configured in the relevant XML files. For other 4 byte address mode devices that are not included in the default Flash Center parts library, the user can use these parameters in a new XML file.

  • extendedAddressingEnableInstruction - is used to define the instruction for enabling the 4 byte address mode for large memory devices.

  • addressWidth - is used to define the number of bytes in the memory address field when reading from and writing to the device. If the address has overflow bits they will automatically be added to the device address (I2C) or command code (SPI). Value must be non-zero.

  • readDummyBytes - is used to define the number of padding bytes inserted in between the readInstruction and shifting data out of the device. Typically, this parameter only needs to be set for flash devices with a “fast read” command.

N25Q256A Details

For reference, listed below are several of the N25Q256A instructions used by Flash Center during the programming process. When creating XML files for 4 byte address mode devices that are not included by default in Flash Center, it's helpful for the user to become familiar with these instructions. See the device datasheet for additional details.

Figure 1: N25Q256A Instructions List

N25Q256A Instructions List

  • The N25Q256A Write Enable instruction (0x06) - sets the Write Enable Latch bit. The Write Enable Latch bit must be set prior to any Write operation (Program / Erase) and Write Status Register instruction.

  • Figure 2: N25Q256A Write Enable Instruction

    N25Q256A Write Enable Instruction

  • The N25Q256A Enter 4 Byte Address Mode instruction (0xB7) - is used for enabling the 4 byte address mode. This instruction includes the instruction code. The default address mode is three bytes.

  • The N25Q256A Read instruction (0x03) - is used for reading the data without dummy byte.

  • Figure 3: N25Q256A Read Instruction

    N25Q256A Read Instruction

  • The N25Q256A Fast Read instruction (0x0B) - is used for reading the data with dummy byte.

  • Figure 4: N25Q256A Fast Read Instruction

    N25Q256A Fast Read Instruction

Memory Programing and Reading Guidelines

  1. Download and run the latest version of the Total Phase USB Drivers Installer.
  2. Download and unzip the latest version of Flash Center. (?)
  3. Connect the Cheetah adapter to the PC via the USB connector.
  4. Connect the Cheetah adapter to the flash socket board via the I2C/SPI connector. (?)
  5. Launch Flash Center. (?)
  6. Connect the Cheetah adapter to Flash Center. (?)
    1. Click Adapters > Add Adapters.
    2. Select the Cheetah adapter.
    3. Click Add to connect to the adapter.
  7. Enable Target Power. (?)
  8. Click Operations > Choose Target and choose N25Q256A. (?)
  9. Configure Bit Rate to 40 MHz. (?)
  10. Read the memory device (?).
    1. Click Operations > Read Target.
  11. Figure 5: Cheetah Adapter Reads From N25Q256A

    Cheetah Adapter Reads From N25Q256A

  12. Program the N25A256A, and read (?).
    1. Click Operations > Program + Verify > Click OK.
    2. Click Operations > Read Target.
  13. Figure 6: Cheetah Adapter Writes to N25Q256A and Reads

    Cheetah Adapter Programs N25Q256A and Reads

Notes

For additional information, take a look at the Cheetah adapter user manual, Flash Center manual and Flash Socket Board User Manual.