esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

WiFi component causes bootloop with `ESP32-D0WD` (single core) #4830

Closed kquinsland closed 1 year ago

kquinsland commented 1 year ago

The problem

I am trying to build/flash ESPHome on an ESP32-D0WD / single core chip and I can reliable get a boot loop when compiling in wifi support.

Which version of ESPHome has the issue?

2023.8.2

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32-IDF

Board

No response

Component causing the issue

wifi

Example YAML snippet

substitutions:
  hostname: "desk-monitor-task-lamp"

esphome:
  name: ${hostname}
  name_add_mac_suffix: false

# See: https://github.com/esphome/issues/issues/2955
esp32:
  board: esp32dev
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_FREERTOS_UNICORE: y

# Enable logging
logger:
  level: DEBUG

wifi:
  ssid: !secret <blah>
  password: !secret <blah>

# The light bar has two banks of LEDs for WW/CW config
# See: https://esphome.io/components/light/cwww.html
##
light:
  - name: "${friendly_name_short}"
    platform: cwww
    id: leds
    icon: "mdi:wall-sconce-flat-outline"

    cold_white: out_pwm_cw
    warm_white: out_pwm_ww

    # The ali express listing indicates 2700/6500K.
    cold_white_color_temperature: 6600K
    warm_white_color_temperature: 2700 K
    constant_brightness: false

    ##
    # The lamp is meant more for work/focus so we keep the flashy things down to a minimum
    # See: https://esphome.io/components/light/index.html#light-effects
    effects:
      - pulse:
          update_interval: 2s

# Other than the GPIO that toggles the led drivers on/off, we have the two PWM channels
output:
  - id: light_enable
    platform: gpio
    pin: GPIO04

  - id: out_pwm_ww
    platform: ledc
    pin: GPIO19

  - id: out_pwm_cw
    platform: ledc
    pin: GPIO21

Anything in the logs that might be useful for us?

Here's the log output showing the compile, flash, boot -> loop.
I have (lightly) edited it to remove irrelevant details and obscured some pii.

Linking .pioenvs/desk-monitor-task-lamp/firmware.elf
RAM:   [=         ]   7.9% (used 25972 bytes from 327680 bytes)
Flash: [====      ]  36.3% (used 666441 bytes from 1835008 bytes)
Building .pioenvs/desk-monitor-task-lamp/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
<...>
Connecting.........................
Chip is unknown ESP32 (revision v1.1)
Features: WiFi, BT, Single Core, 240MHz, VRef calibration in efuse, Coding Scheme 3/4
Crystal is 40MHz
MAC: cc:b5:d1:AA:BB:CC
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 0x00010000 to 0x000b4fff...
<...>
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[14:30:23]\xe9\xf5\xed
                      \xa1U\xad\xf2\xf4ets Jun  8 2016 00:22:57
