Programming a Single Sector of an SPI Flash Using the Cheetah Adapter and Flash Center – Part 2

Here is part 2 of our Support Question of the Week feature on how to program a single sector of an SPI flash device using the Cheetah SPI Host Adapter and Flash Center Software. In Part 1, we provided an overview of the different programming options available in the Flash Center Software. We also included some background on the specific flash device that we will program below – the M25P32 flash memory.

The following instructions describe how to use the Cheetah SPI Host Adapter to program data to the first sector, then program data to the second sector without overwriting the data in the first.

  1. Download and run the latest version of the Total Phase USB Drivers Installer.
  2. Download and unzip the latest version of Flash Center Software.
  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 10-pin header.
  5. Launch Flash Center Software.
  6. Connect the Cheetah adapter to Flash Center.
    • Click Adapters > Add Adapter.
    • Select the Cheetah adapter.
    • Click Add to connect the adapter.
  7. Enable Target Power to provide power to the SPI Flash Demo Board.
  8. Click Operations > Choose Target and choose STMicro M25P32.
  9. Read the contents of the memory device.
    • Click Operations > Read Target.
  10. Write zeros to the first two sectors of the device.
    • Clear the data buffer by clicking on the Clear button. This only clears the software buffer and doesn't change the data on the device.
    • Enter "00" in the Pad field.
    • Click the "Fill..." button, enter a byte count of 131072 (64k x 2 = size of first two sectors), and click OK.
    • Click Operations > Program + Verify to commit the new buffer to the device.
  11. Program 8 bytes to the start of the device to see how Flash Center erases only the necessary sectors.
    • Clear the data buffer by clicking on the Clear button.
    • Type 00 11 22 33 44 55 66 77 in the first 8 bytes in the Data section.
    • Click Operations > Program + Verify > Click Yes. (The warning is displayed because the data supplied does not end on a sector boundary and the entire sector will be erased before programming.)
    • Click Operations > Read Target.
    • Note how the first 8 bytes are as expected and the rest of the first sectors is all 0xFF. Also note that the second sector remains all 0x00.
  12. In order to program data to the second sector and not affect the first, the Program (No Erase) option can be used. However, before doing so, you need to ensure the target sector has been erased.
    • Click Operations > Erase...and select a specific address range starting at 0x10000 with a length of 1. (Flash Center will erase only the necessary sectors to cover the supplied range. In this case, only the second sector will be erased.)
    • Click OK > Yes to erase the entire second sector.
  13. Program 8 bytes to the start of the second sector while not affecting the contents in the first sector.
    • Clear the data buffer by clicking on the Clear button.
    • Enter "FF" in the Pad field.
    • Click the "Fill..." button, enter a byte count of 65536, and click OK. (This data fills the entire first sector and is used as padding since programming 1s, without first erasing, will not affect the existing data.)
    • Type 88 99 AA BB CC DD EE FF at the start of the second sector (address 0x10000).
    • Click Operations > Program (No Erase) to commit the new buffer to the device without first performing an erase.
    • Click Operations > Read Target.
    • Note how the first 8 bytes of the device remain 00 11 22 33 44 55 66 77 and the first 8 bytes of the second sector are 88 99 AA BB CC DD EE FF.

We hope this feature was helpful in learning how to program a single sector of an SPI flash device with our products! If you have any questions about the Cheetah adapter, Flash Center Software, or any other Total Phase products, feel free to contact us at sales@totalphase.com or support@totalphase.com.

Leave a Reply