Hello,
I am using VSCode and PIO to develop with esp-idf on a DevkitC device (ESP32-WROOM-32D). I have been able to flash & run code successfully for a while now, but today it has stopped working. The issue appeared after flashing espressif’s hello_world example manually with idf.py on the command line. The hello_world example flashes and runs fine, but now when I use platformIO’s toolchain, this happens:
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:7768
load:0x40078000,len:17328
load:0x40080400,len:4216
entry 0x400806e0
I (52) boot: ESP-IDF 4.3.2 2nd stage bootloader
I (52) boot: compile time 17:28:38
I (53) boot: chip revision: 1
I (56) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (63) boot.esp32: SPI Speed : 40MHz
I (68) boot.esp32: SPI Mode : DIO
I (72) boot.esp32: SPI Flash Size : 4MB
I (77) boot: Enabling RNG early entropy source...
I (82) boot: Partition Table:
I (86) boot: ## Label Usage Type ST Offset Length
I (93) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (100) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (108) boot: 2 factory factory app 00 00 00010000 00100000
I (116) boot: End of partition table
E (120) esp_image: image at 0x10000 has invalid magic byte (nothing flashed here?)
E (128) boot: Factory app partition is not bootable
E (134) boot: No bootable app partitions in the partition table
ets Jun 8 2016 00:22:57
This continues in a loop … it looks like the program has not actually been flashed to the correct location. However, PIO uploads just fine:
> Executing task: platformio run --target upload --environment esp32dev <
Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)
-------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf 3.40302.0 (4.3.2)
- tool-cmake 3.16.4
- tool-esptoolpy 1.30100.210531 (3.1.0)
- tool-mkspiffs 2.230.0 (2.30)
- tool-ninja 1.9.0
- toolchain-esp32ulp 1.22851.191205 (2.28.51)
- toolchain-riscv32-esp 8.4.0+2021r2-patch2
- toolchain-xtensa-esp32 8.4.0+2021r2-patch2
- toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ off
Found 2 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Retrieving maximum program size .pio/build/esp32dev/firmware.elf
Checking size .pio/build/esp32dev/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 3.9% (used 12872 bytes from 327680 bytes)
Flash: [== ] 15.5% (used 163049 bytes from 1048576 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/cu.usbserial-120
Uploading .pio/build/esp32dev/firmware.bin
esptool.py v3.1
Serial port /dev/cu.usbserial-120
Connecting........_____..
Chip is ESP32-D0WD (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e8:68:e7:30:af:f8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00010fff...
Flash will be erased from 0x00020000 to 0x00047fff...
Compressed 29408 bytes to 17609...
Writing at 0x00001000... (50 %)
Writing at 0x00007bf4... (100 %)
Wrote 29408 bytes (17609 compressed) at 0x00001000 in 0.9 seconds (effective 251.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00010000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00010000 in 0.1 seconds (effective 339.7 kbit/s)...
Hash of data verified.
Compressed 163440 bytes to 85264...
Writing at 0x00020000... (16 %)
Writing at 0x0002af9f... (33 %)
Writing at 0x00030675... (50 %)
Writing at 0x00035dff... (66 %)
Writing at 0x0003e633... (83 %)
Writing at 0x000469a7... (100 %)
Wrote 163440 bytes (85264 compressed) at 0x00020000 in 2.5 seconds (effective 518.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
================================= [SUCCESS] Took 20.92 seconds =================================
I’m not really sure what’s going on here… any ideas? If I flash the basic hello_world example with idf.py like so:
idf.py -p /dev/tty.usbserial-320 flash
It works just fine. So it seems to me there is an issue with my PIO configuration.
Here is my platformio.ini:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
monitor_speed = 115200
monitor_filters = colorize
monitor_flags = --raw
monitor_rts = 0
monitor_dtr = 0
lib_compat_mode = off
build_flags = -DCONFIG_MBEDTLS_CMAC_C
build_type = debug
debug_tool = esp-prog
debug_speed = 500
debug_init_break =
[platformio]
description = Core firmware for ESP32 architecture.
Any ideas as to what might have happened here? I’ve tried erasing flash before uploading as well, with no luck. Here’s how I erased the flash:
esptool.py --chip esp32 --port /dev/tty.usbserial-320 erase_flash
Thanks in advance