There is a newer version of the record available.

Published April 16, 2017 | Version v2.6.0
Software Open

Marzogh/SPIFlash: Arduino Library for Winbond Flash Memory Chips

Description

SPIFlash

Please report any bugs in issues.</sup>

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

Files

Marzogh/SPIFlash-v2.6.0.zip

Files (129.1 kB)

Name Size Download all
md5:3ab9107a016c3f131167a64908eb930b
129.1 kB Preview Download

Additional details

Related works