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 Search
Writing and Reading from SPI Flash Using Cheetah Adapter and Cheetah GUI
Writing and Reading from SPI Flash Using Cheetah Adapter and Cheetah GUI

Introduction

Programming and reading 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. This article focuses on how to take the information in a flash datasheet and execute the commands in Cheetah GUI. Although the following describes the SPI Flash M25P32 found on the SPI Flash Demo Board, similar steps can be used for other devices. The goal of this article is to demonstrate how to write several bytes to a specific address and then read back those bytes

Overview

In this article the Cheetah adapter erases the M25P32, writes and reads the Status Register, writes and reads three bytes (0x0A 0x0B 0x0C) from address 0x08. Here the Cheetah adapter is the SPI master and the SPI flash on the demo board is the SPI slave. The article uses multiple M25P32 instructions, which are described below.

Figure 1: M25P32 Instructions List

M25P32 Instructions List

The M25P32 Write Enable instruction (0x06) sets the Write Enable Latch bit. The Write Enable Latch bit must be set prior to every Page Program, Sector Erase, Bulk Erase, and Write Status Register instruction.

Figure 2: M25P32 Write Enable Instruction

M25P32 Write Enable Instruction

The M25P32 Write Status Register instruction (0x01) allows new values to be written to the Status Register. This instruction includes the instruction opcode, and the required status register value. The Status Register includes the following bits: Write In Progress (WIP), Write Enable Latch (WEL), Block Protect (BP2, BP1, BP0), and Status Register Write Disable (SRWD).

Figure 3: MP25P32 Write Status Register instruction

M25P32 Write Status Register Instruction

The M25P32 Read Status Register instruction (0x05) allows the Status Register to be read. This instruction includes the instruction opcode. Then the Status Register content is shifted out.

Figure 4: M25P32 Read Status Register Instruction

M25P32 Read Status Register Instruction

The M25P32 Page Program instruction (0x02) is used for programing the memory bytes. This instruction includes the instruction code, three address bytes, and at least one data byte.

Figure 5: M25P32 Page Program Instruction

M25P32 Page Program Instruction

The M25P32 Read Data Bytes instruction (0x03) is used for reading the memory bytes. This instruction includes the instruction code, and three address bytes. Then the memory contents, at that address, is shifted out. For additional information about the SPI Flash M25P32 take a look at the M25P32 datasheet.

Figure 6: M25P32 Read Data Bytes Instruction

M25P32 Read Data Bytes 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 Cheetah GUI. (?)
    3. Connect the Cheetah adapter to the PC via the USB connector.
    4. Connect the Cheetah adapter to the SPI flash demo board via the I2C/SPI connector. (?)
    5. Launch Cheetah GUI. (?)
    6. Connect the Cheetah adapter to Cheetah GUI. (?)
      1. Click Connect.
      2. Select the Cheetah adapter.
      3. Click Open to connect to the adapter.
    7. Confugure the Modes to Mode 0, Bitrate to 400KHz, Bit Order to MSB, and SS Polarity to Active Low. (?)
    8. Enable SS0, Output Enable, Target Power, and All Bytes. (?)
    9. Erase the entire memory device (?).
      1. Enter 06 in the MOSI Message > Click Send. (This Write Enable instruction sets the Write Enable Latch bit)
      2. Enter C7 in the MOSI Message > Click Send. (This Bulk Erase Instruction erases the memory.)

Figure 7: Cheetah Adapter Erases M25P32

Cheetah Adapter Erases M25P32

    1. Write and read memory Status Register.
      1. Enter 06 in the MOSI Message > Click Send. (This Write Enable instruction sets the Write Enable Latch bit)
      2. Enter 01 00 in the MOSI Message > Click Send. (This Write Status Instruction writes 00 to the memory Status register.)
      3. Enter 05 00 in the MOSI Message > Click Send. (This Read Status Instruction reads 00 from the memory Status register.)

Figure 8: Cheetah Adapter Writes and Reads M25P32 Status Register

Cheetah Adapter Writes and Reads M25P32 Status Register

    1. Write and read memory.
      1. Enter 06 in the MOSI Message > Click Send. (This Write Enable instruction sets the Write Enable Latch bit)
      2. Enter 02 00 00 08 0A 0B 0C in the MOSI Message > Click Send. (This Page Program Instruction writes 0x0A 0x0B 0x0C to memory address 0x08.)
      3. Enter 03 00 00 08 00 00 00 in the MOSI Message > Click Send. (This Read Data Bytes Instruction reads 0x0A 0x0B 0x0C from the memory address 0x08.)

Figure 9: Cheetah Adapter Writes and Reads M25P32 Memory

Cheetah Adapter Writes and Reads M25P32 Memory

Notes

For additional information, take a look at the Cheetah adapter user manual, Cheeath GUI manual and High Speed SPI Flash Demo Board User Manual.