Skip to content

Releases: Marzogh/SPIMemory

Arduino Library for SPI Flash & FRAM memory chips

03 Jun 02:53
1f1e4de
Compare
Choose a tag to compare

SPIMemory Build Status DOI

Formerly known as SPIFlash.

GitHub release GitHub commits GitHub issues GitHub pull requests license


Please report any bugs in issues


Arduino library for Flash & FRAM Memory Chips (SPI based only)

Download the latest stable release from here. Please report any bugs in issues.

This Arduino library is for use with flash and FRAM memory chips that communicate using the SPI protocol. In its current form it supports identifying the flash/FRAM 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.


IDE Compatibility (actually tested with)

  • Arduino IDE v1.5.x
  • Arduino IDE v1.6.x
  • Arduino IDE v1.8.x

Platform compatibility

Micro controllers Dev boards tested with Notes
ATmega328P Arduino Uno, Arduino Micro,
Arduino Fio, Arduino Nano
-
ATmega32u4 Arduino Leonardo, Arduino Fio v3 -
ATmega2560 Arduino Mega -
ATSAMD21G18 (ARM Cortex M0+) Adafruit Feather M0,
Adafruit Feather M0 Express,
Adafruit ItsyBitsy M0 Express
-
AT91SAM3X8E (ARM Cortex M3) Arduino Due -
nRF52832 (ARM Cortex M4F) Adafruit nRF52 Feather -
ATSAMD51J19 (ARM Cortex M4) Adafruit Metro M4 -
STM32F091RCT6 Nucleo-F091RC
STM32L0 Nucleo-L031K6
ESP8266 Adafruit ESP8266 Feather,
Sparkfun ESP8266 Thing
-
ESP32 Adafruit ESP32 Feather,
Sparkfun ESP32 Thing
Onboard flash memory. Refer to footnote£ below.
Simblee Sparkfun Simblee -

£ ESP32 boards usually have an SPI Flash already attached to their default SS pin, so the user has to explicitly declare the ChipSelect pin being used with the constructor


Flash memory compatibility - Actually tested with

Manufacturer Flash IC Notes
Winbond W25Q16BV
W25Q64FV
W25Q64JV
W25Q80BV
W25Q256FV
Should work with the W25QXXXBV, W25QXXXFV &
W25QXXXJV families
Microchip SST25VF064C
SST26VF016B
SST26VF032B
SST26VF064B
Should work with the SST25 & SST26 families
Cypress/Spansion S25FL032P
S25FL116K
S25FL127S
Should work with the S25FL family
ON Semiconductor LE25U40CMC
AMIC A25L512A0
Micron M25P40
Adesto AT25SF041
Macronix MX25L4005
MX25L4005
Giga devices GD25Q16C (Used on the Adafruit ItsyBitsy M0 Express)
Should work with any flash memory that is compatible with the SFDP standard as defined in JESD216B

FRAM memory compatibility - Actually tested with

Manufacturer Flash IC Notes
Cypress/Spansion FM25W256 Should work with the FM25W family

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

Version 3.4.0

Release date 03.06.2019

Bugs squashed:
  • FastRead works properly now. All previous versions of the library had a FastRead bug that prevent it from doing what it was supposed to.
Enhancements:
  • An alternate version of the constructor
SPIFlash flash(int8_t *SPIPinsArray);

can be used (only with ESP32 boards as of now) to enable the use of custom SPI pins. SPIPinsArray has to be a 4 element array containing the custom SPI pin numbers (as signed integers - int8_t) in the following order - sck, miso, mosi, ss. Refer to the wiki for more information. Resolves #113

  • Created new error code NOCHIPSELECTDECLARED for errors with declaring custom SPI pins.
  • Using other SPI ports (HSPI, VSPI, SPI1, SPI2 etc.) is now also supported on ESP32 boards - along with SAMD and STM32 boards (supported since v3.0.0). Resolves #177
  • Formatted and merged pull request #153. This changes the way setClock() works and allows for the definition of clock speed before the SPI Bus is instantiated. Refer to wiki for further details. Thanks @rambo.
New Microcontrollers supported:
  • nRF52832 ARM Cortex M4F (Adafruit nRF52 Feather)
  • STM32L0 ARM Cortex M0+ (Nucleo-L031K6)
New flash memory chips supported:
  • MX25L4005 & MX25L4005 from Macronix

Arduino Library for SPI Flash & FRAM memory chips

