SzczepanLeon / esphome-components

127 stars 43 forks source link

ESP bootloops #115

Open bladecell opened 1 week ago

bladecell commented 1 week ago

I am trying to make the watermeter, but my ESP bootloops. I have double checked the CC1101 wiring, but I am not sure if that could cause it. I am looking for a direction to look for to find the issue. I am attaching the config yaml, ESP home log and serial log from esp. I have the ESP-WROOM-32.

yaml file ```yaml substitutions: log_level: "VERBOSE" log_wmbus: "VERBOSE" log_baudrate: "115200" esphome: name: wassermeter comment: "Wasserzähler ESP32, CUL - CC1101" friendly_name: Wassermeter preferences: flash_write_interval: 10min esp32: board: esp32dev framework: type: arduino logger: id: appslogger level: ${log_level} baud_rate: ${log_baudrate} logs: wmbus: ${log_wmbus} wMBus-lib: ${log_wmbus} sensor: WARN sensor.filter: WARN text_sensor: WARN api.service: ERROR json: ERROR mqtt: WARN scheduler: ERROR internal_temperature: ERROR wifi: WARN component: ERROR api: WARN api: encryption: key: !secret api ota: - platform: esphome password: !secret ota wifi: ssid: !secret wifi_ssid password: !secret wifi_password manual_ip: static_ip: 192.168.6.128 gateway: 192.168.6.1 subnet: 255.255.255.0 time: - platform: sntp id: time_sntp external_components: # uses the latest version from SzczepanLeon - source: github://SzczepanLeon/esphome-components@main refresh: 0s components: [wmbus] # ============================================================ # Hardware related setup # ## ------------------------------------------------------------------ ## WMBUS CC1101 --> ESP32-WROOM-32D ## ------------------------------------------------------------------ ## ANT ## | ## ╭――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x――x―╮ ╭―――――――――――x――o――x――――――――╮ ## | | | CC1101 | ## | ESP32-WROOM-32D | | G G M M | ## - | USB | -- ANT | C D D I C O G V | ## | | | S O O S L S N C | ## | 16 17 5 18 19 23 | | N 0 2 O K I D C | ## ╰――o――o――x――x――x――o――o――o――o――o――o――o――o――o――o――o――o――o――o―╯ ╰――o――o――o――o――o――o――o――o――╯ ## | GND RX2 | | | | | 1 2 3 4 5 6 7 8 ## 3.3V| | TX2 | | | | | | | | | | | | ## | | | | | | | | | | | | | | | | ## | | | | | | | 6 5 RX2 | 19 18 23 | 3.3 ## 8 7 2 3 1 5 4 TX2 GND ## ## ------------------------------------------------------------------ wmbus: mosi_pin: GPIO23 miso_pin: GPIO19 clk_pin: GPIO18 cs_pin: GPIO5 gdo0_pin: GPIO16 gdo2_pin: GPIO17 log_unknown: true ## --------------------------------------------------- ## SENSORS ## --------------------------------------------------- sensor: - platform: wmbus meter_id: "0" type: apator162 key: "00000000000000000000000000000000" lqi: name: "My lqi" rssi: name: "My RSSI" total_water_m3: name: "My cold water" text_sensor: - platform: wmbus name: "Text debug for Apator 16-2" ```
Serial log ``` ELF file SHA256: 0000000000000000 Rebooting... ets Jul 29 2019 12:21:46 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:1184 load:0x40078000,len:13132 load:0x40080400,len:3036 entry 0x400805e4 [ 6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz [1B][0;32m[I][logger:156]: Log initialized[1B][0m [1B][0;35m[C][safe_mode:079]: There have been 3 suspected unsuccessful boot attempts[1B][0m [1B][0;36m[D][esp32.preferences:114]: Saving 1 preferences to flash...[1B][0m [1B][0;37m[V][esp32.preferences:126]: sync: key: 233825507, len: 4[1B][0m [1B][0;36m[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed[1B][0m [1B][0;32m[I][app:029]: Running through setup()...[1B][0m [1B][0;37m[V][app:030]: Sorting components by setup priority...[1B][0m [1B][0;37m[V][esp32.preferences:059]: nvs_get_blob('2356459468'): ESP_ERR_NVS_NOT_FOUND - the key might not be set yet[1B][0m [1B][0;37m[V][wifi_esp32:067]: Enabling STA.[1B][0m [ 87][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY [1B][0;37m[V][wifi_esp32:486][1B][1;31m[arduino_events][1B][0;37m: Event: WiFi ready[1B][0m [ 179][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started [ 179][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START [1B][0;37m[V][wifi_esp32:497][1B][1;31m[arduino_events][1B][0;37m: Event: WiFi STA start[1B][0m [ 6002][V][WiFiGeneric.cpp:381] _arduino_event_cb(): SCAN Done: ID: 128, Status: 0, Results: 6 [ 6002][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 1 - SCAN_DONE [1B][0;37m[V][wifi_esp32:491][1B][1;31m[arduino_events][1B][0;37m: Event: WiFi Scan Done status=0 number=6 scan_id=128[1B][0m [ 6879][V][WiFiGeneric.cpp:353] _arduino_event_cb(): STA Connected: SSID: jot, BSSID: e6:63:da:37:3c:3d, Channel: 6, Auth: WPA2_PSK [ 6880][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 4 - STA_CONNECTED [ 6883][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got New IP:192.168.6.128 [1B][0;37m[V][wifi_esp32:516][1B][1;31m[arduino_events][1B][0;37m: Event: Connected ssid='jot' bssid=[1B][5mE6:63:DA:37:3C:3D[1B][6m channel=6, authmode=WPA2 PSK[1B][0m [ 6916][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 7 - STA_GOT_IP [ 6916][D][WiFiGeneric.cpp:991] _eventCallback(): STA IP: 192.168.6.128, MASK: 255.255.255.0, GW: 192.168.6.1 [1B][0;37m[V][wifi_esp32:570][1B][1;31m[arduino_events][1B][0;37m: Event: Got IP static_ip=192.168.6.128 gateway=192.168.6.1[1B][0m [1B][0;35m[C][sntp:023]: Setting up SNTP...[1B][0m E (24199) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: E (24199) task_wdt: - loopTask (CPU 1) E (24199) task_wdt: Tasks currently running: E (24199) task_wdt: CPU 0: IDLE E (24199) task_wdt: CPU 1: loopTask E (24199) task_wdt: Aborting. abort() was called at PC 0x400fad34 on core 0 Backtrace:0x400838b1:0x3ffbeb1c |<-CORRUPTED ELF file SHA256: 0000000000000000 Rebooting... ```
ESP home log ``` INFO ESPHome 2024.8.3 INFO Reading configuration /config/watermetertest.yaml... INFO Updating https://github.com/SzczepanLeon/esphome-components.git@main INFO Detected timezone 'Europe/Budapest' WARNING GPIO5 is a strapping PIN and should only be used for I/O with care. Attaching external pullup/down resistors to strapping pins can cause unexpected failures. See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins INFO Generating C++ source... INFO Compiling app... Processing wassermeter (board: esp32dev; framework: arduino; platform: platformio/espressif32@5.4.0) -------------------------------------------------------------------------------- HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5 Dependency Graph |-- WiFi @ 2.0.0 |-- ESPmDNS @ 2.0.0 |-- Update @ 2.0.0 |-- noise-c @ 0.1.6 |-- SPI @ 2.0.0 |-- SmartRC-CC1101-Driver-Lib @ 2.5.7+sha.b8c6af4 |-- wmbus-drivers @ 0.0.0+20240909224218.sha.c856f7d RAM: [= ] 13.0% (used 42564 bytes from 327680 bytes) Flash: [===== ] 53.0% (used 973189 bytes from 1835008 bytes) ========================= [SUCCESS] Took 5.89 seconds ========================= INFO Successfully compiled program. INFO Connecting to 192.168.6.128 INFO Uploading /data/build/wassermeter/.pioenvs/wassermeter/firmware.bin (978960 bytes) Uploading: [============================================================] 100% Done... INFO Upload took 9.30 seconds, waiting for result... INFO OTA successful INFO Successfully uploaded program. INFO Starting log output from 192.168.6.128 using esphome API INFO Successfully connected to wassermeter @ 192.168.6.128 in 7.143s WARNING Can't connect to ESPHome API for wassermeter @ 192.168.6.128: Handshake timed out after 30.0s (TimeoutAPIError) INFO Trying to connect to wassermeter @ 192.168.6.128 in the background WARNING wassermeter @ 192.168.6.128: Connection error occurred: wassermeter @ 192.168.6.128: Connection lost INFO Successfully connected to wassermeter @ 192.168.6.128 in 7.237s WARNING wassermeter @ 192.168.6.128: Connection error occurred: wassermeter @ 192.168.6.128: Connection lost INFO Successfully connected to wassermeter @ 192.168.6.128 in 3.196s WARNING wassermeter @ 192.168.6.128: Connection error occurred: wassermeter @ 192.168.6.128: Connection lost INFO Successfully connected to wassermeter @ 192.168.6.128 in 0.027s WARNING wassermeter @ 192.168.6.128: Connection error occurred: wassermeter @ 192.168.6.128: Connection lost INFO Successfully connected to wassermeter @ 192.168.6.128 in 15.226s WARNING wassermeter @ 192.168.6.128: Connection error occurred: wassermeter @ 192.168.6.128: Connection lost ```
szymon3 commented 4 days ago