[14:30:23]
[14:30:23]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[14:30:23]configsip: 0, SPIWP:0xee
[14:30:23]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[14:30:23]mode:DIO, clock div:2
[14:30:23]load:0x3fff0030,len:6604
[14:30:23]ho 0 tail 12 room 4
[14:30:23]load:0x40078000,len:15064
[14:30:23]ho 0 tail 12 room 4
[14:30:23]load:0x40080400,len:3608
[14:30:23]entry 0x40080664
[14:30:23]I (30) boot: ESP-IDF 4.4.5 2nd stage bootloader
[14:30:23]I (30) boot: compile time 14:28:26
[14:30:23]I (30) boot: chip revision: v1.1
[14:30:23]I (33) boot.esp32: SPI Speed      : 40MHz
[14:30:23]I (38) boot.esp32: SPI Mode       : DIO
[14:30:23]I (42) boot.esp32: SPI Flash Size : 4MB
[14:30:23]I (47) boot: Enabling RNG early entropy source...
[14:30:23]I (52) boot: Partition Table:
[14:30:23]I (56) boot: ## Label            Usage          Type ST Offset   Length
[14:30:23]I (63) boot:  0 otadata          OTA data         01 00 00009000 00002000
[14:30:23]I (70) boot:  1 phy_init         RF data          01 01 0000b000 00001000
[14:30:23]I (78) boot:  2 app0             OTA app          00 10 00010000 001c0000
[14:30:23]I (85) boot:  3 app1             OTA app          00 11 001d0000 001c0000
[14:30:23]I (93) boot:  4 nvs              WiFi data        01 02 00390000 0006d000
[14:30:23]I (100) boot: End of partition table
[14:30:23]I (105) boot: No factory image, trying OTA 0
[14:30:23]I (110) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=1797ch ( 96636) map
[14:30:23]I (153) esp_image: segment 1: paddr=000279a4 vaddr=3ffb0000 size=026f4h (  9972) load
[14:30:23]I (157) esp_image: segment 2: paddr=0002a0a0 vaddr=40080000 size=05f78h ( 24440) load
[14:30:23]I (169) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=76a5ch (485980) map
[14:30:23]I (345) esp_image: segment 4: paddr=000a6a84 vaddr=40085f78 size=0d710h ( 55056) load
[14:30:23]I (377) boot: Loaded app from partition at offset 0x10000
[14:30:23]I (404) boot: Set actual ota_seq=1 in otadata[0]
[14:30:23]I (404) boot: Disabling RNG early entropy source...
[14:30:23]I (415) cpu_start: Pro cpu up.
[14:30:23]I (415) cpu_start: Single core mode
[14:30:23]I (423) cpu_start: Pro cpu start user code
[14:30:23]I (423) cpu_start: cpu freq: 160000000
[14:30:23]I (423) cpu_start: Application information:
[14:30:23]I (428) cpu_start: Project name:     desk-monitor-task-lamp
[14:30:24]I (434) cpu_start: App version:      2023.8.2
[14:30:24]I (439) cpu_start: Compile time:     Aug 23 2023 14:29:48
[14:30:24]I (445) cpu_start: ELF file SHA256:  029d3ee4f473dcb4...
[14:30:24]I (451) cpu_start: ESP-IDF:          4.4.5
[14:30:24]I (456) cpu_start: Min chip rev:     v0.0
[14:30:24]I (460) cpu_start: Max chip rev:     v3.99 
[14:30:24]I (465) cpu_start: Chip rev:         v1.1
[14:30:24]I (470) heap_init: Initializing. RAM available for dynamic allocation:
[14:30:24]I (477) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
[14:30:24]I (483) heap_init: At 3FFB6578 len 00029A88 (166 KiB): DRAM
[14:30:24]I (490) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
[14:30:24]I (496) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
[14:30:24]I (502) heap_init: At 40093688 len 0000C978 (50 KiB): IRAM
[14:30:24]I (508) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
[14:30:24]I (516) spi_flash: detected chip: generic
[14:30:24]I (519) spi_flash: flash io: dio
[14:30:24]I (524) cpu_start: Starting scheduler on PRO CPU.
[14:30:24][I][logger:262]: Log initialized
[14:30:24][I][app:029]: Running through setup()...
[14:30:24][D][esp-idf:000]: I (723) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
[14:30:24]
[14:30:24][D][ledc.output:055]: Calculating resolution bit-depth for frequency 1000.000000
[14:30:24][D][ledc.output:060]: Resolution calculated as 16
[14:30:24][D][ledc.output:055]: Calculating resolution bit-depth for frequency 1000.000000
[14:30:24][D][ledc.output:060]: Resolution calculated as 16
[14:30:24][C][light:035]: Setting up light 'Monitor Lamp'...
[14:30:24][D][light:036]: 'Monitor Lamp' Setting:
[14:30:24][D][light:041]:   Color mode: Cold/warm white
[14:30:24][D][light:085]:   Transition length: 1.0s
[14:30:24][C][wifi:038]: Setting up WiFi...
[14:30:24][D][esp-idf:000]: I (769) wifi:
[14:30:24][D][esp-idf:000]: wifi driver task: 3ffc19d4, prio:23, stack:6656, core=0
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (786) system_api: Base MAC address is not set
[14:30:24]
[14:30:24][D][esp-idf:000]: I (786) system_api: read default base MAC address from EFUSE
[14:30:24]
[14:30:24][D][esp-idf:000]: E (796) system_api: Base MAC address from BLK0 of EFUSE CRC error, efuse_crc = 0x5e; calc_crc = 0x82
[14:30:24]
[14:30:24][D][esp-idf:000]: I (809) wifi:
[14:30:24][D][esp-idf:000]: wifi firmware version: 0f80fa0
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (826) wifi:
[14:30:24][D][esp-idf:000]: wifi certification version: v7.0
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (827) wifi:
[14:30:24][D][esp-idf:000]: config NVS flash: enabled
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (847) wifi:
[14:30:24][D][esp-idf:000]: config nano formating: disabled
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (857) wifi:
[14:30:24][D][esp-idf:000]: Init data frame dynamic rx buffer num: 32
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (868) wifi:
[14:30:24][D][esp-idf:000]: Init management frame dynamic rx buffer num: 32
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (888) wifi:
[14:30:24][D][esp-idf:000]: Init management short buffer num: 32
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (898) wifi:
[14:30:24][D][esp-idf:000]: Init dynamic tx buffer num: 32
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (909) wifi:
[14:30:24][D][esp-idf:000]: Init static rx buffer size: 1600
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (919) wifi:
[14:30:24][D][esp-idf:000]: Init static rx buffer num: 10
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (929) wifi:
[14:30:24][D][esp-idf:000]: Init dynamic rx buffer num: 32
[14:30:24][D][esp-idf:000]: 
[14:30:24]
[14:30:24][D][esp-idf:000]: I (940) wifi_init: rx ba win: 6
[14:30:24]
[14:30:24][D][esp-idf:000]: I (949) wifi_init: tcpip mbox: 32
[14:30:24]
[14:30:24][D][esp-idf:000]: I (949) wifi_init: udp mbox: 6
[14:30:24]
[14:30:24][D][esp-idf:000]: I (960) wifi_init: tcp mbox: 6
[14:30:24]
[14:30:24][D][esp-idf:000]: I (970) wifi_init: tcp tx win: 5744
[14:30:24]
[14:30:24][D][esp-idf:000]: I (970) wifi_init: tcp rx win: 5744
[14:30:24]
[14:30:24][D][esp-idf:000]: I (980) wifi_init: tcp mss: 1440
[14:30:24]
[14:30:24][D][esp-idf:000]: I (980) wifi_init: WiFi IRAM OP enabled
[14:30:24]
[14:30:24][D][esp-idf:000]: I (990) wifi_init: WiFi RX IRAM OP enabled
[14:30:24]
[14:30:24][C][wifi:048]: Starting WiFi...
[14:30:24][D][esp-idf:000]: E (1001) system_api: Base MAC address from BLK0 of EFUSE CRC error, efuse_crc = 0x5e; calc_crc = 0x82
[14:30:24]
[14:30:24][C][wifi:049]:   Local MAC: CC:B5:D1:AA:BB:CC
[14:30:24][D][esp-idf:000]: I (1022) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
[14:30:24]
[14:30:24][D][esp-idf:000]: W (1031) phy_init: failed to load RF calibration data (0x1102), faESP_ERROR_CHECK failed: esp_err_t 0x109 (ESP_ERR_INVALID_CRC) at 0x400883e4
[14:30:24]file: "IDF/components/esp_phy/src/phy_init.c" line 725
[14:30:24]func: esp_phy_load_cal_and_init
[14:30:24]expression: esp_efuse_mac_get_default(sta_mac)
[14:30:24]
[14:30:24]abort() was called at PC 0x400883e7 on core 0
[14:30:24]
[14:30:24]
[14:30:24]Backtrace: 0x40081da2:0x3ffc17b0 0x400883f1:0x3ffc17d0 0x4008e0da:0x3ffc17f0 0x400883e7:0x3ffc1860 0x400e5a87:0x3ffc1880 0x400e5b31:0x3ffc18b0 0x40111b52:0x3ffc18d0 0x401122cd:0x3ffc18f0 0x40110b0c:0x3ffc1910 0x4008fa55:0x3ffc1930
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40081da2: panic_abort at /home/karl/.platformio/packages/framework-espidf/components/esp_system/panic.c:408
WARNING Decoded 0x400883f1: esp_system_abort at /home/karl/.platformio/packages/framework-espidf/components/esp_system/esp_system.c:137
WARNING Decoded 0x4008e0da: abort at /home/karl/.platformio/packages/framework-espidf/components/newlib/abort.c:46
WARNING Decoded 0x400883e7: _esp_error_check_failed at /home/karl/.platformio/packages/framework-espidf/components/esp_system/esp_err.c:43
WARNING Decoded 0x400e5a87: esp_phy_load_cal_and_init at /home/karl/.platformio/packages/framework-espidf/components/esp_phy/src/phy_init.c:725 (discriminator 1)
WARNING Decoded 0x400e5b31: esp_phy_enable at /home/karl/.platformio/packages/framework-espidf/components/esp_phy/src/phy_init.c:241
WARNING Decoded 0x40111b52: wifi_hw_start
WARNING Decoded 0x401122cd: wifi_start_process
WARNING Decoded 0x40110b0c: ieee80211_ioctl_process
WARNING Decoded 0x4008fa55: ppTask
[14:30:24]
[14:30:24]
[14:30:24]
[14:30:24]
[14:30:24]ELF file SHA256: 029d3ee4f473dcb4
[14:30:24]
[14:30:24]Rebooting...

Additional information

kquinsland commented 1 year ago

sigh. And of course right after I finish drafting the issue, I take a closer look at the stack trace and try a new tweak on my google search and bam:

There is already a ignore_efuse_mac_crc toggle:


esp32:
  framework:
     # <...>
    advanced:
      ignore_efuse_mac_crc: true

After re-compiling with ignore_efuse_mac_crc: true things boot