Add extra Storage to the Raspberry Pi Pico with W25Q128 and LittleFS

The RP2040 Pico board comes with 2 MByte onboard FLASH memory. While this is plenty of space for many embedded applications, sometimes it needed to have more storage space. Having the ability to adding an extra SPI FLASH memory with a useful file system comes in handy in such situations. This makes the RP2040 ideal for data logger applications or otherwise store a large amount of data. In this article I’ll show you how to add an extra 16 MByte of memory to the Raspberry Pi Pico board, running FreeRTOS, a command line shell and using LittleFS as the file system.


I have used the LittleFS in other projects with the McuLib. For a data logger project I have ported the file system using a Winbond W25Q128 16 MByte SPI FLASH device for the Raspberry Pi Pico RP2040. You can find an example project using it on Github.


The CMake file in the example project pulls in the McuLib files from GitHub: just run the ‘cmake init.bat’ file. It creates as well the needed files to use it in an IDE like Eclipse:


You can use tone of the make targets in the IDE:

If desired, the project can be built on the console:

The memory device and file system is configured through a set of configuration macros:


During startup, the needed modules (McuSPI, McuW25 and McuLFS) for the file system get initialized:

SPI Pins

Wiring and pins can be configured for the McuSPI module. By default it uses SPI1 with the25 following pins:

#define MCUSPI_CONFIG_HW_SCLK_PIN (10)  /* SPI1_SCK */
#define MCUSPI_CONFIG_HW_MOSI_PIN (11)  /* SPI1_TX  */
#define MCUSPI_CONFIG_HW_MISO_PIN (12)  /* SPI1_RX  */
#define MCUSPI_CONFIG_HW_CS_PIN   (13)  /* SPI1_CSn */

If other SPI pins are needed, they can be configured in the McuSPIconfig.h file.


The modules have implemented a shell command line interface, below the help text:

The ‘status’ shell command reports both the status of the file system and of the flash memory:


The project includes both Segger J-Link and OpenOCD (PicoProbe) debug configurations. As you can see, the application runs FreeRTOS on the the RP2040, which makes it ideal for any kind of data logger.


It is always good to have the ability to use an external SPI Flash device. The the Raspberry Pi Pico board already has an onboard 2 MByte Flash, and having an external one with the LittleFS file system is certainly a plus. With the Winbond and LittleFS integration in the McuLib it is now very easy to add some extra storage for every Raspberry Pi Pico project.

To use the example project on GitHub, follow the tutorial I wrote earlier: Getting Started: Raspberry Pi Pico RP2040 with Eclipse and J-Link. It both works with Cmake and Eclipse IDE support.

Happy Flashing 🙂



4 thoughts on “Add extra Storage to the Raspberry Pi Pico with W25Q128 and LittleFS

    • Hi Alan,
      I really like LittleFS too: small and robust, and solves many issues with FatFS (which I still use in some projects).
      The year end is approaching with exams and grading, lots of work to be done.



        • Hi Pavel,
          things like a corrupted file system, e.g. if a write to the directory gets interrupted, or power goes down in the middle of a write access to the root directory, or removal of the SD card while writing.


What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.