20 Apr 05:57
a0017ec
Compare
Choose a tag to compare

SPIMemory Build Status DOI


Formerly known as SPIFlash.


GitHub release GitHub commits GitHub issues GitHub pull requests license


Please report any bugs in issues


Arduino library for Flash & FRAM Memory Chips (SPI based only)

Download the latest stable release from here. Please report any bugs in issues.

This Arduino library is for use with flash and FRAM memory chips that communicate using the SPI protocol. In its current form it supports identifying the flash/FRAM 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.


IDE Compatibility (actually tested with)

  • Arduino IDE v1.5.x
  • Arduino IDE v1.6.x
  • Arduino IDE v1.8.x

Platform compatibility

Micro controllers Dev boards tested with Notes
ATmega328P Arduino Uno, Arduino Micro,
Arduino Fio, Arduino Nano
-
ATmega32u4 Arduino Leonardo, Arduino Fio v3 -
ATmega2560 Arduino Mega -
ATSAMD21G18 (ARM Cortex M0+) Adafruit Feather M0,
Adafruit Feather M0 Express,
Adafruit ItsyBitsy M0 Express
-
AT91SAM3X8E (ARM Cortex M3) Arduino Due -
ATSAMD51J19 (ARM Cortex M4) Adafruit Metro M4 -
STM32F091RCT6 Nucleo-F091RC
ESP8266 Adafruit ESP8266 Feather,
Sparkfun ESP8266 Thing
-
ESP32 Adafruit ESP32 Feather,
Sparkfun ESP32 Thing
Onboard flash memory. Refer to footnote£ below.
Simblee Sparkfun Simblee -

£ ESP32 boards usually have an SPI Flash already attached to their default SS pin, so the user has to explicitly declare the ChipSelect pin being used with the constructor


Flash memory compatibility - Actually tested with

Manufacturer Flash IC Notes
Winbond W25Q16BV
W25Q64FV
W25Q64JV
W25Q80BV
W25Q256FV
Should work with the W25QXXXBV, W25QXXXFV &
W25QXXXJV families
Microchip SST25VF064C
SST26VF016B
SST26VF032B
SST26VF064B
Should work with the SST25 & SST26 families
Cypress/Spansion S25FL032P
S25FL116K
S25FL127S
Should work with the S25FL family
ON Semiconductor LE25U40CMC
AMIC A25L512A0
Micron M25P40
Adesto AT25SF041
Giga devices GD25Q16C (Used on the Adafruit ItsyBitsy M0 Express)
Should work with any flash memory that is compatible with the SFDP standard as defined in JESD216B

FRAM memory compatibility - Actually tested with

Manufacturer Flash IC Notes
Cypress/Spansion FM25W256 Should work with the FM25W family

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.3.0

