0

Feather ESP32 V2 Usable Flash Memory
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather ESP32 V2 Usable Flash Memory

by tahunus on Sat Jul 02, 2022 6:28 pm

Please help on how to access (and use) the ESP32 V2's full 8MB of Flash Memory in Arduino IDE (I'm using IDE Ver 1.8.19)

The boards.txt file of Espressif's ESP32 Arduino core does have a line specifying it: adafruit_feather_esp32_v2.build.flash_size=8MB
but the available partitions in that same file only allow for a max of 2MB (with no OTA):
adafruit_feather_esp32_v2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152.
There is also a line limiting max upload size for the default partition: adafruit_feather_esp32_v2.upload.maximum_size=1310720

Are the other 6MB meant only for Circuit/Micropython?

I changed that line in boards.txt to 8388608 (i.e. 8BM) instead of 2097152 (i.e. 2MB) and sure enough, it compiled ok, stating "Sketch uses 292289 bytes (3%) of program storage space. Maximum is 8388608 bytes", but this seems too simple to be right!

tahunus
 
Posts: 29
Joined: Fri Aug 20, 2021 4:24 pm

Re: Feather ESP32 V2 Usable Flash Memory

by tahunus on Sun Jul 03, 2022 5:01 pm

As is usually my experience in this forum, after a period of blank silence, I begin to elucidate the answer myself. I'm sure there are experts out there that could answer this in a second, but given their abstinence, I share here some findings for other non-experts like me:


For now, I will leave boards.txt as it is until I get a better grip on the subject

tahunus
 
Posts: 29
Joined: Fri Aug 20, 2021 4:24 pm

Re: Feather ESP32 V2 Usable Flash Memory

by mikeysklar on Sun Jul 03, 2022 5:12 pm

You do not want to modify boards.txt.

The 8MB Flash is connected via SPI (if we are talking about the Adafruit ESP32 Feather V2 #5400) so you can use it for data files with Arduino. Lots of example in this Github Repo.

https://github.com/adafruit/Adafruit_SP ... r/examples

mikeysklar
 
Posts: 8084
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feather ESP32 V2 Usable Flash Memory

by adafruit2 on Mon Jul 04, 2022 8:24 pm

yes the default partition is 2MB (so there is 6MB left for OTA or 'file storage' usage like SPIFFS) this is normal, all ESP boards have a partition :)

adafruit2
Site Admin
 
Posts: 21070
Joined: Fri Mar 11, 2005 7:36 pm

Re: Feather ESP32 V2 Usable Flash Memory

by tahunus on Wed Jul 06, 2022 11:25 am

adafruit2 wrote:yes the default partition is 2MB (so there is 6MB left for OTA or 'file storage' usage like SPIFFS) this is normal, all ESP boards have a partition :)


Thanks!

Looking at the no_ota.csv file (https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/no_ota.csv) used by the Adafruit Partition Table Definition (adafruit_feather_esp32_v2.menu.PartitionScheme.no_ota.build.partitions=no_ota) in boards.txt, we have these sizes:
    nvs: 20kb
    otadata: 8kb
    app(): 2MB
    spiffs: 1.9MB
Considering the Offsets declared in the CSV file, this gives a total of 4MB.

How can we access the remaining 4MB?

I ran the flash_info.ino example (https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_info) suggested by @mikeysklar, but got back a message stating that no SPI memory was found.

tahunus
 
Posts: 29
Joined: Fri Aug 20, 2021 4:24 pm

Re: Feather ESP32 V2 Usable Flash Memory

by adafruit2 on Wed Jul 06, 2022 12:12 pm

try using SPIFFS - its a library that espressif provides!
https://github.com/espressif/arduino-es ... .txt#L7622

adafruit2
Site Admin
 
Posts: 21070
Joined: Fri Mar 11, 2005 7:36 pm

Re: Feather ESP32 V2 Usable Flash Memory

by tahunus on Thu Jul 07, 2022 1:33 pm

adafruit2 wrote:try using SPIFFS - its a library that espressif provides!
https://github.com/espressif/arduino-es ... .txt#L7622


Yeah, but whether its FAT or SPIFF (or any other use), I'd still need to create a custom partition table: consider that the only 3 options defined by Adafruit for the Feather ESP32 V2 in boards.txt (i.e the link you provided) are based on the Default, No_Ota and min_spiffs partitions defined by Espressif (https://github.com/espressif/arduino-esp32/tree/master/tools/partitions ), and all of them, define a total of 4MB of Flash.

So the solution would be to create a custom partition using Espressif's guide (https://github.com/espressif/arduino-esp32/blob/master/docs/source/tutorials/partition_table.rst) and add it to the Adafruit ESP32 V2 section of boards.txt, with the caveat that with every update of the Espressif ESP32 Core, boards.txt would be overwritten.