I can confirm the same issue on my end using following pins connection IMG_4791

ivoh95 commented 3 days ago

I can confirm the same issue with a minimal yaml. ESP bootloops due to WDT being triggered if the connections are correct, if the cc1101 is not connected it marks the component as failed and does not trigger the wdt.

Some interesting observations, the first boot after applying power gives the following logs:

[23:19:21][D][rxLoop:031]: Set CC1101 frequency to 0.001MHz [21 09 5A]
[23:19:21][E][rxLoop:049]: CC1101 initialization FAILED!
[23:19:21][E][component:119]: Component wmbus was marked as failed.
[23:19:21][E][component:164]: Component wmbus set Error flag: unspecified
[23:19:21][E][wmbus:021]: CC1101 initialization failed.

Any reboots after first applying power trigger the WDT at the stage of setting frequency. It seems the frequency may be being set incorrectly which locks up the cc1101 module and causes the WDT to trigger on any subsequent communication? Is the frequency actually being set incorrectly to 0.001MHz?

Yaml used:

esphome:
  name: esp-water
  friendly_name: esp-water

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:
  level: VERBOSE
ota:
  platform: esphome

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

time:
  - platform: sntp
    id: time_sntp

external_components:
  - source: github://SzczepanLeon/esphome-components@main
    components: [ wmbus]

wmbus:
  frequency: 868.950
  mosi_pin: GPIO13 
  miso_pin: GPIO5 
  clk_pin:  GPIO2 
  cs_pin:   GPIO14 
  gdo0_pin: GPIO15 
  gdo2_pin: GPIO16
bladecell commented 1 day ago

My problem was deffective CC1101 board, new one works fine

ivoh95 commented 1 day ago

My problem was deffective CC1101 board, new one works fine

I'm suspecting the same issue on my end. I've ordered a new one from a different vendor to confirm. Thanks for following up!

szymon3 commented 1 day ago

Me too, awaiting delivery

EDIT: For me, issue was solved by replacing CC1101 with new one, from different seller.