Page 1 of 1

ESP32 maximum use of remaining Flash

Posted: Sun Oct 04, 2020 4:11 pm
by Ajinkya_777
Hi,

I'm using ESP32 board with 8mb of flash. I choose this configuration because I wanted to store data in remaining portion of the flash chip. So flash partition I kept is nvs 0x5000 otadata 0x2000 app0 2M app1 2M spiffs 4M.
Here I wanted to store data in permanent memory.

I have main 2 questions in this
i) can i use EEPROM over 4096 bytes? like can i use all spiffs as eeprom (hole 4MB)
ii) how to use the flash in most optimize way and faster to read/write.

Thank you
Ajinkya

Re: ESP32 maximum use of remaining Flash

Posted: Mon Oct 05, 2020 7:22 am
by ESP_Sprite
You are talking about Arduino EEPROM? That is stored in the NVS partition if memory serves, not in SPIFS. Wrt how to use the flash optimally, that really depends on the application you're writing; if there were a general answer you'd find it in the docs.

Re: ESP32 maximum use of remaining Flash

Posted: Thu Oct 08, 2020 5:36 pm
by Ajinkya_777
ok thank you.

I'm using SPIFFS to store data into flash.
but I was just wanted to know weather we can create EEPROM library or any library so we can perform byte by byte operations in it.

Thank you
Ajinkya

Re: ESP32 maximum use of remaining Flash

Posted: Fri Oct 09, 2020 7:38 am
by ESP_Sprite
....possibly? But why not just use the existing EEPROM/Preferences library that's based on NVS?

Re: ESP32 maximum use of remaining Flash

Posted: Mon Oct 12, 2020 9:12 am
by Ajinkya_777
ESP_Sprite wrote:
Fri Oct 09, 2020 7:38 am
....possibly? But why not just use the existing EEPROM/Preferences library that's based on NVS?
okey
I use spiffs for flash storage and eeprom for nvs EEPROM.

Thank you so much.

Re: ESP32 maximum use of remaining Flash

Posted: Thu Jan 07, 2021 11:34 am
by Synectix
Hi,

Another similar question on the same lines.....

In the WROOM-32E Module with 4MB flash, is it possible for me to use, say 200k or 300k of memory from the 4MB Flash for my data storage ?
My code is quite small and comes in under 2MB.

Alternately, if I use a 8MB Module, then I can have 4MB for code and 4MB for data ?
Is it just partitioning accordingly that I need to take care of or is there something else that needs to be done for this ?

Thanks

Re: ESP32 maximum use of remaining Flash

Posted: Thu Jan 07, 2021 12:14 pm
by ESP_Minatel
Hi,

You just need to create a custom partition and define the storage portion that you want.

For example, you can use something like this (partitions.csv):

Code: Select all

# Name,   Type, SubType, Offset,  Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 0x180000,
storage,  data, spiffs,  ,        2M,
Just be sure that you are not overwriting anything and to set the custom .csv file on the configuration (Partition Table menu).
Screenshot from 2021-01-07 12-09-44.png
Screenshot from 2021-01-07 12-09-44.png (39.6 KiB) Viewed 4562 times
To dive deeper in this subject, see the reference documents: Partitions