esphome / issues

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

esp32-c3 (LILYGO T-01C3 aka esp01 with esp32c3) boot issue after update with UART in config #3924

Open evlo opened 1 year ago

evlo commented 1 year ago

The problem

This is serial log as the device does not become available on wifi image

Log after flashing on x64 system image it does boot and show as connect, but no webserver is up etc. (And yes, webserver is specified in the config)

Which version of ESPHome has the issue?

2022.12.0 and also tried 2023.01.0.dev0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.12.5

What platform are you using?

ESP32

Board

esp01-c3

Component causing the issue

bluetooth_proxy?

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Primary usage for the device is obis reading using

external_components:
  - source: github://evlo/esphome_ZPA-ZE312
    components: [obis]
    refresh: 0s

Additional information

I thought it might be related to bluetooth_proxy since I updated and enabled bt proxy at the same time, but even after removing bluetooth_proxy from config, it still does not boot properly.

Also pre 2022.12 I needed to build using

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: arduino
    version: 2.0.3
    platform_version: 4.4.0

on arm64 (ha yellow) but on x64 it was ok

with 2022.12 it builds with

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: arduino

both on arm64 and x64, but resulting firmware does not boot for the checksum issue in the screenshot

With 2022.12.0 AND

  board: esp32-c3-devkitm-1
  framework:
    type: arduino
    version: 2.0.3
    platform_version: 4.4.0

results is this thing image

This only happens if UART component is in yaml config

RENOxDECEPTION commented 1 year ago

I have this happening on my esp32-s3 as well. Going to have to try disabling UART for the time being.

evlo commented 1 year ago

I have tried deleting .esphome folder before compiling

full config causing the issue with 2022.12.1 to replicate the issue:

# https://github.com/Xinyuan-LilyGO/T-01C3 LILYGO T-01C3

esphome:
  name: eh-elektromer-t01c3
esp32:
  board: esp32-c3-devkitm-1
  variant: esp32c3
  framework: 
    type: arduino
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

api:
logger:
  level: VERBOSE
ota:
web_server:
  version: 2
captive_portal:

uart:
  id: uart_bus
  tx_pin: GPIO21
  rx_pin: GPIO20
  rx_buffer_size: 2048  
  baud_rate: 300
  data_bits: 7
  stop_bits: 1
  parity: EVEN

Log in text form:

