Custom partition scheme not working, but it does in Arduino IDE

I am struggling setting my custom partition scheme for an ESP32 board (16MB).

I have multiple ESP32’s (4MB and 16MB) and i also have 2 partition schemes. The last few months i was making my firmware on the 4MB board which worked great, but now i need a bigger partition because my firmware is getting bigger.

I switched back to my 16MB ESP32 but as soon as i use the old 16MB partition it keeps crashing

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4

The ESP reboots over and over again.

This is the partition scheme:

Name, Type, SubType, Offset, Size, Flags

nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x780000,
app1, app, ota_1, 0x790000, 0x780000,
spiffs, data, spiffs, 0xf10000, 0xf0000,

I have tripple checked that this is a 16MB ESP but Arduino IDE shows the auto detected size is 16MB, and also EPS Tools shows it.
But apart from that, with the Arduino IDE i can use the same partition scheme, and it WORKS!

I have no clue what to do because it works in Arduino IDE but whatever i change, it doesn’t work on Platformio.

If i use the 4MB scheme on the 16MB esp32 via platformio, it does work so this is even more crazy in my opinion

Update, even adding this in my platformio.ini makes the esp crash

board_build.partitions = large_spiffs_16MB.csv

It seems that everything over 4MB makes the ESP crash, but 16 MB uploaded via Arduino IDE just works perfectly

What do these boot messages look like when you flash a firmware via the Arduino IDE?

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4

This is when i upload an empty sketch (with setup and loop) with the same partition table via Arduino, it works and i get the above output

But the clock divider here is only 1, so it’s operating at a higher frequency.

When you add

board_build.f_flash = 80000000L

to the platformio.ini, does it change anything?

If not, make sure your PlatformIO core and platform are up-to-date. Open a CLI and execute

pio upgrade --dev
pio pkg update -g -p espressif32

to do so.

Thanks for your reply.

board_build.f_flas = 80000000L doesn’t change anything.

When i run this line, i get the following error:

pio upgrade --dev
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'c:\program files\python39\python.exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = 'c:\\program files\\python39\\python.exe'
  sys.base_prefix = ''
  sys.base_exec_prefix = ''
  sys.platlibdir = 'lib'
  sys.executable = 'c:\\program files\\python39\\python.exe'
  sys.prefix = ''
  sys.exec_prefix = ''
  sys.path = [
    'c:\\program files\\python39\\python39.zip',
    'C:\\Program Files\\Python39\\Lib\\',
    'C:\\Program Files\\Python39\\DLLs\\',
    'c:\\program files\\python39',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

I see after adding board_build.f_flash = 80000000L i get this result:

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:12812
load:0x40080400,len:3032
entry 0x400805e4
ets Jul 29 2019 12:21:46

So now it is mode:DIO, clock div:1

UPDATE:
I switched back to my mac and could be sure i updated pio via your commands.

I still get the error:

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4

Update,
as soon as my partition scheme goes over 4096kb, it crashes.
I use a program (esp_tool_gui) and that one detects the flash size is 16mb. With arduino i can use a 16MB partition scheme, but Platformio makes the ESP crash when i use a partition scheme over 4096kb.

I have tried 5 different esps (which in my believe are all 16mb but on no esp it works)

No one has any idea?

I had a similar issue with flashing a custom Flash size.

make sure you didn’t forget to add board_upload.flash_size = 16MB to your platformio.ini

Thank you, that fixed it!