Skip to content

Arduino Library for SPI Flash memory chips

Compare
Choose a tag to compare
@Marzogh Marzogh released this 10 Dec 13:55
· 226 commits to stable since this release
6d88fb4

SPIFlash Build Status DOI

GitHub release
GitHub commits
GitHub issues
GitHub pull requests
license


Please report any bugs in issues


Arduino library for Flash Memory Chips (SPI based only)

Download the latest stable release (v3.0.1) 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.

  • For details of the Flash chips compatible with this library please refer to the list below.

Compatibility

Arduino IDEs supported (actually tested with)
  • IDE v1.5.x
  • IDE v1.6.0-v1.6.5
  • IDE v1.6.9-v1.6.12
  • IDE v1.8.1-v1.8.5
Boards
Completely supported
  • Arduino Uno
  • Arduino Leonardo
  • Arduino Due
  • Arduino Zero
  • Nucleo-F091RC
  • Adafruit Feather M0
  • Adafruit Feather M0 Express
  • ESP8266 Boards (On the Arduino IDE)
  • Simblee Boards (On the Arduino IDE)
  • Arduino Mega
  • Arduino Micro
  • Arduino Fio
In BETA
  • ESP32 Boards (Tested on the Adafruit ESP32 Feather) The library is known to work with the ESP32 core as of the current commit 8ba91b9 on 07.11.2017. ESP32 support will remain in beta till the ESP32 core can be installed via the Arduino boards manager.
    NOTE: ESP32 boards usually have an SPIFlash 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
    • S25FL116K
Should work with (Similar enough to the ones actually tested with)
  • Winbond (All SPI Flash chips)
  • Microchip (SST25 & SST26 series)
  • Cypress/Spansion (S25FL series)

Installation

Option 1
  • Open the Arduino IDE.
  • Go to Sketch > Include Library > Manage libraries.
  • Search for SPIFlash.
  • 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 'SPIFlash'
  • Move the folder to your libraries folder (~/sketches/libraries)

Change log

v3.0.1

Bugs Squashed:

Thanks for catching and fixing the following @hanyazou (PR #101)

  • Added missing break statements in SPIFlash::_beginSPI() because that lacks some essential break statement in switch/case. (commit 1: 1de2c10)
  • The library did not wait until the busy bit in SR1 was cleared. Timeout argument of _notBusy() must be in micro-second. 500L means 500 micro seconds which is too short to wait for completion of erase command. Added " * 1000" to the arguments. (commit 2: 9633c2f)
  • Modified TestFlash.ino to check error of erase commands execution. (commit 3: a179306)

  • Fixes a major bug that was causing input Arrays to be overwritten by zeros during the writeByteArray() / writeCharArray() process. Thanks for catching this @hanyazou. (Issue #102)(Fixed in commit 7799639)
Enhancements & Optimizations:
New flash memory chips supported:

--> S25FL127S