Upload to external spi flash memory esp32

Hi everybody,
I’m Frederic, leaving in Bordeaux France.(did’nt find the welcome topic…)
I’ve been working with an ESP32 (ESP32WROOM32) for different projects, and i needed more space to store files (more space needed for data files, not program).
I’ve got more or less 20 .txt files, 220ko each. So in total 4400ko. So 4.4Mo.
I bought an ESP32-S3-WROOM1 with 16Mb flash (model N16R8) thinking that it was enough, but i mixed up Mo and Mb…
My 4.4Mo were in fact 35.2Mb…and it does not fit in the flash memory of my new ESP32-S3…
Message error “SPIFFS memory full”.
So i decided to add an external memory to store those files, and not use the internal SPIFFS. I bought a famous W25Q64 flash chip, which will be connected theorically via MOSI-MISO-CS-SCK.

I build and upload filesystem image with the platformIO tool, without really understanding how it works, but it works. I’ve always been able to upload my files (limited to 4 or 5), and read them. I also have a code that let me “access” the SPIFFS memory via a webbrowser (creating a webserver), so i can clearly see “what’s inside” the SPIFFS memory.

After all this litterature, here is my questions:

Is it possible to “tell” platformIO that i want to build/upload my files not in the internal SPIFFS, but in the “external” one?

I will find out how to wire this external flash chip, and gain access to it with some code, but if you know some tutorials that explain that step by step i would be grateful?

Thanks a lot for your time reading this, hope someone could help to go on with my project.
Have a nice day,

Hi, I also work on the some thing to add the external spi flash. I have an idea to do this, but not sure and don’t know how to do it, my idea is if we integrate the internal spi as the partition to the internal spi flash then we upload the file to the external spi flash. so now i working to make the partition of that, but did not complete this task yet. as this partition task is very straight forward in ESP32 IDF, however i am using the plateform IO which is not that much simple for me. so if you done with internal spi flash, can you share your code how done with that. it will be really helpfull for me. thanks.

Hi embeddedengr,
I’m glad you are trying to reach the same goal, to upload files to an external SPI memory.
I don’t have any code for now when i upload files to the internal one. I just use the platformIO tool, which helps to do that automatically. I just do the following: ESP32 VS Code PlatformIO: Upload Files to Filesystem SPIFFS | Random Nerd Tutorials
Which is nice, but i don’t have a clue how it “targets” the internal memory…
What it could be nice, is Platform IO to “discover” the external SPI memory connected via MOSI, MISO etc, and then upload files directly to it.
I know, after one million researchs:
1/ That is not “plug and play” straight forward all this.
2/ That there is no one who is interested in doing such a thing.(which i don’t understand, cause storing big files is just simple and usefull for everyone?..)
I decided to give up this way to store files, and i’m looking another method:
The SD card CHIP (Adafruit SPI Flash SD Card - XTSD 512 MB : ID 4899 : $9.50 : Adafruit Industries, Unique & fun DIY electronics and kits), which works like an SD card, with the same libraries, but it’s a “hard chip” which can be soldered directly to the PCB.
I know that this component exists, but i didn’t find for now a tutorial that explains how to upload files from a computer directly to it via USB (and then solder it, or let some pins available to connect via a remote USB wire…).
I for now did a pause on my project, and i will try to find time to investigate on this topic, as i think it will be my solution.
Hope that helps…?
If you have any info, i would be glad to hear from you!

Hi, thanks Fredric for responding on my question,
i would like you should try library name “SerialFlash.h” (https://github.com/PaulStoffregen/SerialFlash/blob/master/SerialFlash.h). this include all the example and reading writing of data on SPI flash. I think you should try this one for external SPI flash.
if this help or you already know about this, let me know?

I’ve tried already this Paul Stoffregen libraries and all his codes.
As far as i remember, i didnt manage to make it work.
The COPY FROM SD was the solution i was looking for.
I think that the problem came from:
if (!SerialFlash.begin(FlashChipSelect)) {
error(“Unable to access SPI Flash chip”);
I will try it again, as it was 6 months ago and i don’t remember at all what was going wrong.
I’ll keep you in touch.
But even it works, and let’s say that a file is copied to the external SPI flash.
How do i read it?
The SPI flash has not a “file system”, and you cannot say “open file ABC.txt and read line 5”.