Arduino library for Flash Memory Chips (SPI based only)
Download the latest stable release (v3.2.0) from here. Please report any bugs in issues.
This Arduino library is for use with flash memory chips that communicate using the SPI protocol. In its current form it supports identifying the flash chip and its various features; automatic address allocation and management; writing and reading a number of different types of data, ranging from 8-bit to 32-bit (signed and unsigned) values, floats, Strings, arrays of bytes/chars and structs to and from various locations; sector, block and chip erase; and powering down for low power operation.
ESP32 Boards (Tested on the Adafruit ESP32 Feather) The library is known to work with the ESP32 core as of the commit 25dff4f on 05.04.2018. ESP32 support will remain in beta till the ESP32 core can be installed via the Arduino boards manager.
NOTE: ESP32 boards usually have an SPI Flash already attached to their SS pin, so the user has to declare the ChipSelect pin being used when the constructor is declared - for example
SPIFlash flash(33);
Flash memory compatibility
Completely supported (Actually tested with)
Winbond
W25Q16BV
W25Q64FV
W25Q80BV
W25Q256FV
Microchip
SST25VF064C
SST26VF064B
Cypress/Spansion
S25FL032P
S25FL116K
S25FL127S
ON Semiconductor
LE25U40CMC
AMIC
A25L512A0
Micron
M25P40
Adesto
AT25SF041
Should work with (Similar enough to the ones actually tested with)
Winbond (All SPI Flash chips)
Microchip (SST25 & SST26 series)
Cypress/Spansion (S25FL series)
Any flash memory that is compatible with the SFDP standard as defined in JESD216B
Installation
Option 1
Open the Arduino IDE.
Go to Sketch > Include Library > Manage libraries.
Search for SPIMemory.
Install the latest version.
Option 2
Click on the 'Clone or download' button above the list of files on this page .
Select Download ZIP. A .zip file will download to your computer.
Unzip the archive and rename resulting folder to 'SPIMemory'
Move the folder to your libraries folder (~/sketches/libraries)
Change log
v3.2.0
Library name changed to SPIMemory
The library now gathers sfdp information through _chipID(). SFDP information is collected when available, otherwise the library defaults to using code from v3.1.0 to ID the chip.
Enhancements & Optimizations:
The library now does the following - if the flash memory chip is compatible with the SFDP standard
Identifies the flash memory chip using the Serial Flash Discoverable Parameters standard. (JESD216B)
Identifies the following opcodes from the SFDP tables and uses them to read/write data:
- eraseSector, eraseBlock32K, eraseBlock64K
Reads timing information from SFDP to accurately time the following operations:
- eraseSector, eraseBlock32K, eraseBlock64K
New flash memory chips supported:
All flash memories compatible with the SFDP standard (as at JESD216B) should be compatible with the library