LittleFS Flash File System
LittleFS Flash File System
I recently learned about a compact embedded Flash File System known as SpiFFS.
While researching SpiFFS, I soon learned of another compact embedded Flash File System, LittleFS.
LittleFS appears to be even more compact and has additional security in that it creates and maintains a CRC for each file, and verifies the CRC each time the file is read.
- Compact
- Power-loss resilience
- Dynamic wear leveling
- Bounded RAM/ROM
- Maintains revision count and CRC (security features)
Let's put this file system onto a STM32 board (I'm using a NUCLEO-F103RB), and check it out.
Cloned littleFS to my local machine. Using Winbond W25Q128FVSG SPI Flash module from Ebay: https://www.ebay.com/itm/264290947181 If the link doesn't work, just search Ebay for "W25Q128 Module". I bought two for $8.26 (free shipping). Downloaded the PDF for the W25Q128FVSG: https://www.winbond.com/resource-files/w25q128fv%20rev.m%2005132016%20kms.pdf
The W25Q128FVSG uses 2.7V to 3.6V for operation. Here's a diagram for the the chip's pins and signals,
along with the Ebay "W25QXX" module" photo:
]]
Since the NUCLEO-F103RB powers its STM32F103RB processor with 3.3V, this "W25QXX" module" is compatible with the NUCLEO-F103RB. (The STM32-F103RB is capable of running from 2.0V to 3.6V.)
Let's look at the signal pins on the NUCLEO-F103RB:
]
On the NUCLEO board, the SPI1_SCK signal is being used to drive the board's Green LED.
So, we will use SPI2 bus and its signal pins.
To connect up the signals for power and the SPI BUS, here's the wiring diagram that was used:
Winbond W25Q128FVSG SPI Flash Module wiring: Signal Windbond Pin W25QXX Pin NUCLEO-F103RB Pin DI 5 1 PB15 SPI2_MOSI CN10-26 CLK 6 2 PB13 SPI2_SCK CN10-30 GND 4 3 GND CN10-20 DO 2 4 PB14 SPI2_MISO CN10-28 CS 1 5 PB12 SPI2_NSS CN10-16 VCC 8 6 +3V3 CN7-16
Reference Information:
https://uimeter.com/2018-04-12-Try-LittleFS-on-STM32-and-SPI-Flash/ https://github.com/ARMmbed/littlefs https://github.com/ARMmbed/littlefs/blob/master/README.md