I am trying to setup over the air updates on my ESP-32 system using PlatformIO.
I set up an HTTP server on my computer on port 8070 using the command: python -m http.server 8070
in the directory containing the firmware.bin file.
The code I used for the ESP-32 came from the
esp-idf.
I copied the code exactly changing only the values of the EXAMPLE_WIFI_SSID
, EXAMPLE_WIFI_PASS
, EXAMPLE_SERVER_IP
, EXAMPLE_SERVER_PORT
, and the EXAMPLE_FILENAME
, then uploaded via serial to my ESP-32.
The ESP-32 continually rebooted after an output to the serial monitor.
The full output was:
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_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:5512
load:0x40078000,len:0
ho 12 tail 0 room 4
load:0x40078000,len:12488
entry 0x40078fd4
␛[0;32mI (30) boot: ESP-IDF 2.301.0 2nd stage bootloader␛[0m
␛[0;32mI (30) boot: compile time 13:49:15␛[0m
␛[0;32mI (30) boot: Enabling RNG early entropy source...␛[0m
␛[0;32mI (35) boot: SPI Speed : 40MHz␛[0m
␛[0;32mI (39) boot: SPI Mode : DIO␛[0m
␛[0;32mI (43) boot: SPI Flash Size : 4MB␛[0m
␛[0;32mI (47) boot: Partition Table:␛[0m
␛[0;32mI (51) boot: ## Label Usage Type ST Offset Length␛[0m
␛[0;32mI (58) boot: 0 nvs WiFi data 01 02 00009000 00006000␛[0m
␛[0;32mI (66) boot: 1 phy_init RF data 01 01 0000f000 00001000␛[0m
␛[0;32mI (73) boot: 2 factory factory app 00 00 00010000 00100000␛[0m
␛[0;32mI (81) boot: End of partition table␛[0m
␛[0;32mI (85) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0f914 ( 63764) map␛[0m
␛[0;32mI (116) esp_image: segment 1: paddr=0x0001f93c vaddr=0x3ffc0000 size=0x006d4 ( 1748) load␛[0m
␛[0;32mI (117) esp_image: segment 2: paddr=0x00020018 vaddr=0x400d0018 size=0x56798 (354200) map␛[0m
␛[0;32mI (247) esp_image: segment 3: paddr=0x000767b8 vaddr=0x3ffc06d4 size=0x027e8 ( 10216) load␛[0m
␛[0;32mI (251) esp_image: segment 4: paddr=0x00078fa8 vaddr=0x40080000 size=0x00400 ( 1024) load␛[0m
␛[0;32mI (254) esp_image: segment 5: paddr=0x000793b0 vaddr=0x40080400 size=0x099d4 ( 39380) load␛[0m
␛[0;32mI (278) esp_image: segment 6: paddr=0x00082d8c vaddr=0x400c0000 size=0x00000 ( 0) load␛[0m
␛[0;32mI (285) boot: Loaded app from partition at offset 0x10000␛[0m
␛[0;32mI (285) boot: Disabling RNG early entropy source...␛[0m
␛[0;32mI (288) cpu_start: Pro cpu up.␛[0m
␛[0;32mI (291) cpu_start: Starting app cpu, entry point is 0x40080f50␛[0m
␛[0;32mI (283) cpu_start: App cpu up.␛[0m
␛[0;32mI (302) heap_init: Initializing. RAM available for dynamic allocation:␛[0m
␛[0;32mI (309) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM␛[0m
␛[0;32mI (315) heap_init: At 3FFC9410 len 00016BF0 (90 KiB): DRAM␛[0m
␛[0;32mI (321) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM␛[0m
␛[0;32mI (327) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM␛[0m
␛[0;32mI (334) heap_init: At 40089DD4 len 0001622C (88 KiB): IRAM␛[0m
␛[0;32mI (340) cpu_start: Pro cpu start user code␛[0m
␛[0;32mI (22) cpu_start: Starting scheduler on PRO CPU.␛[0m
␛[0;32mI (0) cpu_start: Starting scheduler on APP CPU.␛[0m
I (84) wifi: wifi firmware version: bffcf7f
I (84) wifi: config NVS flash: enabled
I (84) wifi: config nano formating: disabled
␛[0;32mI (84) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m
␛[0;32mI (94) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE␛[0m
I (114) wifi: Init dynamic tx buffer num: 32
I (114) wifi: Init data frame dynamic rx buffer num: 32
I (114) wifi: Init management frame dynamic rx buffer num: 32
I (124) wifi: wifi driver task: 3ffd2110, prio:23, stack:4096
I (124) wifi: Init static rx buffer num: 10
I (134) wifi: Init dynamic rx buffer num: 32
I (134) wifi: wifi power manager task: 0x3ffd6d50 prio: 21 stack: 2560
␛[0;32mI (144) ota: Setting WiFi configuration SSID Home...␛[0m
␛[0;32mI (174) phy: phy_version: 3662, 711a97c, May 9 2018, 14:29:06, 0, 0␛[0m
I (174) wifi: mode : sta (30:ae:a4:47:7b:b4)
␛[0;32mI (174) ota: Starting OTA example...␛[0m
␛[0;31mE (174) esp_ota_ops: not found ota data␛[0m
Guru Meditation Error: Core 1 panic'ed (LoadProhibited)
. Exception was unhandled.
Register dump:
PC : 0x400d11b6 PS : 0x00060030 A0 : 0x00000000 A1 : 0x3ffd9670
A2 : 0x3f400f74 A3 : 0x3ffce298 A4 : 0x00000000 A5 : 0x00010000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800d11af A9 : 0x3ffd9650
A10 : 0x000000b8 A11 : 0x3ffc4208 A12 : 0x3f400fe1 A13 : 0x3ffc4230
A14 : 0x00000005 A15 : 0x3ffc420c SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000008 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd
Backtrace: 0x400d11b6:0x3ffd9670 0x7ffffffd:0x3ffd96d0
From what I saw it got stuck on are these two lines:
const esp_partition_t *configured = esp_ota_get_boot_partition();
const esp_partition_t *running = esp_ota_get_running_partition();
which had ESP_LOGI(TAG, "Starting OTA example...");
before it and ESP_LOGI(TAG, "Configured and running");
after it
where the output in the serial monitor was:
␛[0;32mI (184) ota: Starting OTA example...␛[0m
␛[0;31mE (184) esp_ota_ops: not found ota data␛[0m
␛[0;32mI (184) ota: Configured and running␛[0m
I used PlatformIO to upload the code to my ESP-32.
based on an answer from esp32.com:
The partition table was the problem. To fix it, I did the following:
make menuconfig Partition Table Factory App, two OTA definitions Save Exit
I then ran make erase_flash flash
meaning, there might be an error in your partition table and you should check it.
after you make the change in your resolve_pkg
change your code from 0xE9 0x08 to 0xE9 0x09:
if (ota_write_data[0] == 0xE9 && i_write_len >= 2 && ota_write_data[1] == 0x08) {
ESP_LOGI(TAG, "OTA Write Header format Check OK. first byte is %02x ,second byte is %02x", ota_write_data[0], ota_write_data[1]);
} else {
ESP_LOGE(TAG, "OTA Write Header format Check Failed! first byte is %02x ,second byte is %02x", ota_write_data[0], ota_write_data[1]);
return 0;
}
Check out the link as well to see if it helps.
User contributions licensed under CC BY-SA 3.0