INFO Successfully uploaded program.
INFO Starting log output from COM6 with baud rate 115200
[11:21:54][I][logger:258]: Log initialized
[11:21:54][C][ota:469]: There have been 8 suspected unsuccessful boot attempts.
[11:21:54][D][esp32.preferences:113]: Saving 1 preferences to flash...
[11:21:54][V][esp32.preferences:125]: sync: key: 233825507, len: 4
[11:21:54][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[11:21:55][I][app:029]: Running through setup()...
[11:21:55][V][app:030]: Sorting components by setup priority...
[11:21:55][C][uart.arduino_esp32:077]: Setting up UART...
[11:22:01]ESP-ROM:esp32c3-api1-20210207
[11:22:01]Build:Feb  7 2021
[11:22:01]rst:0x7 (TG0WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
[11:22:01]Saved PC:0x420296a6
WARNING Decoded 0x420296a6: uart_ll_get_txfifo_len at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/hal/esp32c3/include/hal/uart_ll.h:329 (discriminator 1)
 (inlined by) panic_print_char at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:79 (discriminator 1)
[11:22:01]SPIWP:0xee
[11:22:01]mode:DIO, clock div:1
[11:22:01]load:0x3fcd6100,len:0x438
[11:22:01]load:0x403ce000,len:0x918
[11:22:01]load:0x403d0000,len:0x24e4
[11:22:01]entry 0x403ce000
[11:22:01][I][logger:258]: Log initialized
[11:22:01][C][ota:469]: There have been 9 suspected unsuccessful boot attempts.
[11:22:01][D][esp32.preferences:113]: Saving 1 preferences to flash...
[11:22:01][V][esp32.preferences:125]: sync: key: 233825507, len: 4
[11:22:01][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[11:22:01][I][app:029]: Running through setup()...
[11:22:01][V][app:030]: Sorting components by setup priority...
[11:22:01][C][uart.arduino_esp32:077]: Setting up UART...

I wonder why ti says esp32s2 in the debug warning message

for me on on most of my esp32-c3 boards uart is main used component.

PS C:\Python311\Scripts> .\esptool.exe flash_id
esptool.py v4.4
Found 3 serial ports
Serial port COM6
Connecting....
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (revision v0.3)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 
Uploading stub...
Running stub...
Stub running...
Manufacturer: 68
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...

can revision v0.3 have something to do with it?

possibly related?

evlo commented 1 year ago

I have found my old post https://github.com/esphome/issues/issues/3419#issuecomment-1250396816 so that means using

  framework:
    type: arduino
    version: 2.0.3
    platform_version: 4.4.0

should work

so I have changed yaml to that versions mentioned above deleted .esphome deleted c:\users*.platformio tried esphome run ... no luck deleted .esphome deleted c:\users*.platformio ./pip3 install esphome==2022.8.0

still results in

[21:15:17][C][uart.arduino_esp32:077]: Setting up UART...
[21:15:23]ESP-ROM:esp32c3-api1-20210207
[21:15:23]Build:Feb  7 2021
[21:15:23]rst:0x7 (TG0WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
[21:15:23]Saved PC:0x4202938a
WARNING Decoded 0x4202938a: uart_ll_get_txfifo_len at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/hal/esp32c3/include/hal/uart_ll.h:329 (discriminator 1)
 (inlined by) panic_print_char at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:79 (discriminator 1)

I have noticed parameter source mentioned here https://esphome.io/components/esp32.html in the arduino framework section, but I'm unsure how exactly to esphome compile https://github.com/platformio/platform-espressif32/ from scratch

maybe this: https://github.com/espressif/arduino-esp32/pull/7496

evlo commented 1 year ago

I compiled on linux vm with latest 2022.12.3, i could not flash in linux with usb passthrough, so i copied the firmware.bin and flashed with .\esptool.exe write_flash 0 .\firmware.bin command and result is this boot loop, no warning about uart, etc. I would have kinda hoped for at least same error independent on the os where are build the yaml, but maybe i did something wrong with flashing? 2022-12-20_23-35-30

maybe qio and dio mode difference?

this is description i found for the modes DIO - SPI host uses the "Dual I/O Fast Read" command (BBh). Two SPI pins are used to write the flash address part of the command, and to read flash data out. Therefore these phases need half the clock cycles compared to standard SPI. QIO - SPI host uses the "Quad I/O Fast Read" command (EBh). Four SPI pins are used to write the flash address part of the command, and to read flash data out. Therefore these phases need a quarter the clock cycles compared to standard SPI. dunno what that means in practice thought

Update: after flashing firmware-factory.bin instead of firmware.bin I do get the same error as on windows built firmware

evlo commented 1 year ago

Today I remembered I have local home assistant PC and flashed on it using esphome dashboard and with esp-idf in yaml bootloop image

This is what I found https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s3/api-guides/flash_psram_config.html#error-handling maybe related, but i do not understand it - eFuse ?

jysaloma commented 1 year ago

I am having the same issue with HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash Which I am using as bluetooth proxy for HA.

Hard resetting via RTS pin... INFO Successfully uploaded program. INFO Starting log output from /dev/cu.usbserial-14110 with baud rate 115200 [16:35:39]0210207 [16:35:39]Build:Feb 7 2021 [16:35:39]rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [16:35:39]Saved PC:0x403d0f88 [16:35:39]SPIWP:0xee [16:35:39]mode:DIO, clock div:1 [16:35:39]load:0x3fcd6100,len:0x420 [16:35:39]load:0x403ce000,len:0x90c [16:35:39]load:0x403d0000,len:0x236c [16:35:39]entry 0x403ce000 [16:35:39]ESP-ROM:esp32c3-api1-20210207 [16:35:39]Build:Feb 7 2021 [16:35:39]rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [16:35:39]Saved PC:0x403d0f88 [16:35:39]SPIWP:0xee [16:35:39]mode:DIO, clock div:1 [16:35:39]load:0x3fcd6100,len:0x420 [16:35:39]load:0x403ce000,len:0x90c [16:35:39]load:0x403d0000,len:0x236c [16:35:39]entry 0x403ce000 [16:35:39]ESP-ROM:esp32c3-api1-20210207 [16:35:39]Build:Feb 7 2021 [16:35:39]rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [16:35:39]Saved PC:0x403d0f88 [16:35:39]SPIWP:0xee [16:35:39]mode:DIO, clock div:1 [16:35:39]load:0x3fcd6100,len:0x420 [16:35:39]load:0x403ce000,len:0x90c [16:35:39]load:0x403d0000,len:0x236c [16:35:39]entry 0x403ce000 [16:35:39]ESP-ROM:esp32c3-api1-20210207 [16:35:39]Build:Feb 7 2021 [16:35:39]rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [16:35:39]Saved PC:0x403d0f88 [16:35:39]SPIWP:0xee [16:35:39]mode:DIO, clock div:1 [16:35:39]load:0x3fcd6100,len:0x420 [16:35:39]load:0x403ce000,len:0x90c [16:35:39]load:0x403d0000,len:0x236c [16:35:39]entry 0x403ce000 [16:35:39]ESP-ROM:esp32c3-api1-20210207

jysaloma commented 1 year ago

In my case I commented the version numbers and it compiled and works fine now

esphome: name: ${name} name_add_mac_suffix: false platformio_options: board_build.mcu: esp32c3

platform_packages:

#  - platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.2

esp32: board: esp32-c3-devkitm-1 variant: esp32c3 framework: type: arduino

version: 2.0.2

#platform_version: https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2idf/platform-espressif32-2.0.2.zip

[17:10:50][I][wifi:518]: WiFi Connected! [17:10:50][I][app:062]: setup() finished successfully! [17:10:50][I][app:102]: ESPHome version 2022.12.3 compiled on Dec 22 2022, 17:08:25

evlo commented 1 year ago

But you do not have uart component in you working config, correct?

jysaloma commented 1 year ago

@evlo sorry I don't. I tested on mine and seems to be the same issue as yours.

[17:28:12][I][logger:258]: Log initialized [17:28:12][I][app:029]: Running through setup()... [17:28:45]ESP-ROM:esp32c3-api1-20210207 [17:28:45]Build:Feb 7 2021 [17:28:45]rst:0x7 (TG0WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [17:28:45]Saved PC:0x4203018e WARNING Decoded 0x4203018e: uart_ll_get_txfifo_len at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/hal/esp32c3/include/hal/uart_ll.h:329 (discriminator 1) (inlined by) panic_print_char at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:79 (discriminator 1) [17:28:45]SPIWP:0xee [17:28:45]mode:DIO, clock div:1 [17:28:45]load:0x3fcd6100,len:0x438 [17:28:45]load:0x403ce000,len:0x918 [17:28:45]load:0x403d0000,len:0x24e4 [17:28:45]entry 0x403ce000 [17:28:45][I][logger:258]: Log initialized [17:28:45][I][app:029]: Running through setup()... [17:29:19]ESP-ROM:esp32c3-api1-20210207 [17:29:19]Build:Feb 7 2021 [17:29:19]rst:0x7 (TG0WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) [17:29:19]Saved PC:0x4203018c WARNING Decoded 0x4203018c: uart_ll_get_txfifo_len at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/hal/esp32c3/include/hal/uart_ll.h:329 (discriminator 1) (inlined by) panic_print_char at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:79 (discriminator 1) [17:29:19]SPIWP:0xee [17:29:19]mode:DIO, clock div:1 [17:29:19]load:0x3fcd6100,len:0x438 [17:29:19]load:0x403ce000,len:0x918 [17:29:19]load:0x403d0000,len:0x24e4 [17:29:19]entry 0x403ce000 [17:29:19][I][logger:258]: Log initialized [17:29:19][I][app:029]: Running through setup()...

evlo commented 1 year ago

I tried on ESP32-CAM (aithinker) board and it goes into starting uart and then resets, no warning decoded etc. messages same on the c3 it now just freezes on starting uart

I did build on fresh windows10 machine, manual esp home installation

for esp32-c3 i also did lot of experimenting on linux machine, but no luck, even with older version that show runner and not ficeto in the warning decoded message

esp-idf framework on windows ends up on PyYAML error during esphome build/preparation

evlo commented 1 year ago

log from esp32-cam

[22:57:27][C][uart.arduino_esp32:077]: Setting up UART...
[22:57:33]ets Jun  8 2016 00:22:57
[22:57:33]
[22:57:33]rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[22:57:33]configsip: 0, SPIWP:0xee
[22:57:33]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[22:57:33]mode:DIO, clock div:2
[22:57:33]load:0x3fff0030,len:1184
[22:57:33]load:0x40078000,len:13132
[22:57:33]load:0x40080400,len:3036
[22:57:33]entry 0x400805e4
[22:57:34][     6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[22:57:34][   455][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
[22:57:34][I][logger:258]: Log initialized
[22:57:34][C][ota:469]: There have been 4 suspected unsuccessful boot attempts.

SAMPLE

esphome:
  name: ehuarttests
esp32:
  board: esp32cam
  framework: 
    type: arduino

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

api:
logger:
  level: VERY_VERBOSE
ota:

uart:
  id: serial
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600

web_server:
  version: 2

result log

PS C:\esphome> esphome logs .\eh-elektromer-cam.yaml --device COM6
INFO Reading configuration .\eh-elektromer-cam.yaml...
INFO Starting log output from COM6 with baud rate 115200
[11:52:28]ets Jun  8 2016 00:22:57
[11:52:28]
[11:52:28]rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
[11:52:28]waiting for download
[11:52:31]ets Jun  8 2016 00:22:57
[11:52:31]
[11:52:31]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[11:52:31]configsip: 0, SPIWP:0xee
[11:52:31]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[11:52:31]mode:DIO, clock div:2
[11:52:31]load:0x3fff0030,len:1184
[11:52:31]load:0x40078000,len:13132
[11:52:31]load:0x40080400,len:3036
[11:52:31]entry 0x400805e4
[11:52:31][     6][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[11:52:31][   454][I][esp32-hal-psram.c:96] psramInit(): PSRAM enabled
[11:52:31][I][logger:258]: Log initialized
[11:52:32][VV][esp32.preferences:070]: nvs_get_blob: key: 233825507, len: 4
[11:52:32][C][ota:469]: There have been 0 suspected unsuccessful boot attempts.
[11:52:32][VV][esp32.preferences:039]: s_pending_save: key: 233825507, len: 4
[11:52:32][D][esp32.preferences:113]: Saving 1 preferences to flash...
[11:52:32][VV][esp32.preferences:122]: Checking if NVS data 233825507 has changed
[11:52:32][V][esp32.preferences:125]: sync: key: 233825507, len: 4
[11:52:32][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[11:52:32][I][app:029]: Running through setup()...
[11:52:32][V][app:030]: Sorting components by setup priority...
[11:52:32][VV][scheduler:057]: set_interval(name='', interval=60000, offset=6026)
[11:52:32][C][uart.arduino_esp32:077]: Setting up UART...

even if i disconnect rx tx wires from usb to com (tried ftdi, ch340, cp2102) adpater it still does not show webserver when there is webserver component

this will start

esphome:
  name: ehuarttests
esp32:
  board: esp32cam
  framework: 
    type: arduino

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

api:
logger:
  level: VERY_VERBOSE
ota:

uart:
  id: serial
  tx_pin: 0
  rx_pin: 16
  baud_rate: 9600

but i did not verified uart to be working on those pins yet

i did not tried to disable logger on the esp32-cam only on the t01c3 and there it did not help I do not know of other way to get the log out of the device if there is no wifi

evlo commented 1 year ago

I tried on c3 with

logger:
  level: VERY_VERBOSE
  logs:
    uart: VERY_VERBOSE
    web_server: INFO
    wifi: INFO
    app: INFO
    ota: INFO
    wifi_esp32: INFO
    scheduler: INFO
  baud_rate: 0

no luck, it does show on router evantually, i guess in the safemode, but

esphome logs .\eh-elektromer-cam.yaml --device 192.168.50.154

is stuck on

INFO Trying to reconnect to 192.168.50.154 in the background
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.