ESP-IDF 4.2 reset on radio
Posted: Mon May 04, 2020 4:57 pm
I have a project using an Wroom-32 which I developed using ESP-IDF 4.1 and the legacy build tools (i.e. msys2). But 4.1 is behind the times so I tried moving up to 4.2 (legacy tools with 4.2 Dev and Cmake with 4.2 relaese). With any 4.2 version the Wroom resets as soon as I enable Bluetooth:
Anyway, you'll take one look at that and consider it's a power issue (yes, I did a lot of searching on this issue). However, I think that's a red herring because a) the code and hardware works perfectly well using IDF 4.1. In fact, I tried turning on WiFi and BLE on the Wroom and simultaneously a GSM modem (now there's a power sucker) and simultaneously a string of LEDs using ~100mA, and with IDF 4.1 it works fine. But 4.2 kills it if I just turn on BLE.
Another thing: I can run the example BLE apps with 4.2, just not my code. For reference, with 4.1 this is what happens:
Ah, and someone will pop up and say it's the partition size. I changed that too without success. However, the failure mode did change:
Apologies for the length of this post!I (13186) BLE: Starting nimble
I (13186) BTDM_INIT: BT controller compile version [d9cc6b1]
I (13196) system_api: Base MAC address is not set
I (13206) system_api: read default base MAC address from EFUSE
W (13226) phy_init: failed to load RF calibration data (0xffffffff), falling back to full calibration
ets Jun 8 2016 00:22:57
rst:0x8 (TG1WDT_SYS_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:4
load:0x3fff0034,len:7092
load:0x40078000,len:13696
load:0x40080400,len:4000
0x40080400: _init at ??:?
entry 0x40080688
I (58) boot: ESP-IDF v4.2-dev-1126-gd85d3d969 2nd stage bootloader
I (58) boot: compile time 21:03:42
I (58) boot: chip revision: 1
I (63) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (70) boot.esp32: SPI Speed : 40MHz
I (75) boot.esp32: SPI Mode : DIO
I (79) boot.esp32: SPI Flash Size : 2MB
W (84) boot.esp32: PRO CPU has been reset by WDT.
W (89) boot.esp32: WDT reset info: PRO CPU PC=0x400811ce
0x400811ce: xt_highint4 at G:/ESP32/idf4.2/esp-idf/components/esp_system/port/esp32/dport_panic_highint_hdl.S:62
W (95) boot.esp32: WDT reset info: APP CPU PC=0x4008b03a
0x4008b03a: ram_chip_i2c_readReg at /home/aiqin/git_tree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7_ana.c:59
I (101) boot: Enabling RNG early entropy source...
I (107) boot: Partition Table:
I (110) boot: ## Label Usage Type ST Offset Length
I (118) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (125) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (133) boot: 2 factory factory app 00 00 00010000 00100000
I (140) boot: End of partition table
Anyway, you'll take one look at that and consider it's a power issue (yes, I did a lot of searching on this issue). However, I think that's a red herring because a) the code and hardware works perfectly well using IDF 4.1. In fact, I tried turning on WiFi and BLE on the Wroom and simultaneously a GSM modem (now there's a power sucker) and simultaneously a string of LEDs using ~100mA, and with IDF 4.1 it works fine. But 4.2 kills it if I just turn on BLE.
Another thing: I can run the example BLE apps with 4.2, just not my code. For reference, with 4.1 this is what happens:
So, my supposition is that my code uses something that changed between 4.1 and 4.2 that causes this issue, and most likely that something isn't used by the simple example apps (or, at least, not triggered by them). How do I find out what that thing is?I (10792) BLE: Starting nimble
I (10792) BTDM_INIT: BT controller compile version [6decaaf]
I (10812) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (11062) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (11312) BLE: host task started
I (11312) gatt_svr: registered service 0x1800 with handle=1
I (11312) gatt_svr: registering characteristic 0x2a00 with def_handle=2 val_handle=3
Ah, and someone will pop up and say it's the partition size. I changed that too without success. However, the failure mode did change:
Both the above are repeatable, BTW. That is, the results are not flaky but give the same thing every time.I (20286) USER: new state: waking
I (20286) BLE: Starting nimble
I (20286) BTDM_INIT: BT controller compile version [d9cc6b1]
I (20296) system_api: Base MAC address is not set
I (20306) system_api: read default base MAC address from EFUSE
W (20326) phy_init: failed to load RF calibration data (0xffffffff), falling back to full calibration
ets Jun 8 2016 00:22:57
rst:0x8 (TG1WDT_SYS_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:4
load:0x3fff0034,len:7092
load:0x40078000,len:13696
load:0x40080400,len:4000
0x40080400: _init at ??:?
entry 0x40080688
I (58) boot: ESP-IDF v4.2-dev-1126-gd85d3d969 2nd stage bootloader
I (58) boot: compile time 20:59:28
I (58) boot: chip revision: 1
I (63) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (70) boot.esp32: SPI Speed : 40MHz
I (75) boot.esp32: SPI Mode : DIO
I (79) boot.esp32: SPI Flash Size : 2MB
W (84) boot.esp32: PRO CPU has been reset by WDT.
W (89) boot.esp32: WDT reset info: PRO CPU PC=0x400811ce
0x400811ce: xt_highint4 at G:/ESP32/idf4.2/esp-idf/components/esp_system/port/esp32/dport_panic_highint_hdl.S:62
W (95) boot.esp32: WDT reset info: APP CPU PC=0x4008b075
0x4008b075: ram_chip_i2c_readReg at /home/aiqin/git_tree/chip7.1_phy/chip_7.1/board_code/app_test/pp/phy/phy_chip_v7_ana.c:63 (discriminator 5)
I (101) boot: Enabling RNG early entropy source...
I (107) boot: Partition Table:
I (110) boot: ## Label Usage Type ST Offset Length
I (118) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (125) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (133) boot: 2 factory factory app 00 00 00010000 00124f80
I (140) boot: End of partition table