esp-idf: register_chipv7_phy does not return, and makes the watchdog to call panic() (IDFGH-11529)
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
4.3.0
Espressif SoC revision.
ESP32-D0WD (revision v1.0)
Operating System used.
Windows
How did you build your project?
Other (please specify in More Information)
If you are using Windows, please specify command line type.
None
Development Kit.
Custom Board
Power Supply used.
External 3.3V
What is the expected behavior?
A bit of context:
- we have a partition called factory image and an application partition
- we have a custom bootloader, that decides which partition to run. Basically, when there are too many non-controlled restarts while running the app, the factory image kicks in. The factory image has the ota process running, so when running it allows to write the app partition.
- both the factory image and app use the idf 4.3 but the factory image is being built using Platformio and the app uses the idf.
When the esp is first flashed, only with the bl + fi partitions, everything goes well. The fi runs, the ota process works fine, etc. When you load an application and the application calls esp_restart() for some reason, then the BL decides whether to start the FI or the app again.
I made an app image that deliberately calls to esp_restart(); After some tries, the FI should be running again allowing us to OTA the app with a diff image.
What is the actual behavior?
When the FI runs again after, what happens is that the watchdog kicks and the system gets restarted (I configured the watchdog to call the panic() handler) I dug into and I found that the execution is being stuck when esp_phy_enable() -> esp_phy_load_cal_and_init() -> register_chipv7_phy() is called.
Steps to reproduce.
I don’t have any way of sharing my binaries.
I configure both FI and APP so the PHY is always configured to call register_chipv7_phy(init_data, cal_data, PHY_RF_CAL_FULL);
Cal data is not stored in the NVS, so I don;t have the partition for that.
Debug Logs.
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:0x3fff0030,len:7944
load:0x40078000,len:14412
ho 0 tail 12 room 4
load:0x40080400,len:4124
0x40080400: _init at ??:?
entry 0x400806a8
I (29) boot: ESP-IDF 4.3.2 2nd stage bootloader
I (29) boot: compile time 08:55:53
I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (52) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (61) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data (Arduino FW forces this) 01 02 00009000 00005000
I (78) boot: 1 otadata OTA data 01 00 0000e000 00002000
I (85) boot: 2 app0 OTA app 00 10 00010000 001f0000
I (93) boot: 3 factory factory app 00 00 00200000 001f0000
I (100) boot: 4 nvs_storage Other user NVS 01 02 003f0000 00010000
I (108) boot: End of partition table
I (112) boot: Reset Reason: 12 Boot CMD 0 attempts: 3
I (118) boot: Unstable app
I (121) boot_comm: chip revision: 1, min. application chip revision: 0
I (128) esp_image: segment 0: paddr=00200020 vaddr=3f400020 size=25b88h (154504) map
I (193) esp_image: segment 1: paddr=00225bb0 vaddr=3ffb0000 size=040b0h ( 16560) load
I (199) esp_image: segment 2: paddr=00229c68 vaddr=40080000 size=063b0h ( 25520) load
I (210) esp_image: segment 3: paddr=00230020 vaddr=400d0020 size=970b8h (618680) map
I (434) esp_image: segment 4: paddr=002c70e0 vaddr=400863b0 size=0f9e8h ( 63976) load
I (461) esp_image: segment 5: paddr=002d6ad0 vaddr=50000000 size=00010h ( 16) load
I (472) boot: Loaded app from partition at offset 0x200000
I (472) boot: Disabling RNG early entropy source...
I (484) cpu_start: Pro cpu up.
I (484) cpu_start: Starting app cpu, entry point is 0x400813c8
0x400813c8: call_start_cpu1 at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_system\port/cpu_start.c:150
I (469) cpu_start: App cpu up.
I (498) cpu_start: Pro cpu start user code
I (498) cpu_start: cpu freq: 160000000
I (498) cpu_start: Application information:
I (503) cpu_start: Project name: factory_image
I (508) cpu_start: App version: demo_bootloop-212-gb90a479-dirt
I (515) cpu_start: Compile time: Nov 23 2023 08:54:05
I (521) cpu_start: ELF file SHA256: fab343c93884f3d4...
I (527) cpu_start: ESP-IDF: 4.3.2
I (532) heap_init: Initializing. RAM available for dynamic allocation:
I (539) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (545) heap_init: At 3FFB8058 len 00027FA8 (159 KiB): DRAM
I (551) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (558) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (564) heap_init: At 40095D98 len 0000A268 (40 KiB): IRAM
I (572) spi_flash: detected chip: gd
I (575) spi_flash: flash io: dio
W (579) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (593) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (743) wifi:wifi driver task: 3ffc1ac0, prio:23, stack:3584, core=0
I (743) system_api: Base MAC address is not set
I (743) system_api: read default base MAC address from EFUSE
I (753) wifi:wifi firmware version: eb52264
I (753) wifi:wifi certification version: v7.0
I (753) wifi:config NVS flash: disabled
I (763) wifi:config nano formating: disabled
I (763) wifi:Init data frame dynamic rx buffer num: 32
I (773) wifi:Init management frame dynamic rx buffer num: 32
I (773) wifi:Init management short buffer num: 32
I (783) wifi:Init dynamic tx buffer num: 32
I (783) wifi:Init static rx buffer size: 1600
I (793) wifi:Init static rx buffer num: 10
I (793) wifi:Init dynamic rx buffer num: 32
I (793) wifi_init: rx ba win: 6
I (803) wifi_init: tcpip mbox: 32
I (803) wifi_init: udp mbox: 6
I (803) wifi_init: tcp mbox: 6
I (813) wifi_init: tcp tx win: 5744
I (813) wifi_init: tcp rx win: 5744
I (823) wifi_init: tcp mss: 1440
I (823) wifi_init: WiFi IRAM OP enabled
I (823) wifi_init: WiFi RX IRAM OP enabled
I (833) connect_to_network: Connecting to Network...
I (843) connect_to_network: set mode ok
I (843) connect_to_network: set config ok
I (853) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
E (5733) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (5733) task_wdt: - IDLE (CPU 0)
E (5733) task_wdt: Tasks currently running:
E (5733) task_wdt: CPU 0: wifi
E (5733) task_wdt: CPU 1: IDLE
E (5733) task_wdt: Aborting.
abort() was called at PC 0x40132542 on core 0
0x40132542: task_wdt_isr at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_common\src/task_wdt.c:182 (discriminator 1)
Backtrace:0x400817d2:0x3ffb07b0 0x40089e75:0x3ffb07d0 0x40090522:0x3ffb07f0 0x40132542:0x3ffb0860 0x400820a9:0x3ffb0880 0x40087245:0x3ffc18c0 0x40125669:0x3ffc18e0 0x40126db5:0x3ffc1900 0x40127363:0x3ffc1930 0x40127d7e:0x3ffc1950 0x400db4c5:0x3ffc1980 0x400db567:0x3ffc19a0 0x4010c03a:0x3ffc19c0 0x4010c7a9:0x3ffc19e0 0x4010b614:0x3ffc1a00 0x40091fbd:0x3ffc1a20
0x400817d2: panic_abort at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_system/panic.c:404
0x40089e75: esp_system_abort at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_system/system_api.c:112
0x40090522: abort at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\newlib/abort.c:46
0x40132542: task_wdt_isr at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_common\src/task_wdt.c:182 (discriminator 1)
0x400820a9: _xt_lowint1 at xtensa_vectors.o:?
0x40087245: esp_dport_access_reg_read at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp32/dport_access.c:259
0x40125669: ram_check_noise_floor at /home/cff/gittree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7.c:2291
0x40126db5: noise_init at /home/cff/gittree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7.c:2433
0x40127363: bb_init at /home/cff/gittree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7.c:2796
0x40127d7e: register_chipv7_phy at /home/cff/gittree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7.c:3782
0x400db4c5: esp_phy_load_cal_and_init at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_wifi\src/phy_init.c:669 (discriminator 13)
0x400db567: esp_phy_enable at C:\Users\Franco\.platformio\packages\framework-espidf@3.40302.0\components\esp_wifi\src/phy_init.c:242
0x4010c03a: wifi_hw_start at ??:?
0x4010c7a9: wifi_start_process at ??:?
0x4010b614: ieee80211_ioctl_process at ??:?
0x40091fbd: ppTask at ??:?
More Information.
No response
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 17 (1 by maintainers)
just closing this, you were really helpful Thanks
Hi again! Seems to be working now! I also tested the original
lib_phy.aand also worked. So what I am going to do is to create a patch forphy_init.c.It seems that 4.3.0 is not gonna have any more support, so I guess I will have to move to 4.4.0 or even further. 😃 Thanks for the help!