esphome / issues

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

ESP32-IDF: esp32_ble_tracker fails to link #2648

Open stintel opened 2 years ago

stintel commented 2 years ago

The problem

Enabling esp32_ble_tracker on ESP32-IDF causes link failure.

Which version of ESPHome has the issue?

2021.10.2

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

NA

What platform are you using?

ESP32-IDF

Board

esp32-c3-devkitm-1

Component causing the issue

esp32_ble_tracker

Example YAML snippet

---
esphome:
  name: bug

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf

wifi:
  ssid: !secret ssid_esk
  password: !secret pass_esk_wifi

esp32_ble_tracker:

Anything in the logs that might be useful for us?

Linking .pioenvs/bug/firmware.elf
/config/.esphome/platformio/packages/toolchain-riscv-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: .pioenvs/bug/src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.o: in function `esphome::esp32_ble_tracker::ESP32BLETracker::start_scan_(bool)':
/config/bug/src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp:223: undefined reference to `esp_ble_gap_set_scan_params'
/config/.esphome/platformio/packages/toolchain-riscv-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: /config/bug/src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp:226: undefined reference to `esp_ble_gap_start_scanning'
/config/.esphome/platformio/packages/toolchain-riscv-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: .pioenvs/bug/src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.o: in function `esphome::esp32_ble_tracker::ESP32BLETracker::loop()':
/config/bug/src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp:96: undefined reference to `esp_ble_gap_stop_scanning'
collect2: error: ld returned 1 exit status
*** [.pioenvs/bug/firmware.elf] Error 1

Additional information

No response

stintel commented 2 years ago

Still an issue on 2021.11.1.

krconv commented 2 years ago

Also an issue with the API component on esp-idf:

Full Build Log
INFO Reading configuration /config/esphome/home-power-monitor.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing home-power-monitor (board: esp-wrover-kit; framework: espidf; platform: platformio/espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf 3.40300.0 (4.3.0) 
 - tool-cmake 3.16.4 
 - tool-ninja 1.7.1 
Installing ESP-IDF's Python dependencies
Collecting future>=0.15.2
  Downloading future-0.18.2.tar.gz (829 kB)
Collecting pyparsing<2.4.0,>=2.0.3
  Downloading pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
Building wheels for collected packages: future
  Building wheel for future (setup.py): started
  Building wheel for future (setup.py): finished with status 'done'
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=a8e3057a7138927528463afe1eb8156cf226189443aae5dc18eee28fab2e21a1
  Stored in directory: /root/.cache/pip/wheels/2f/a0/d3/4030d9f80e6b3be787f19fc911b8e7aa462986a40ab1e4bb94
Successfully built future
Installing collected packages: pyparsing, future
Successfully installed future-0.18.2 pyparsing-2.3.1
Reading CMake configuration...
No dependencies
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/emporia_vue/emporia_vue.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/esp32/core.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/esp32/preferences.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/i2c/i2c.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/logger/logger.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/md5/md5.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/mdns/mdns_component.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/network/util.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/ota/ota_backend_arduino_esp32.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/ota/ota_backend_arduino_esp8266.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/ota/ota_backend_esp_idf.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/ota/ota_component.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/sensor/automation.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/sensor/filter.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/sensor/sensor.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/socket/bsd_sockets_impl.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/socket/lwip_raw_tcp_impl.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/wifi/wifi_component.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/wifi/wifi_component_esp32_arduino.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/wifi/wifi_component_esp8266.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/wifi/wifi_component_esp_idf.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/application.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/color.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/component.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/controller.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/entity_base.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/helpers.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/log.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/scheduler.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/core/util.o
Compiling /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o
Linking /data/home-power-monitor/.pioenvs/home-power-monitor/firmware.elf
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/mdns/mdns_component.o:(.literal._ZN7esphome4mdns13MDNSComponent16compile_records_Ev+0x4): undefined reference to `esphome::api::global_api_server'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/mdns/mdns_component.o:(.literal._ZN7esphome4mdns13MDNSComponent16compile_records_Ev+0x30): undefined reference to `esphome::api::APIServer::get_port() const'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/esphome/components/mdns/mdns_component.o: in function `esphome::mdns::MDNSComponent::compile_records_()':
/config/esphome/.esphome/build/home-power-monitor/src/esphome/components/mdns/mdns_component.cpp:31: undefined reference to `esphome::api::APIServer::get_port() const'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o:(.literal._Z5setupv+0xcc): undefined reference to `esphome::api::APIServer::APIServer()'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o:(.literal._Z5setupv+0xd0): undefined reference to `esphome::api::APIServer::set_port(unsigned short)'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o:(.literal._Z5setupv+0xd4): undefined reference to `esphome::api::APIServer::set_password(std::__cxx11::basic_string, std::allocator > const&)'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o:(.literal._Z5setupv+0xd8): undefined reference to `esphome::api::APIServer::set_reboot_timeout(unsigned int)'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o: in function `setup()':
/config/esphome/.esphome/build/home-power-monitor/src/main.cpp:79: undefined reference to `esphome::api::APIServer::APIServer()'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/home-power-monitor/src/main.cpp:80: undefined reference to `esphome::api::APIServer::set_port(unsigned short)'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/home-power-monitor/src/main.cpp:83: undefined reference to `esphome::api::APIServer::set_password(std::__cxx11::basic_string, std::allocator > const&)'
/data/cache/platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/home-power-monitor/.pioenvs/home-power-monitor/src/main.o: in function `setup()':
/data/cache/platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:657: undefined reference to `esphome::api::APIServer::set_reboot_timeout(unsigned int)'
collect2: error: ld returned 1 exit status
*** [/data/home-power-monitor/.pioenvs/home-power-monitor/firmware.elf] Error 1
========================= [FAILED] Took 157.93 seconds =========================
Full config
substitutions:
  device_name: home-power-monitor
  friendly_name: Home Power Monitor
  assigned_ip_address: "192.168.86.223"

esphome:
  name: ${device_name}

esp32:
  board: esp-wrover-kit
  framework:
    type: esp-idf

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  use_address: ${assigned_ip_address}

ota:

logger:
  level: VERY_VERBOSE

api:

i2c:

sensor:
  - platform: emporia_vue
    update_interval: 1s
    phases:
      - id: phase_a
        input: BLACK
    power:
      - name: "A"
        phase_id: phase_a
        input: "A"

external_components:
  - source: github://krconv/esphome@add-emporia-vue
    components: [emporia_vue]
    refresh: 1min
stintel commented 2 years ago

Also an issue with the API component on esp-idf:

Please report a separate issue for this. It's a different bug. Undefined reference, yes, but in a completely different component.

krconv commented 2 years ago

Actually, I fixed it by deleting my build directory and re-building

beikeland commented 2 years ago

Actually, I fixed it by deleting my build directory and re-building

was this in relation to the api component or the ble tracker? i'm still seeing the same ble tracking error.

jvrobert commented 2 years ago

I also have the exact same issue with the ble tracker.

bwees commented 2 years ago

Running into this issue as well. Any fixes? Deleted build directory and did a full clean. I have exact same board as well.

stintel commented 2 years ago

I came up with this but was unable to test so far as esphome/esphome@272ceadbb00d5980aa00c0ad5043878a330d275f seems to break with podman.

diff --git a/esphome/components/esp32_ble/__init__.py b/esphome/components/esp32_ble/__init__.py
index 4b5c741a..2a0c9fa8 100644
--- a/esphome/components/esp32_ble/__init__.py
+++ b/esphome/components/esp32_ble/__init__.py
@@ -2,7 +2,7 @@ import esphome.codegen as cg
 import esphome.config_validation as cv
 from esphome.const import CONF_ID
 from esphome.core import CORE
-from esphome.components.esp32 import add_idf_sdkconfig_option
+from esphome.components.esp32 import add_idf_sdkconfig_option, is_esp32c3

 DEPENDENCIES = ["esp32"]
 CODEOWNERS = ["@jesserockz"]
@@ -25,3 +25,6 @@ async def to_code(config):

     if CORE.using_esp_idf:
         add_idf_sdkconfig_option("CONFIG_BT_ENABLED", True)
+
+        if is_esp32c3:
+            cg.add_build_flag("-DBLE_42_FEATURE_SUPPORT")
bwees commented 2 years ago

Fixed by adding sdkconfig_options: CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y to config file under esp32 section

beikeland commented 2 years ago

For other noobs (like me) sdkconfig_options goes under framework, under esp32; might save you a few minutes.

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
jvrobert commented 2 years ago

Possibly dumb question - will esp32_ble_tracker support bluetooth 5 on the c3, or do we need a NIMBLE port? Also - thanks for the fix - will give it a try.

beikeland commented 2 years ago

sdkconfig_options: CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y

I'm seeing some side effects of this, intermittently not connecting to wifi with [D][esp-idf:000]: Error! Should use default active scan time parameter for WiFi scan when Bluetooth is enabled!!!!!! and OTA breaking if I enable esp32_ble_tracker. OTA fails like so:

INFO Reading configuration c3.yaml...
..
INFO Uploading .esphome/build/c3/.pioenvs/c3/firmware.bin (1344256 bytes)
ERROR Error receiving acknowledge binary size: timed out

log show

[15:06:55][D][ota:136]: Starting OTA Update from 10.10.0.119...
[15:06:55][V][ota:167]: OTA features is 0x01
[15:06:55][V][ota:250]: OTA size is 1344256 bytes
[15:07:00]E (23241) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[15:07:00]E (23241) task_wdt:  - loopTask (CPU 0)
[15:07:00]E (23241) task_wdt: Tasks currently running:
[15:07:00]E (23241) task_wdt: CPU 0: loopTask
[15:07:00]E (23241) task_wdt: Aborting.

followed by

stack dump and reboot ``` [15:27:23]abort() was called at PC 0x42073fb9 on core 0 [15:27:23]Core 0 register dump: [15:27:23]MEPC : 0x40386fce RA : 0x403876b8 SP : 0x3fc95e20 GP : 0x3fc8e888 WARNING Decoded 0x40386fce: panic_abort at /Users/2be2d/.platformio/packages/framework-espidf/components/esp_system/panic.c:367 WARNING Decoded 0x40386fce: panic_abort at /Users/2be2d/.platformio/packages/framework-espidf/components/esp_system/panic.c:367 [15:27:23]TP : 0x3fc5ff5c T0 : 0x37363534 T1 : 0x7271706f T2 : 0x33323130 [15:27:23]S0/FP : 0x3fc95e5c S1 : 0x3fc95e5c A0 : 0x3fc95e5c A1 : 0x3fc95e3e [15:27:23]A2 : 0x00000000 A3 : 0x3fc95e89 A4 : 0x00000001 A5 : 0x3fc9a000 [15:27:23]A6 : 0x7a797877 A7 : 0x76757473 S2 : 0x3fc95e40 S3 : 0x7fffffff [15:27:23]S4 : 0x3fc8fea8 S5 : 0x3fc8fe98 S6 : 0x3fc8fea0 S7 : 0x3fc8fe98 [15:27:23]S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000 [15:27:23]T3 : 0x6e6d6c6b T4 : 0x6a696867 T5 : 0x66656463 T6 : 0x62613938 [15:27:23]MSTATUS : 0x00001801 MTVEC : 0x40380001 MCAUSE : 0x00000007 MTVAL : 0x00000000 [15:27:23]MHARTID : 0x00000000 [15:27:23] [15:27:23]Stack memory: [15:27:23]3fc95e20: 0x00000000 0x00000000 0x3fc95e5c 0x4038cc8a 0x3fc8fea0 0x3fc8fe98 0x3fc8fea8 0x7fff0030 [15:27:23]3fc95e40: 0x37303234 0x39626633 0x3c137000 0x3fc9131c 0x3fc95e40 0x3fc91338 0x3fc95e3c 0x726f6261 [15:27:23]3fc95e60: 0x20292874 0x20736177 0x6c6c6163 0x61206465 0x43502074 0x34783020 0x33373032 0x20396266 [15:27:23]3fc95e80: 0x63206e6f 0x2065726f 0x00000030 0x00000000 0x3fc9a2dc 0x00000000 0x3c137000 0x42073fbc [15:27:23]3fc95ea0: 0x00001881 0x00000000 0x00000000 0x00002f60 0x00159000 0x00001000 0x00029000 0x00329000 [15:27:23]3fc95ec0: 0x00159000 0x00001000 0x00029000 0x00000001 0x00001881 0x80000007 0x00000081 0x4038019e [15:27:23]3fc95ee0: 0x00000001 0x3fc9dfa4 0xffffffff 0x3fc9dfa4 0x3fc9dfa4 0x00000001 0x3fca1024 0xffffffff [15:27:23]3fc95f00: 0x3fca1024 0x3fca1024 0x00000000 0x3fc95f10 0xffffffff 0x3fc95f10 0x3fc95f10 0x00000000 [15:27:23]3fc95f20: 0x3fc95f24 0xffffffff 0x3fc95f24 0x3fc95f24 0x00000000 0x3fc95f38 0xffffffff 0x3fc95f38 [15:27:23]3fc95f40: 0x3fc95f38 0x00000000 0x3fc95f4c 0xffffffff 0x3fc95f4c 0x3fc95f4c 0x00000000 0x3fc95f60 [15:27:23]3fc95f60: 0xffffffff 0x3fc95f60 0x3fc95f60 0x00000000 0x3fc95f74 0xffffffff 0x3fc95f74 0x3fc95f74 [15:27:23]3fc95f80: 0x00000000 0x3fc95f88 0xffffffff 0x3fc95f88 0x3fc95f88 0x00000000 0x3fc95f9c 0xffffffff [15:27:23]3fc95fa0: 0x3fc95f9c 0x3fc95f9c 0x00000000 0x3fc95fb0 0xffffffff 0x3fc95fb0 0x3fc95fb0 0x00000000 [15:27:23]3fc95fc0: 0x3fc95fc4 0xffffffff 0x3fc95fc4 0x3fc95fc4 0x00000000 0x3fc95fd8 0xffffffff 0x3fc95fd8 [15:27:23]3fc95fe0: 0x3fc95fd8 0x00000000 0x3fc95fec 0xffffffff 0x3fc95fec 0x3fc95fec 0x00000000 0x3fc96000 [15:27:23]3fc96000: 0xffffffff 0x3fc96000 0x3fc96000 0x00000000 0x3fc96014 0xffffffff 0x3fc96014 0x3fc96014 [15:27:23]3fc96020: 0x00000000 0x3fc96028 0xffffffff 0x3fc96028 0x3fc96028 0x00000000 0x3fc9603c 0xffffffff [15:27:23]3fc96040: 0x3fc9603c 0x3fc9603c 0x00000000 0x3fc96050 0xffffffff 0x3fc96050 0x3fc96050 0x00000000 [15:27:23]3fc96060: 0x3fc96064 0xffffffff 0x3fc96064 0x3fc96064 0x00000000 0x3fc96078 0xffffffff 0x3fc96078 [15:27:23]3fc96080: 0x3fc96078 0x00000000 0x3fc9608c 0xffffffff 0x3fc9608c 0x3fc9608c 0x00000000 0x3fc960a0 [15:27:23]3fc960a0: 0xffffffff 0x3fc960a0 0x3fc960a0 0x00000000 0x3fc960b4 0xffffffff 0x3fc960b4 0x3fc960b4 [15:27:23]3fc960c0: 0x00000000 0x3fc960c8 0xffffffff 0x3fc960c8 0x3fc960c8 0x00000001 0x3fc960dc 0xffffffff [15:27:23]3fc960e0: 0x3fcb0130 0x3fcb0130 0x00000000 0x3fc960f0 0xffffffff 0x3fc960f0 0x3fc960f0 0x00000003 [15:27:23]3fc96100: 0x3fc96104 0xffffffff 0x3fcb4f50 0x3fca89fc 0x00000009 0x3fc96118 0xffffffff 0x3fc9e900 [15:27:23]3fc96120: 0x3fc9c2fc 0x00000000 0x3fc9612c 0xffffffff 0x3fc9612c 0x3fc9612c 0x00000000 0x00000000 [15:27:23]3fc96140: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 [15:27:23]3fc96160: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 [15:27:23]3fc96180: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 [15:27:23]3fc961a0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 [15:27:23]3fc961c0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x3fc961e0 [15:27:23]3fc961e0: 0xffffffff 0x3fc961e0 0x3fc961e0 0x00000000 0x3fc961f4 0xffffffff 0x3fc961f4 0x3fc961f4 [15:27:23]3fc96200: 0x3fc96138 0x3fc96138 0x3fc961d8 0x3fc961c8 0x00000000 0x3fc96218 0xffffffff 0x3fc96218 [15:27:23] [15:27:23] [15:27:23] [15:27:23]ELF file SHA256: a765b6d0bf42a434 [15:27:23] [15:27:23]Rebooting... [15:27:23]x\x803ESP-ROM:esp32c3-api1-20210207 [15:27:23]Build:Feb 7 2021 [15:27:23]rst:0xc (RTC_SW_CPU_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [15:27:23]Saved PC:0x40385166 WARNING Decoded 0x40385166: esp_restart_noos at /Users/2be2d/.platformio/packages/framework-espidf/components/esp32c3/system_api_esp32c3.c:137 (discriminator 1) [15:27:23]SPIWP:0xee [15:27:23]mode:DIO, clock div:2 [15:27:23]load:0x3fcd6100,len:0x1804 [15:27:23]load:0x403ce000,len:0x8d4 [15:27:23]load:0x403d0000,len:0x293c [15:27:23]entry 0x403ce000 [15:27:23]I (35) boot: ESP-IDF 4.3.0 2nd stage bootloader [15:27:23]I (35) boot: compile time 15:15:02 [15:27:23]I (35) boot: chip revision: 3 [15:27:23]I (37) boot_comm: chip revision: 3, min. bootloader chip revision: 0 [15:27:23]I (44) boot.esp32c3: SPI Speed : 40MHz [15:27:23]I (48) boot.esp32c3: SPI Mode : DIO [15:27:23]I (53) boot.esp32c3: SPI Flash Size : 4MB [15:27:23]I (58) boot: Enabling RNG early entropy source... [15:27:23]I (63) boot: Partition Table: [15:27:23]I (67) boot: ## Label Usage Type ST Offset Length [15:27:23]I (74) boot: 0 nvs WiFi data 01 02 00009000 00004000 [15:27:23]I (82) boot: 1 otadata OTA data 01 00 0000d000 00002000 [15:27:23]I (89) boot: 2 phy_init RF data 01 01 0000f000 00001000 [15:27:23]I (97) boot: 3 app0 OTA app 00 10 00010000 001c0000 [15:27:23]I (104) boot: 4 app1 OTA app 00 11 001d0000 001c0000 [15:27:23]I (112) boot: End of partition table [15:27:23]I (116) boot_comm: chip revision: 3, min. application chip revision: 0 [15:27:23]I (123) esp_image: segment 0: paddr=00010020 vaddr=3c110020 size=410b0h (266416) map [15:27:23]I (189) esp_image: segment 1: paddr=000510d8 vaddr=3fc8e000 size=03d18h ( 15640) load [15:27:23]I (193) esp_image: segment 2: paddr=00054df8 vaddr=40380000 size=0b220h ( 45600) load [15:27:23]I (206) esp_image: segment 3: paddr=00060020 vaddr=42000020 size=1059cch (1071564) map [15:27:23]I (437) esp_image: segment 4: paddr=001659f4 vaddr=4038b220 size=02d74h ( 11636) load [15:27:23]I (440) esp_image: segment 5: paddr=00168770 vaddr=50000000 size=00010h ( 16) load [15:27:23]I (447) boot: Loaded app from partition at offset 0x10000 [15:27:23]I (449) boot: Disabling RNG early entropy source... [15:27:23]I (466) cpu_start: Pro cpu up. [15:27:23]I (478) cpu_start: Pro cpu start user code [15:27:23]I (478) cpu_start: cpu freq: 160000000 [15:27:23]I (478) cpu_start: Application information: [15:27:24]I (481) cpu_start: Project name: c3 [15:27:24]I (485) cpu_start: App version: 1 [15:27:24]I (490) cpu_start: Compile time: Jan 23 2022 15:14:10 [15:27:24]I (496) cpu_start: ELF file SHA256: a765b6d0bf42a434... [15:27:24]I (502) cpu_start: ESP-IDF: 4.3.0 [15:27:24]I (507) heap_init: Initializing. RAM available for dynamic allocation: [15:27:24]I (514) heap_init: At 3FC9A5B0 len 00025A50 (150 KiB): DRAM [15:27:24]I (520) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM [15:27:24]I (527) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM [15:27:24]I (534) spi_flash: detected chip: generic [15:27:24]I (538) spi_flash: flash io: dio [15:27:24]I (543) sleep: Configure to isolate all GPIO pins in sleep state [15:27:24]I (549) sleep: Enable automatic switching of GPIO sleep confiV\xf7[I][logger:214]: Log initialized ```
config ```yaml esphome: name: c3 platformio_options: board_build.f_flash: 40000000L board_build.flash_mode: dio board_build.flash_size: 4MB esp32: board: esp32-c3-devkitm-1 framework: type: esp-idf version: recommended sdkconfig_options: CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y variant: esp32c3 wifi: ssid: !secret iot_ssid password: !secret iot_password domain: !secret iot_domain #use_address: 10.10.0.166 logger: level: VERY_VERBOSE api: encryption: key: !secret api_key id: id_api ota: password: !secret ota_password id: id_ota esp32_ble_tracker: binary_sensor: - platform: gpio name: "C3 Pin IO9" pin: 9 switch: - platform: gpio pin: 18 name: "C3 LED IO18 Orange" inverted: false id: led18 - platform: gpio pin: 19 name: "C3 LED IO19 White" inverted: false id: led19 # use RGB as individual outputs - platform: gpio pin: 3 name: "C3 LED IO3 Red(RGB)" inverted: false id: led3 - platform: gpio pin: 4 name: "C3 LED IO4 Green(RGB)" inverted: false id: led4 - platform: gpio pin: 5 name: "C3 LED IO5 Blue(RGB)" inverted: false id: led5 ```
stintel commented 2 years ago

OTA fails like so:

INFO Reading configuration c3.yaml...
..
INFO Uploading .esphome/build/c3/.pioenvs/c3/firmware.bin (1344256 bytes)
ERROR Error receiving acknowledge binary size: timed out

Same here. Adding CONFIG_ESP_TASK_WDT: n seems to solve that.

beikeland commented 2 years ago

Same here. Adding CONFIG_ESP_TASK_WDT: n seems to solve that.

Perfect! Thanks, seems to work here as well.

stintel commented 2 years ago

Same here. Adding CONFIG_ESP_TASK_WDT: n seems to solve that.

Looks like keeping the task watchdog timer enabled and increasing the timeout from default 5 to 10 also solves the problem. This is probably better than completely disabling it.

      CONFIG_ESP_TASK_WDT: y
      CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
nstrelow commented 2 years ago

The suggestion in #2968 fixed my problem:

Fixed by adding sdkconfig_options: CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y to config file.