Error when modifying partition table in ESP32

Hi, I am trying to modify the partition table of my ESP32. Specifically to expand the size of the nvs partition and reduce the size of the SPIFFs partition. The code gets uploaded but the ESP throws this error while booting:

    ␛[0;32mI (108) boot: Chip Revision: 1␛[0m
    ␛[0;32mI (127) boot_comm: chip revision: 1, min. bootloader chip revision: 0␛[0m
    ␛[0;32mI (78) boot: ESP-IDF HEAD-HASH-NOTFOUND 2nd stage bootloader␛[0m
    ␛[0;32mI (78) boot: compile time 23:46:13␛[0m
    ␛[0;32mI (78) boot: Enabling RNG early entropy source...␛[0m
    ␛[0;32mI (84) boot: SPI Speed      : 40MHz␛[0m
    ␛[0;32mI (89) boot: SPI Mode       : DIO␛[0m
    ␛[0;32mI (93) boot: SPI Flash Size : 4MB␛[0m
    ␛[0;32mI (97) boot: Partition Table:␛[0m
    ␛[0;32mI (100) boot: ## Label            Usage          Type ST Offset   Length␛[0m
    ␛[0;32mI (108) boot:  0 nvs              WiFi data        01 02 00009000 0007d000␛[0m
    ␛[0;32mI (115) boot:  1 otadata          OTA data         01 00 00086000 00002000␛[0m
    ␛[0;32mI (123) boot:  2 app0             OTA app          00 10 00090000 00100000␛[0m
    ␛[0;32mI (130) boot:  3 app1             OTA app          00 11 00190000 00100000␛[0m
    ␛[0;32mI (138) boot:  4 spiffs           Unknown data     01 82 00290000 0007d000␛[0m
    ␛[0;32mI (145) boot: End of partition table␛[0m
    ␛[0;31mE (150) boot: ota data partition invalid and no factory, will try all partitions␛[0m
    ␛[0;31mE (158) esp_image: image at 0x90000 has invalid magic byte␛[0m
    ␛[0;31mE (164) boot_comm: mismatch chip ID, expected 0, found 21␛[0m
    ␛[0;31mE (170) boot_comm: can't run on lower chip revision, expected 1, found 204␛[0m
    ␛[0;33mW (177) esp_image: image at 0x90000 has invalid SPI mode 100␛[0m
    ␛[0;33mW (184) esp_image: image at 0x90000 has invalid SPI size 15␛[0m
    ␛[0;31mE (190) boot: OTA app partition slot 0 is not bootable␛[0m
    ␛[0;31mE (196) esp_image: image at 0x190000 has invalid magic byte␛[0m
    ␛[0;31mE (202) boot_comm: mismatch chip ID, expected 0, found 65535␛[0m
    ␛[0;31mE (208) boot_comm: can't run on lower chip revision, expected 1, found 255␛[0m
    ␛[0;33mW (216) esp_image: image at 0x190000 has invalid SPI mode 255␛[0m
    ␛[0;33mW (222) esp_image: image at 0x190000 has invalid SPI size 15␛[0m
    ␛[0;31mE (229) boot: OTA app partition slot 1 is not bootable␛[0m
    ␛[0;31mE (235) boot: No bootable app partitions in the partition table␛[0m
    ets Jun  8 2016 00:22:57

This is my partition table:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  500k,
otadata,  data, ota,     ,8k,
app0,     app,  ota_0,   , 1M,
app1,     app,  ota_1,   ,1M,
spiffs,   data, spiffs,  ,500k,

Not sure why this is happening.

Seems like it’s just reading erased flash values (0xffff....) and not the program. Maybe PIO doesn’t upload the application binaries into the correct address in flash. When invoking a “Verbose Upload” (pio run -t upload -v), what is the invocation and which file is uploaded to which address?

Also, with what full platformio.ini and other files can the problem be reproduced?

Thanks for the quick reply. Not sure if this is what you asked for:

“/home/maxwell/.platformio/penv/bin/python” “/home/maxwell/.platformio/packages/tool-esptoolpy/” --chip esp32 --port “/dev/ttyUSB0” --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /home/maxwell/Documents/PlatformIO/Projects/200630-225357-espidf-arduino-wifiscan/.pio/build/esp32dev/bootloader.bin 0x8000 /home/maxwell/Documents/PlatformIO/Projects/200630-225357-espidf-arduino-wifiscan/.pio/build/esp32dev/partitions.bin 0x10000 .pio/build/esp32dev/firmware.bin v2.6
Serial port /dev/ttyUSB0
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: a4:cf:12:86:fe:1c
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Configuring flash size…
Auto-detected Flash size: 4MB
Compressed 25504 bytes to 14986…

These are the program files:

Writing at 0x00010000… (2 %)
Writing at 0x00014000… (5 %)
Writing at 0x00018000… (7 %)
Writing at 0x0001c000… (10 %)
Writing at 0x00020000… (13 %)
Writing at 0x00024000… (15 %)
Writing at 0x00028000… (18 %)
Writing at 0x0002c000… (21 %)
Writing at 0x00030000… (23 %)
Writing at 0x00034000… (26 %)
Writing at 0x00038000… (28 %)
Writing at 0x0003c000… (31 %)
Writing at 0x00040000… (34 %)
Writing at 0x00044000… (36 %)
Writing at 0x00048000… (39 %)
Writing at 0x0004c000… (42 %)
Writing at 0x00050000… (44 %)
Writing at 0x00054000… (47 %)
Writing at 0x00058000… (50 %)
Writing at 0x0005c000… (52 %)
Writing at 0x00060000… (55 %)
Writing at 0x00064000… (57 %)
Writing at 0x00068000… (60 %)
Writing at 0x0006c000… (63 %)
Writing at 0x00070000… (65 %)
Writing at 0x00074000… (68 %)
Writing at 0x00078000… (71 %)
Writing at 0x0007c000… (73 %)
Writing at 0x00080000… (76 %)
Writing at 0x00084000… (78 %)
Writing at 0x00088000… (81 %)
Writing at 0x0008c000… (84 %)
Writing at 0x00090000… (86 %)
Writing at 0x00094000… (89 %)
Writing at 0x00098000… (92 %)
Writing at 0x0009c000… (94 %)
Writing at 0x000a0000… (97 %)
Writing at 0x000a4000… (100 %)



platform = espressif32

framework =



board = esp32dev

build_flags =

-D ESP32

board_build.partitions = partition.csv

build_unflags =



monitor_speed = 115200

platform_packages = framework-arduinoespressif32 @ GitHub - espressif/arduino-esp32: Arduino core for the ESP32

lib_compat_mode = strict

lib_deps =


SHA-1 Hash


GitHub - me-no-dev/ESPAsyncWebServer: Async Web Server for ESP8266 and ESP32

GitHub - bblanchon/ArduinoJson: 📟 JSON library for Arduino and embedded C++. Simple and efficient.

Just bumping this as I am still facing this issue.


I have some updates on this issue.
The problem is that the app partition must be situated at 0x10000 offset otherwise the ESP32 will throw errors.

I was able to expand the nvs partition by placing it at the bottom but then it caused issues with the WiFi library which heavily relies on the nvs partition.

So I removed the ota patition and expanded the partition table by 0x2000. I want to use more space as I want to store more key-value pairs in the nvs but I am limited by the WiFi library requiring the nvs partition at 0x9000 :confused: .