0% found this document useful (0 votes)
3 views

ESP32 Out of Memory Error and Flash ROM Partitioning

The document provides guidance on determining the Flash ROM and PSRAM memory available on the ESP32, including how to run a specific sketch to print memory details. It outlines typical Flash ROM partitioning, detailing the purpose of each partition such as NVS for non-volatile data, PHY calibration, and OTA updates. Additionally, it offers resources for resolving out of memory issues and customizing partition tables, along with instructions for modifying partition allocations in the Arduino IDE.

Uploaded by

KGOTSO MORABA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

ESP32 Out of Memory Error and Flash ROM Partitioning

The document provides guidance on determining the Flash ROM and PSRAM memory available on the ESP32, including how to run a specific sketch to print memory details. It outlines typical Flash ROM partitioning, detailing the purpose of each partition such as NVS for non-volatile data, PHY calibration, and OTA updates. Additionally, it offers resources for resolving out of memory issues and customizing partition tables, along with instructions for modifying partition allocations in the Arduino IDE.

Uploaded by

KGOTSO MORABA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ESP32 - Out of memory error and Flash ROM partitioning

A Determine how much Flash ROM and PSRAM memory the ESP32 have:

• If you are not sure or does not know the amount of memory available on your device, please run the
“ESP32_Determine_Flash_memory_patitioning.ino” sketch which will print via the serial port the memory
details and the current flash ROM partitions allocated on your device.
• If an ESP32 module is labelled N16R8, it means that 16 Mb of Flash ROM is available for partitioning and 8
Mb of RAM named PSRAM are added using SPI bus.
• You must enable the PSRAM in the tools menu in Arduino before you can use it.

B ESP32 typical Flash ROM partitioning:

• Partition table: Contains information about the layout of the flash. This table defines the names, types, and
sizes of each partition on the flash memory, allowing the ESP32 to understand where each partition starts and
ends.
o nvs (Non-Volatile Storage): Stores key-value pairs for non-volatile data. Used to store persistent
configuration data, like Wi-Fi credentials, settings, or calibration values. NVS is designed to be robust,
allowing you to save and retrieve data without worrying about flash wear and data integrity.
o phy_init: Stores PHY (Physical Layer) calibration data. This partition holds calibration data for the Wi-Fi
and Bluetooth hardware. It is set up during the initial calibration of the ESP32 and retained to avoid re-
calibration on every boot, which helps speed up connectivity initialization.
o factory app: Holds the main application firmware. This is the default application partition that runs when
the ESP32 is powered on or reset, unless an OTA (Over-The-Air) update app is set to run. If there’s no
OTA functionality, this partition typically holds the main application code.
o ota_0, ota_1 (optional): Used for OTA firmware updates. These partitions allow the ESP32 to store
multiple versions of firmware, enabling it to switch between them during an update. For example, during
an OTA update, the new firmware might be loaded into `ota_1` while the device continues running
`ota_0`. If the new firmware is successfully verified, the ESP32 will switch to the updated firmware on
reboot.
o spiffs or fat (optional): Used as a file system partition. These file system partitions allow storing files on
the ESP32, such as configuration files, images, or HTML files for a web server. SPIFFS (SPI Flash File
System) is more common in smaller ESP32 projects, while FAT is used if compatibility with external tools
is required, as it allows larger file sizes and multiple directory levels.
• The sizes and locations of each partition is configurable based on your project’s requirements.
• Ensure that you understand the function and use of each partition type by reading the reference.

C If you have out of memory or partitioning problems or want to create a custom partition table, there is an
excellent reference video and tool available to solve the problems.

• https://www.youtube.com/watch?v=EuHxodrye6E Copy URL into your browser!


• The tool used in the video is located at
https://thelastoutpostworkshop.github.io/microcontroller_devkit/esp32partitionbuilder/
• Remember the default board partition allocations of your board, are not always required and can be modified
increasing the size of the allocation where you save your sketch/program. You can also select other partitions
options available as shown below to suit your needs.
• The ‘Tools’ menu in Arduino IDE gives you several options to change your EAP32 Flash ROM partitioning
with predetermined configuration options. One of these can maybe work for your application.

You might also like