PlatformIO Community

ESP32 boot loop when changing partition table using default_8M.csv

So I have an ESP32-WROOM-32E module with 8MBytes of FLASH. Here is output from esptool.py confirming it:

acreque@ANDYS-HOME-MBPRO ~ % esptool.py --port /dev/cu.usbserial-14201 flash_id
esptool.py v4.1
Serial port /dev/cu.usbserial-14201
Connecting.........
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting.........
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 78:21:84:48:b2:f0
Uploading stub...
Running stub...
Stub running...
Manufacturer: 20
Device: 4017
Detected flash size: 8MB
Hard resetting via RTS pin...

To take advantage of the 8MB I have, I add these lines to platformio.ini, and put the proper .csv file in the root of my project folder:

board_build.f_flash = 80000000L
board_build.partitions = default_8MB.csv

Unfortunately, I get stuck in a boot loop like this:**

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:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5856
entry 0x400806a8
ets Jul 29 2019 12:21:46

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:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5856
entry 0x400806a8
ets Jul 29 2019 12:21:46
.
.
.

If I comment out the board_build.* lines above in platformio.ini all is well. Help would be greatly appreciated.

Andd when you leave that out?

Unfortunately, same result.

When you choose an 8MByte partition in the Arduino IDE, does it also not work there? Or if it does, what’s the exact settings in the Tools menu?

Seems to work fine in Arduino IDE. Here is my program/sketch:

void setup() 
{
  delay(2000);
  Serial.begin(115200);
}

int i = 0;

void loop() 
{
  Serial.print("PIO: ");
  Serial.println(i++);
  delay(500);
}

My Arduino IDE settings are as follows:

Screen Shot 2022-07-19 at 1.54.09 PM

I can compile, upload (using esp-prog), and run in Arduino IDE just fine. I can compile and upload (did not try debug) from PlatformIO just fine using this platformio.ini file, I get stuck in the boot loop.

[common]
platform = espressif32
board = esp32dev
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
monitor_port = /dev/cu.usbserial-14201
monitor_speed = 115200
upload_port = /dev/cu.usbserial-14200
upload_speed = 5000
;board_build.f_flash = 80000000L
board_build.partitions = default_8MB.csv

[env:ReleaseEnv]
platform = ${common.platform}
board = ${common.board}
framework = ${common.framework}
lib_extra_dirs = ${common.lib_extra_dirs}
monitor_port = ${common.monitor_port}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_port}
upload_speed = ${common.upload_speed}
;board_build.f_flash = ${common.board_build.f_flash}
board_build.partitions = ${common.board_build.partitions}
;lib_deps = hideakitai/ESP32SPISlave@^0.1.2

[env:DebugEnv]
platform = ${common.platform}
board = ${common.board}
framework = ${common.framework}
lib_extra_dirs = ${common.lib_extra_dirs}
monitor_port = ${common.monitor_port}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_port}
upload_speed = ${common.upload_speed}
;board_build.f_flash = ${common.board_build.f_flash}
board_build.partitions = ${common.board_build.partitions}
;lib_deps = hideakitai/ESP32SPISlave@^0.1.2
debug_tool = esp-prog
upload_protocol = esp-prog
debug_init_break = tbreak setup

If you rename this to [env], all other environments automatically inherit from it, so you can delete

all of that. But that’s just a minor restructure.

I see you select QIO as Flash mode, while PIO’s default is

what happens when you add

board_build.flash_mode = qio

?

I modified my platformio.ini as suggested (thank you!). But the result was the same. Here is my platformio.ini file and the boot loop info. If I comment out the board_build.partions line, everything works fine.

[env]
platform = espressif32
board = esp32dev
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
monitor_port = /dev/cu.usbserial-14201
monitor_speed = 115200
upload_port = /dev/cu.usbserial-14200
upload_speed = 5000
;board_build.f_flash = 80000000L
board_build.partitions = default_8MB.csv
board_build.flash_mode = qio

[env:ReleaseEnv]
;lib_deps = hideakitai/ESP32SPISlave@^0.1.2

[env:DebugEnv]
;lib_deps = hideakitai/ESP32SPISlave@^0.1.2
debug_tool = esp-prog
upload_protocol = esp-prog
debug_init_break = tbreak setup