Enhancements & Optimizations:
  • Reduce SRAM footprint when running Diagnostics.ino. Thanks @rambo (PR #157)
  • Officially supports the ESP32 (tested on the ESP32 Feather)
  • Now supports FRAM memory chips via the SPIFram constructor
  • Changed Diagnostics output in _chipID() to match situation better.
  • Fixed _chipID() to run more efficiently.
Bugs squashed
  • Fixed a major bug causing issues with page boundaries in writeAnything and writeStr. Thanks for your help @jacky4566 (Issue #151)
  • Fixed a major bug with reading Strings (Issue #143)
  • @incorvia fixed a bug by initialising the SPIBusState to false
  • Fixes bug that causes ballooning of pagesize when SFDP is not read. This is because no default _pageSize value was set in this scenario. This has now been fixed.
  • Fixed a major bug in how SFDP data is used to calculate chip capacity. The previous version of the library returned a wrong value. This has now been fixed. Refer to comments in _getSFDPFlashParam(void) for further details.
New flash memory chips supported:

--> GD25Q16C from Giga devices (Used on the Adafruit ItsyBitsy M0 Express)

  • W25Q64JV from Winbond
  • SST26VF016B & SST26VF032B from Microchip. (Thanks @mix86)
New FRAM memory chips supported:
  • FM25W256 from Cypress

Arduino Library for SPI Flash memory chips

21 May 05:06
341c29a
Compare
Choose a tag to compare

SPIMemory Build Status DOI


Formerly known as SPIFlash.


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.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.

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
  • ATmega328P (Arduino Uno, Arduino Micro, Arduino Fio, Arduino Nano)
  • ATmega32u4 (Arduino Leonardo, Arduino Fio v3)
  • ATmega2560 (Arduino Mega)
  • ATSAMD21G18 ARM Cortex M0+ (Adafruit Feather M0, Adafruit Feather M0 Express)
  • AT91SAM3X8E ARM Cortex M3 (Arduino Due)
  • ATSAMD51J19 ARM Cortex M4 (Adafruit Metro M4)
  • STM32F091RCT6 (Nucleo-F091RC)
  • ESP8266 Boards (Adafruit ESP8266 Feather)
  • Simblee Boards (Sparkfun Simblee)
In BETA
  • 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.1

Enhancements & Optimizations:
  • The way the basic functions execute has been modified to keep all functions' runtime the same (or improved) while reducing their memory footprint.

Test sketch - FlashDiagnostics.ino from v3.2.0 with #RUNDIAGNOSTIC commented out
Test platform - Arduino Pro Mini 8MHz 3.3V

Library version SFDP discovery Compiled code size % Difference from v3.1.0
v3.1.0 Not supported 17652 bytes 0%
v3.2.0 Supported & enabled by default 20104 bytes +13.9%
v3.2.1 Supported & enabled 17854 bytes +1.1%
v3.2.1 Supported & disabled 15316 bytes -13.75%
Bugs squashed
  • Fixes issue #135 : The addition of the SFDP checking to _chipID resulted in a sudden (very large) increase in compiled code size. As of the current version (v3.2.1), SFDP checking is an user controlled option. To get the library to work with SFDP compatible flash memory that is not officially supported, the user must uncomment '//#define USES_SFDP' in 'SPIMemory.h'.

  • Moved bool _loopedOver from being a local variable in getAddress() to a global one. Now it actually does what it was meant to do - i.e. prevent looping over data a second time.

Arduino Library for SPI Flash memory chips

16 May 12:08
4208dd2
Compare
Choose a tag to compare

SPIMemory Build Status DOI


Formerly known as SPIFlash.


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.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.

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
  • ATmega328P (Arduino Uno, Arduino Micro, Arduino Fio, Arduino Nano)
  • ATmega32u4 (Arduino Leonardo, Arduino Fio v3)
  • ATmega2560 (Arduino Mega)
  • ATSAMD21G18 ARM Cortex M0+ (Adafruit Feather M0, Adafruit Feather M0 Express)
  • AT91SAM3X8E ARM Cortex M3 (Arduino Due)
  • ATSAMD51J19 ARM Cortex M4 (Adafruit Metro M4)
  • STM32F091RCT6 (Nucleo-F091RC)
  • ESP8266 Boards (Adafruit ESP8266 Feather)
  • Simblee Boards (Sparkfun Simblee)
In BETA
  • 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

  • LE25U40CMC from ON Semiconductor

  • A25L512A0 from AMIC

  • M25P40 from Micron

  • AT25SF041 from Adesto

  • S25FL032P from Cypress/Spansion

New Microcontrollers supported:
  • ATSAMD51J19 ARM Cortex M4 (Adafruit Metro M4)

Arduino Library for SPI Flash memory chips

26 Mar 05:22
f3a76a0
Compare
Choose a tag to compare

SPIFlash Build Status DOI

GitHub release
GitHub commits
GitHub issues
GitHub pull requests
license


Please report any bugs in issues


Important note from developer

The term 'SPI Flash' is a fairly common way to refer to Flash memory chips that communicate over the SPI protocol and there are a number of libraries that are named SPIFlash. When I first started work on this library in 2014, it was mostly as an exercise to improve my embedded systems programming skills. When I asked for it to be included in the list of Arduino libraries, I did not really expect it to go very far or get very popular. But, before I knew it, I was releasing new versions every other month and I found the number of users got way bigger than I imagined it would. The amount of traffic the GitHub repository gets still surprises me.

A few months ago, @LowPowerLab raised an issue (#83) about the problems the name of this library was causing the users of his library - also called SPIFlash. The fact that this library is in the Arduino Library manager meant that his users were being asked to upgrade their version of SPIFlash when the libraries were actually different. I can understand how much of an annoyance this can be for a user.

@LowPowerLab's version of SPIFlash has been around for longer than this one and his library is a major part of his commercial line of development boards. Since I am a hobbyist developer (I'm a full-time geneticist & a part-time dabbler in ecology - if you're curious) and this library is not a commercial product with branding and trademarks to worry about, the least I can do is change the name of this library so it stops being an annoyance to @LowPowerLab's customers.

On a side note, if you did not know already, @LowPowerLab makes and sells a fantastic line of Arduino compatible boards - the Moteino series - and has developed a fantastic IoT protocol to use with them to add smarts to your home. In January this year, I finally got around to getting my hands on some of his boards and have been playing around with them. They are fantastic! I'd strongly recommend you check them out - if you haven't already done so.

I asked the Arduino developers if there was a way to migrate this library to a new name without breaking the upgrade path (Issue #6904) and was told that it was not possible. The only way is to pull my version of SPIFlash from the library manager and ask for a renamed version to be included in the library manager after.

So, this is what I have decided to do.:

  • This version - v3.1.0 - will be the last version to be released under the SPIFlash name.
  • Anyone downloading this version of the library will be able to read this notice in the ReadMe file.
  • Anyone using this version of the library will see a notice in their Serial output directing them to this notice in the ReadMe file. (this can be removed by commenting out the #define PRINTNAMECHANGEALERT in SPIFlash.h)
  • Version 3.2.0 will be released in a couple of months (in May most likely) under a new name - SPIMemory.
  • This version of SPIFlash will be removed from the library manager then and replaced with the new one.

The only change will have to be made in end-user code will be to change the #include SPIFlash.h to #include SPIMemory.h. After the name change, rest assured that older versions will remain accessible and the development history of the library will be preserved.

I apologise for any trouble this might cause you as the end user, but, given the facts, it is the only thing I can do to be fair to @LowPowerLab

Thanks again for using SPIFlash and I hope you will continue to find it useful in whatever new name it will take on.


Arduino library for Flash Memory Chips (SPI based only)

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

  • 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
    • S25FL127S
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.1.0

  • Library name change notice inserted into flash.begin(). This notice can be dismissed by commenting out the instance of #define PRINTNAMECHANGEALERT in SPIFlash.h. Please refer to the Readme file for further details.
Bugs Squashed:
  • An error with how _addressCheck() works with data that spans the memory boundary - when rolling over from address '_chip.capacity' to address '0x00' - has been fixed. In previous versions this caused issues with writing complex data structures across the memory boundary and led to many _writeErrorCheck() failures. Fixes issue #112

  • An error with how _writeErrorCheck() worked has been resolved. Writing structs is now as stable as other functions are. Fixes #106

Enhancements & Optimizations:
  • A new function - 'flash.eraseSection(address, size)' - has been introduced in this version. When a user requires a large and variable (between writes) amount of data to be written to the flash memory on the fly and to have the correct amount of space erased to fit the data, this function will automatically calculate and erase the right amount of space to fit the data. Please note that if the the amount of data being written is consistently the same size, the pre-existing 'flash.eraseSector()', 'flash.eraseBlock32K()' and 'flash.eraseBlock64K()' functions will operate a lot faster.

  • Updated Diagnostics.ino to include eraseSection().

  • All I/O functions now check to see if the flash chip is powered down. If it is, they prevent the function from running and returns an error. A new error code 'CHIPISPOWEREDDOWN' will be returned upon calling flash.error().

New flash memory chips supported:
  • S25FL127S

Arduino Library for SPI Flash memory chips

10 Dec 13:55
6d88fb4
Compare
Choose a tag to compare

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

Arduino Library for SPI Flash memory chips

17 Nov 02:27
4347aee
Compare
Choose a tag to compare

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.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.

  • 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.0

Bugs Squashed:
  • The writeByteArray() & writeCharArray() bug that occurred when writing arrays that spanned page boundaries (squashed in v2.5.0), stayed around to haunt the other functions. Writing any data larger than a single byte that spanned page boundaries would cause the data to wrap around to the beginning of the page. The likelihood of this occurring was slim - no one has reported it to date. However, just in case, this has now been squashed in this release.
Deprecations:
  • Going forward the ATTiny85 is no longer officially supported.
  • The library no longer supports using the page number + offset combination instead of addresses. If your code requires you to use a page number + offset combination, use the following code to help
address = (pagenumber << 8) + offset.
  • The constructor no longer takes the pageOverflow variable as an argument. Page overflow is globally enabled by default and can be disabled by including a "#define DISABLEOVERFLOW" at the beginning of SPIFlash.h.
New Boards supported
  • Nucleo-F091RC
  • Adafruit Feather M0
New Flash manufacturers supported:
  • Microchip (SST25 & SST26 series)
  • Cypress
  • Spansion
Enhancements & Optimizations:
  • Confirmed to work with SPANSION/CYPRESS & MICROCHIP (Both SST25 & SST26 series).
  • If not using an officially supported chip, use the following variation of flash.begin() (where flashChipSize is indicated in Bytes, Kilobytes or Megabytes. (Refer to the next two items in this change log):
flash.begin(flashChipSize);
  • Including 'flashChipSize' in flash.begin() compiles more efficiently than in previous versions.
  • The way memory size is indicated by the users in flash.begin(flashChipSize) has changed - please refer to defines.h or the wiki for further information. The new method enables users to define any custom size unlike the previous version where only a limited number of predetermined sizes were available to use.
  • Library faster than before:

Improvements in speed in v3.0.0 when compared to v2.7.0 (values in percentage of time v3.0.0 is faster than v2.7.0)

Function Change in speed
writeByte +3%
writeChar +6%
writeWord +3%
writeShort +5%
writeULong +7%
writeLong +7%
readLong +7%
writeFloat +7%
writeStr +57%
readStr +61%
writeAnything +25%
readAnything (struct) +20%
writeByteArray +18%
readByteArray (256 bytes) +45%
eraseSector +99%
eraseBlock32K +99.4%
eraseBlock64K +99.5%
eraseChip +12%
  • Constructor changed to enable user to choose one of multiple SPI ports - if available. Look at wiki for further info
  • When RUNDIAGNOSTIC is uncommented in SPIFlash.h, users now have access to a new function called flash.functionRunTime() which can be called after any library I/O function is run. flash.functionRunTime() returns the time taken by the previous function to run, in microseconds (as a float). An example use case can be found when the FlashDiagnostics sketch is run with RUNDIAGNOSTIC uncommented.
  • _notBusy() is faster
  • Completely re-written FlashDiagnostics - uses fewer resources, compatible with more chips and boards
  • All functions except the Byte/Char Array Read/Write functions now call an internal _write/_read function for increased ease of compilation, execution and troubleshooting
  • Restructured the internal _troubleshoot() function to be better human readable and faster to compile.
  • Added a function getUniqueID() which returns the unique ID of the flash memory chip as a 64-bit integer.
  • Added an internal _readStat3() function to enable 4-byte addressing when using flash memory larger than 128 MB
  • 4-byte addressing enabled in flash memory larger than 128 MB. This is currently only supported on the W25Q256 and W25Q512. More chips will be supported on a case-by-case basis
  • getAddress() function now works anytime it is called - even if there is preexisting data on the chip

Arduino Library for Winbond Flash Memory Chips

02 Aug 14:08
Compare
Choose a tag to compare

SPIFlash Build Status DOI

GitHub release
GitHub commits
GitHub issues
GitHub pull requests
license

Please report any bugs in issues.

This Arduino library is for use with Winbond serial flash memory chips. In its current form it supports identifying the flash chip and its various features; automatic address allocation and management; reading and writing bytes/chars/ints/longs/floats/Strings from and to various locations; reading and writing pages of bytes; continous reading/writing of data from/to arrays of bytes/chars; sector, block and chip erase; and powering down for low power operation.

  • For details of the Winbond Flash chips compatible with this library please refer to the Excel spreadsheet in the Extras folder.

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.2
Boards
Completely supported
  • Arduino Uno
  • Arduino Leonardo
  • Arduino Due
  • Arduino Zero
  • ESP8266 Boards (On the Arduino IDE)
  • Simblee Boards (On the Arduino IDE)
  • RTL8195A (tested and enabled by @boseji on 02.03.17)
  • 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 9618eec on 02.08.2017.
    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);

ESP32 support will remain in beta till the ESP32 core can be installed via the Arduino boards manager.

Flash chips
  • Winbond
    • W25X05CL (64K-Byte)
    • W25X10BV (128K-Byte)
    • W25X20BV (256K-Byte)
    • W25X40BV (512K-Byte)
    • W25Q80BV (1M-Byte)
    • W25Q16BV (2M-Byte)
    • W25Q32BV (4M-Byte)
    • W25Q64BV (8M-Byte)
    • W25Q128BV (16M-Byte)
    • W25Q256FV (32M-Byte)
  • Other Winbond flash chips can be used by declaring their size in bits as an argument in begin()

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 'Download zip' below.
  • Unzip the archive and rename resulting folder to 'SPIFlash'
  • Move the folder to your libraries folder (~/sketches/libraries)

Change log

v2.7.0

Bugs Squashed:
  • ATTiny85 support available again.
New Boards supported
  • Arduino Zero now fully supported.
Enhancements & Optimizations:
  • Updated to be compatible with the ESP32 core for Arduino as of the current commit 9618eec on 02.08.2017. For some unknown reason, SPI clock speeds higher than board speed/4 are not stable and so, the clock speed for ESP32 dev boards has currently been throttled to 20MHz.
    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);

Arduino Library for Winbond Flash Memory Chips

16 Apr 17:00
Compare
Choose a tag to compare

SPIFlash Build Status DOI

GitHub commits
GitHub issues
GitHub pull requests
license

Please report any bugs in issues.

This Arduino library is for use with Winbond serial flash memory chips. In its current form it supports identifying the flash chip and its various features; automatic address allocation and management; reading and writing bytes/chars/ints/longs/floats/Strings from and to various locations; reading and writing pages of bytes; continous reading/writing of data from/to arrays of bytes/chars; sector, block and chip erase; and powering down for low power operation.

  • For details of the Winbond Flash chips compatible with this library please refer to the Excel spreadsheet in the Extras folder.

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.2
Boards
Completely supported
  • Arduino Uno
  • Arduino Leonardo
  • Arduino Micro
  • Arduino Fio
  • Arduino Mega
  • Arduino Due
  • ESP8266 Boards (On the Arduino IDE)
  • Simblee Boards (On the Arduino IDE)
In BETA
  • ESP32 Boards (Tested on the Sparkfun ESP32 thing) The library is known to work with the ESP32 core as of the current commit 7d0968c on 16.04.2017. ESP32 support will remain in beta till the ESP32 core can be installed via the Arduino boards manager.
Flash chips
  • Winbond
    • W25X05CL (64K-Byte)
    • W25X10BV (128K-Byte)
    • W25X20BV (256K-Byte)
    • W25X40BV (512K-Byte)
    • W25Q80BV (1M-Byte)
    • W25Q16BV (2M-Byte)
    • W25Q32BV (4M-Byte)
    • W25Q64BV (8M-Byte)
    • W25Q128BV (16M-Byte)
    • W25Q256FV (32M-Byte)
  • Other Winbond flash chips can be used by declaring their size in bits as an argument in begin()

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 'Download zip' below.
  • Unzip the archive and rename resulting folder to 'SPIFlash'
  • Move the folder to your libraries folder (~/sketches/libraries)

Change log

v2.6.0

Bugs Squashed:
  • Fixed issue with reading status register 2 and the Suspend operation where the library was not checking the suspend status correctly.
Deletions
  • flash.getChipName() has been removed as it is superfluous now that the library is now on its way to multi-chip compatibility.
  • The library is not compatible with the ATTiny85 anymore. Currently working on a fix which will hopefully be rolled out in v2.7.0
New Boards supported
  • RTL8195A compatibility tested and enabled by @boseji on 02.03.17. Code modified to fit with the library structure by Prajwal Bhattaram on 14.04.17.
  • Now supports the ESP32 core for Arduino as of the current commit 7d0968c on 16.04.2017. The ESP32 core currently does not support analogRead and so randomSeed(AnalogRead(A0)); cannot be used. Also, for some unknown reason, SPI clock speeds higher than board speed/4 are not stable and so, the clock speed for ESP32 dev boards has currently been throttled to 20MHz.
  • Added support for the Simblee module.
Enhancements & Optimizations:
  • flash.error() now takes an optional argument VERBOSE. By default the verbosity argument is set to false and calling flash.error() still returns the latest error code as an unsigned byte. However, running flash.error(VERBOSE) will not only return the latest error code, but will also print it to serial. This - especially in boards with resources to spare - will result in a detailed error report printed to serial.
  • flash.begin() now returns a boolean value to indicate establishment of successful comms with the flash chip. Usercode can be made more efficient now by calling
if (!flash.begin()) {
      Serial.println(flash.error(VERBOSE));
}

to identify a problem as soon as the library code is run.

  • The internal _addressCheck() function now locks up usercode with appropriate error codes if
    • flash.begin() has not been called (or)
    • There is a possible issue with the wiring - i.e. the flash chip is non-responsive (or)
    • If the chip's capacity either cannot be identified & the user has not defined a chipSize in flash.begin().
  • Fixed powerDown() to be more efficient. The chip now powers down much faster than before.
  • Added a new error code. Library can now detect non-responsive chips - bad wiring or otherwise.
  • Streamlined variables to make code structure better.
  • Changed library structure to enable the addition of multi-flash compatibility in the near future.
  • moved #define RUNDIAGNOSTIC & #define HIGHSPEED to SPIFlash.h from SPIFlash.cpp.
  • Now works with other Winbond modules (not in the official supported module list) (beta) by taking the flash memory size in bits as an argument in flash.begin(_chipSize);
  • Formatted code to be better human readable.
  • Changed the internal _troubleshoot() function to use fewer resources.

Arduino Library for Winbond Flash Memory Chips

13 Nov 15:23
Compare
Choose a tag to compare

SPIFlash Build Status DOI

GitHub commits
GitHub issues
GitHub pull requests
license

Please report any bugs in issues.

This Arduino library is for use with Winbond serial flash memory chips. In its current form it supports identifying the flash chip and its various features; automatic address allocation and management; reading and writing bytes/chars/ints/longs/floats/Strings from and to various locations; reading and writing pages of bytes; continous reading/writing of data from/to arrays of bytes/chars; sector, block and chip erase; and powering down for low power operation.

  • For details of the Winbond Flash chips compatible with this library please refer to the Excel spreadsheet in the Extras folder.

Compatibility

Arduino IDE versions
  • IDE v1.5.x
  • IDE v1.6.0-v1.6.5
  • IDE v1.6.9-v1.6.11
Boards
  • Arduino Uno
  • Arduino Leonardo
  • Arduino Micro
  • Arduino Fio
  • Arduino Mega
  • Arduino Due
  • ESP8266 (On the Arduino IDE)
  • ATTiny85

Installation

Option 1
  • Click on the 'Download zip' below.
  • Unzip the archive and rename resulting folder to 'SPIFlash'
  • Move the folder to your libraries folder (~/sketches/libraries)
Option 2
  • Open the Arduino IDE.
  • Go to Sketch > Include Library > Manage libraries.
  • Search for SPIFlash.
  • Install the latest version.

Change log

v2.5.0

Bugs Squashed:
  • Errorchecking on writeByteArray() and writeCharArray() was broken in 2.4.0 and is fixed now.
  • Previous versions (< 2.5.0) suffered from the inability to write datasets that spanned page boundaries. This has now been fixed (Ref. Enhancements section below)
Deletions
  • flash.writePage() & flash.readPage() have been retired as they can be duplicated - more effectively - by other functions. Refer to pageDiag() in Diagnostics.ino to see how the same results can be obtained by using flash.writeByteArray() & flash.readByteArray().
Enhancements & Optimizations:
  • Added support for SPI Transactions.
  • Added an upgrade for Arduino Due users to read and write large arrays of data at very high speeds - previously reading 60kb of data would take ~108ms - it now takes ~525uS. In this mode, the time between consecutive reads has been reduced to <12ms (needs more work!).
  • Completely re-written writeByteArray() and writeCharArray() functions. They no longer breakdown when writing arrays that span multiple pages.
  • All functions that write more than 1 byte of data now take into account page boundaries when writing across pages. In previous versions writing across a page boundary would cause the remainder of the data to wrap around to the beginning of the page. Now the data is written seamlessly from one page over to the next.
  • Calling flash.begin() now instantiates the SPI bus. Comms with other SPI slaves do not need to call SPI.begin() if flash.begin() has already been called first in the user's code.
  • Sped up _beginSPI(). Code in _beginSPI() instantiates the SPI bus if another SPI comms library has shut it down.
  • Added function allowing setting SPI clock speeds - call the function flash.setClock(uint32_t clockSpeed); straight after begin();.
  • Made _beginSPI() & _nextByte() shorter and faster.
  • Replaced all calls to SPI.transfer() with xfer() to make the code more human readable and to enable simplicity when switching platforms.
  • Added the ability to change Chip Erase wait times depending on the chip (supported chips only).
  • Don't need to #include <SPI.h> in user code anymore. Just #include<SPIFlash.h> will do. Examples are now updated.
  • Now supports & uses SPI.transfer(*buf, count) along with the standard SPI.transfer(), speeding up the read/write of anything larger than an byte (AVR Boards only)
  • Reduces the program storage space in the uC's flash (AVR Boards)