Its finally here!!! Just pushed through an update to v3.0.0. This update is a major overhaul of the library and brings with it support for more flash memory manufacturers, more µC platforms, squashes a major bug, loses ATTiny85 support, and has a large number of optimizations for speed, stability & ease of development.
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.
Deletions
- 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 pseudocode to help
address = ( pagenumber << 8 ) + offset;
New Boards supported
- Nucleo-F091RC
- Adafruit Feather M0
- Adafruit Feather M0 Express (On board flash and external flash)
Flash memory chips supported
- Winbond (All SPI Flash chips)
- Microchip (SST25 & SST26 series)
- Cypress/Spansion (S25FL series)
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 (Refer to release notes for details)
- 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
As always, you can find this version on Github here --> SPIFlash Library for Arduino v3.0.0
A ZIP file is also attached to the first post on this thread. The easiest way, as always, is to open up Library Manager on your Arduino IDE and update the libary to v3.0.0 ![]()