Boot loop message:


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:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6360
entry 0x400806b4
ets Jul 29 2019 12:21:46

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:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6360
entry 0x400806b4
ets Jul 29 2019 12:21:46

What is the ESP32 version shown in Tools->Board->Board Manager in the Arudino IDE?

Here you go and thank you for taking the time to assist. Much appreciated.

Screen Shot 2022-07-19 at 2.26.40 PM

Set

platform = https://github.com/platformio/platform-espressif32.git

instead to get the Arduino-ESP32 2.0.4 version. Does it make a difference?

Oh boy. Things got worse. Now I can’t build and upload in PlatformIO at all without getting stuck in this boot loop. Arduino IDE is fine. BTW: In Arduino IDE I went back to 4M settings:

Screen Shot 2022-07-19 at 2.52.38 PM

platformio.ini file:

[env]
platform = https://github.com/platformio/platform-espressif32.git
board = esp32dev
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
monitor_port = /dev/cu.usbserial-14201
monitor_speed = 115200
upload_port = /dev/cu.usbserial-14200
upload_speed = 5000
;board_build.f_flash = 80000000L
;board_build.partitions = default_8MB.csv
board_build.flash_mode = qio

[env:ReleaseEnv]
;lib_deps = hideakitai/ESP32SPISlave@^0.1.2

[env:DebugEnv]
;lib_deps = hideakitai/ESP32SPISlave@^0.1.2
debug_tool = esp-prog
upload_protocol = esp-prog
debug_init_break = tbreak setup

New boot loop (looks different than previous):

rst:0x10 (RTCWDT_RTC_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:QIO, clock div:2
load:0x3fff0030,len:1344
load:0xffffffff,len:-1
ets Jul 29 2019 12:21:46

I’m baffled by how the most simple example won’t work. I would test on my board but it’s a regular ESP32Dev kit with only 4MByte Flash.

In any case, you should be able to revert back by setting platform = espressif32 again. If in doubt, remove the previous PlatformIO packages and platforms, e.g. with the terminal commands

rm -rf ~/.platformio/packages/*
rm -rf ~/.platformio/platforms/*
rm -rf ~/.platformio/.cache

What exact board are you using? Do you have a esp-prog currently attached? What happens when you upload the program via the regular USB port of the board?

I am baffled too! I ran the rm commands you provided and restored platform = espressif32 and I am back to where I was (thankfully). I am using a custom board with a genuine Espressif ESP32-WROOM-32E module soldered to it. I will share the schematic if you think that will help. It is really simple because I am just using the ESP32 module to scan for BLE beacons. I also want to switch to BLE UART mode occasionally too, but I am having problems (a topic for another day).

I have the esp-prog JTAG interface attached to the ESP32 module JTAG interface; Im using a tag-connect pogo pin adapter. Simultaneously, I have the esp-prog UART interface connected to the ESP32 module so I can receive debug print messages.

I will try uploading using the regular USB port on the board and follow up with results.

So, my board has a problem with it’s USB to UART chip (CP2102). This was not a problem using the esp-prog because it was directly connected to the ESP32 com signals. So, I switched to a simple adapter board I had. It is very simple. Just has 3.3V linear reg, power switch, CP2104 USB to UART, and the usual buttons and reset/boot transistors. It look like this:

tempImagehX8V1W

I still have the same problem. Can’t enable the 8MB memory partition(s). Argh!

If the settings between Arduino-ESP32 and PlatformIO are the same, and use the same core version, and the sketch is the same, it must have the same behavior. If that is still not the case, please open an issue at Issues · platformio/platform-espressif32 · GitHub.

Thanks @maxgerhardt. I was feeling stuck and lonely trying to solve this problem. Although we have not found the smoking gun yet, progress is being made. I want to capture all the version info you mentioned.

Can you give me some pointers on how do check the critical versions?

Thanks again for your willingness to help.

For PlatformIO, at the beginning of compilation, all “PACKAGES”: are shown with their version (e.g., framework-arduinoespressif32 = Arduino-ESP32), and above it the platform version (e.g., 5.0.0).

For the Arduino IDE, see the Tools → Board → Board Manager → esp32 for the Arduino-ESP32 core version.

In platformio.ini select a board that has your 8MB.
So no more
board = esp32dev
but eg
board = heltec_wifi_lora_32_V2 (randomly chosen)