There is a newer version of the record available.

Published September 10, 2016 | Version v2.4.0

SPIFlash: Arduino Library for Winbond Flash Memory Chips

Description

SPIFlash

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.4.0
  • Bugs Squashed:
  • Fixed bug preventing writing to Address 0x00
  • Fixed bug in _notPrevWritten() which did did not perform a thorough enough check to see if a location had been previously written to.
  • Fixed errorchecking bug - it now works for all data types - not just byte/char as previously. Enhancements & Optimizations:
  • Added a function 'error()' to enable users to check for errors generated at any point in their program.
  • Optimized writePage() so it doesn't depend on other functions and so runs faster than before.
  • Diagnostics.ino now outputs time taken for each function as a part of its and provides additional diagnostic data.
  • Now have a common set of private functions - _prep(), _beginSPI(), _nextByte() & _endSPI() - to replace _prepWrite(), _prepRead(), _beginRead(), _readNextByte(), _beginWrite(), _writeNextByte() & _endProcess();
  • Changed the way _addressCheck() works. It now checks all addresses involved in writing the data rather than one address block at a time and returns the correct address to write to in case overflow is enabled. Also, this function is now built into _prep().
  • Reading and writing using page numbers + offset has been optimised to be faster than before.
  • Optimized the way address and error checking is done so its more efficient and uses fewer system resources and runs faster.
  • Using this library with an ESP8266 board defaults to using GPIO15 as the Slave Select - unless something different is explicitly specified in the constructor.

Files

SPIFlash-v2.4.0.zip

Files (83.6 kB)

Name Size Download all
md5:37a1a9bcc82c75a75cc71ef18f8e1895
83.6 kB Preview Download

Additional details

Related works