Based on the several examples they provide, it would seem Espressif always assigns the first 36k for Bootloader and the following 20k for NVS. The rest of the Flash memory, apparently, can be user defined for OTA, SPIFF, APP, Factory, more NVS, etc.

So the questions are, in order to create a custom partition table specifically for the Adafruit ESP32 V2 and use the full 8MB:
    Should we observe the same Bootloader and the NVS minimum memory assignments?
    Is there any other restriction for a custom partition of the V2 (i.e. offsets, Flash Mode, Flash Size, etc.)?
    Is there any definition on the "build" or other sections of boards.txt that needs to be added for the custom partition? (i.e. CPUFreq, Flash Freq, etc.)
I ask because the other Adafruit definitions for your other ESP32 boards have many other options and entries on boards.txt.

Thanks!

tahunus
 
Posts: 29
Joined: Fri Aug 20, 2021 4:24 pm

Re: Feather ESP32 V2 Usable Flash Memory

by adafruit2 on Thu Jul 07, 2022 1:43 pm

tbh, im a little unfamiliar with custom partitions because we have always allocated space to OTA - ill let @thach reply when he's back
ya may also want to check the esp32 forum!

adafruit2
Site Admin
 
Posts: 21070
Joined: Fri Mar 11, 2005 7:36 pm

Re: Feather ESP32 V2 Usable Flash Memory

by hathach on Fri Jul 22, 2022 12:03 am

thank you for reporting, we have may an PR to espressif to fix the partition scheme for 8MB variant, it may take a while for them to review and merge
https://github.com/espressif/arduino-esp32/pull/7025

You could also add these lines to local boards.txt as quick fix in the mean time

Code: Select all | TOGGLE FULL SIZE
adafruit_feather_esp32_v2.menu.PartitionScheme.default_8MB=Default (3MB APP/1.5MB SPIFFS)
adafruit_feather_esp32_v2.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
adafruit_feather_esp32_v2.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336


The built-in partition scheme for 8MB flash is rather limited, there is only 1 scheme 3MB app (with ota) and 1.5 MB SPIFFS which is default_8MB.csv in this csv pool here https://github.com/espressif/arduino-es ... partitions

We would try to add more schemes with an additional PRs but it would need a bit of working. Meanwhile if you have any specific scheme, just put an partition.cvs in your sketch, it will be picked up instead of the one in the menu.

hathach
 
Posts: 1233
Joined: Tue Apr 23, 2013 1:02 am

Re: Feather ESP32 V2 Usable Flash Memory

by tahunus on Fri Jul 22, 2022 7:07 am

hathach wrote:Meanwhile if you have any specific scheme, just put an partition.cvs in your sketch, it will be picked up instead of the one in the menu.


Based on the several examples Espressif provides in their guide to create custom partitions https://docs.espressif.com/projects/arduino-esp32/en/latest/tutorials/partition_table.html, it would seem Espressif always assigns the first 36k for Bootloader and the following 20k for NVS. The rest of the Flash memory, apparently, can be user defined for OTA, SPIFF, APP, Factory, more NVS, etc.

So the questions are, in order to create a custom partition table specifically for the Adafruit ESP32 V2 and use the full 8MB:
    Should we observe the same Bootloader and the NVS minimum memory assignments?
    Is there any other restriction for a custom partition of the V2 (i.e. offsets, Flash Mode, Flash Size, etc.)?
    Is there any definition on the "build" or other sections of boards.txt that needs to be added for the custom partition? (i.e. CPUFreq, Flash Freq, etc.)
I ask because the other Adafruit definitions for your other ESP32 boards have many other options and entries on boards.txt

Thanks!

tahunus
 
Posts: 29
Joined: Fri Aug 20, 2021 4:24 pm

Re: Feather ESP32 V2 Usable Flash Memory

by hathach on Fri Jul 22, 2022 10:17 am

> Should we observe the same Bootloader and the NVS minimum memory assignments?
Yes, bootloader, nvs, otadata are must the rest ota0, ota1, spiffs / fatfs are up to you. If you don't need OTA, you could drop ota1 partition and double ota0 in size.
You don't need modify the boards.txt, just make an file called partitions.csv in your sketch, Arduino IDE will pick that up e.g https://github.com/espressif/arduino-es ... TLEFS_test

> Is there any other restriction for a custom partition of the V2 (i.e. offsets, Flash Mode, Flash Size, etc.)?
> Is there any definition on the "build" or other sections of boards.txt that needs to be added for the custom partition? (i.e. CPUFreq, Flash Freq, etc.)
> I ask because the other Adafruit definitions for your other ESP32 boards have many other options and entries on boards.txt

No these are separate settings and have no affect on the partition scheme, Espressif make some update to menu system recently, but they should work with both the old & new way.

hathach
 
Posts: 1233
Joined: Tue Apr 23, 2013 1:02 am

Please be positive and constructive with your questions and comments.