esphome / issues

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

Broken UART on ESP32 GPIO4/5 #4166

Open ficueu opened 1 year ago

ficueu commented 1 year ago

The problem

I'm using for about year Zigbee to LAN board based on ESP32 with external component from Oxan. Now i'm tryin to update device but uart stops working. I checked few scenarios: 1: ESP32, ethernet, uart (GPIO4/5), latest esphome - stream server not working. 2: ESP32, WiFi, uart (GPIO4/5), latest esphome - stream server working. 3: ESP32, ethernet, uart (GPIO34/15), latest esphome - stream server working. After that, i'm near 100% sure that is correlated with GPIO4/5 and ethernet. Version compiled about year ago working great in scenario 1 but i don't know what exactly version it was.

Which version of ESPHome has the issue?

2022.12.8

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.12.8

What platform are you using?

ESP32

Board

ESP32-s (external ipx connector)

Component causing the issue

uart, ethernet

Example YAML snippet

esphome:
  name: esp-lan

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:

ota:
  password: deleted

status_led:
  pin:
    number: 2
    inverted: true

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 1

time:
  - platform: homeassistant
    id: homeassistant_time

external_components:
  - source: github://oxan/esphome-stream-server

stream_server:
  uart_id: uart_bus
  port: 1234

uart:
  - id: uart_bus
    rx_pin: GPIO4
    tx_pin: GPIO5
    baud_rate: 115200

Anything in the logs that might be useful for us?

Stream server says that new client is connected, some data is sending to uart but device connected to the uart is not responding (while set uart do debug).

Additional information

No response

ficueu commented 1 year ago

Hi, small update. I tested few more configs to check what's happens when i add more uarts to fill all hardware uarts on ESP32 and next one should be software and: ESP32, ethernet, UART0 (logger and USB), UART1 (GPIO13/14), UART2 (GPIO15/16), UART3 - probably (GPIO4/5) software, latest esphome (2023.2.1) - stream server not working; ESP32, WiFi, UART0 (logger and USB), UART1 (GPIO13/14), UART2 (GPIO15/16), UART3 (GPIO4/5) - probably software, latest esphome (2023.2.1) - stream server not working. Is possible that defined uarts while ethernet component is enabled are software uarts? But why stream server is working correctly on (GPIO34/15)? I don't know.

So there is code while stream server is not working, i will post issue on Oxan's component:

external_components:
  - source: github://oxan/esphome-stream-server

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

logger:
  level: very_verbose

stream_server:
  uart_id: uart_bus3
  port: 1234

uart:
  - id: uart_bus1
    rx_pin: GPIO13
    tx_pin: GPIO14
    baud_rate: 115200
  - id: uart_bus2
    rx_pin: GPIO15
    tx_pin: GPIO16
    baud_rate: 115200
  - id: uart_bus3
    rx_pin: GPIO4
    tx_pin: GPIO5
    baud_rate: 115200
ssieb commented 1 year ago

There is no support in esphome for software uarts on ESP32.

ficueu commented 1 year ago

Ok, that's wrong way. Is anything else to test or use an advanced debug options?

ssieb commented 1 year ago

I'm guessing that the ethernet is somehow connected to at least one of the pins. I have no idea why it would have been working before, though. Have you looked up schematics or information on the board you're using?

ficueu commented 1 year ago

I use custom made PCB with zigbee module onboard. I found old binary and on it stream is working great, but on newer compilation stream server is dead.

[23:44:59][I][app:102]: ESPHome version 2022.1.4 compiled on Feb 12 2022, 18:48:27
[23:44:59][C][status_led:019]: Status LED:
[23:44:59][C][status_led:020]:   Pin: GPIO2
[23:44:59][C][logger:233]: Logger:
[23:44:59][C][logger:234]:   Level: DEBUG
[23:44:59][C][logger:235]:   Log Baud Rate: 115200
[23:44:59][C][logger:236]:   Hardware UART: UART0
[23:44:59][C][uart.arduino_esp32:105]: UART Bus:
[23:44:59][C][uart.arduino_esp32:106]:   TX Pin: GPIO5
[23:44:59][C][uart.arduino_esp32:107]:   RX Pin: GPIO4
[23:44:59][C][uart.arduino_esp32:109]:   RX Buffer Size: 256
[23:44:59][C][uart.arduino_esp32:111]:   Baud Rate: 115200 baud
[23:44:59][C][uart.arduino_esp32:112]:   Data Bits: 8
[23:44:59][C][uart.arduino_esp32:113]:   Parity: NONE
[23:44:59][C][uart.arduino_esp32:114]:   Stop bits: 1
[23:44:59][C][switch.gpio:048]: GPIO Switch 'zRST_gpio'
[23:44:59][C][switch.gpio:048]:   Inverted: YES
[23:44:59][C][switch.gpio:049]:   Pin: GPIO32
[23:44:59][C][switch.gpio:071]:   Restore Mode: Always OFF
[23:44:59][C][template.switch:058]: Template Switch 'Zigbee RST'
[23:44:59][C][template.switch:058]:   Icon: 'mdi:toggle-switch'
[23:44:59][C][template.switch:059]:   Restore State: NO
[23:44:59][C][template.switch:060]:   Optimistic: NO
[23:45:00][C][switch.gpio:048]: GPIO Switch 'Zigbee BSL'
[23:45:00][C][switch.gpio:048]:   Icon: 'mdi:toggle-switch'
[23:45:00][C][switch.gpio:048]:   Inverted: YES
[23:45:00][C][switch.gpio:049]:   Pin: GPIO33
[23:45:00][C][switch.gpio:071]:   Restore Mode: Always OFF
[23:45:00][C][template.switch:058]: Template Switch 'Firmware Update'
[23:45:00][C][template.switch:058]:   Icon: 'mdi:cellphone-arrow-down'
[23:45:00][C][template.switch:059]:   Restore State: NO
[23:45:00][C][template.switch:060]:   Optimistic: NO
[23:45:00][C][restart:022]: Restart Switch 'Gateway Restart'
[23:45:00][C][restart:022]:   Icon: 'mdi:restart'
[23:45:00][C][remote_transmitter:015]: Remote Transmitter...
[23:45:00][C][remote_transmitter:016]:   Channel: 0
[23:45:00][C][remote_transmitter:017]:   RMT memory blocks: 1
[23:45:00][C][remote_transmitter:018]:   Clock divider: 80
[23:45:00][C][remote_transmitter:019]:   Pin: GPIO16
[23:45:00][C][remote_transmitter:022]:     Carrier Duty: 50%
[23:45:00][C][xiaomi_lywsdcgq:012]: Xiaomi LYWSDCGQ
[23:45:00][C][xiaomi_lywsdcgq:013]:   Temperature 'Salon Temperature'
[23:45:00][C][xiaomi_lywsdcgq:013]:     Device Class: 'temperature'
[23:45:00][C][xiaomi_lywsdcgq:013]:     State Class: 'measurement'
[23:45:00][C][xiaomi_lywsdcgq:013]:     Unit of Measurement: '°C'
[23:45:00][C][xiaomi_lywsdcgq:013]:     Accuracy Decimals: 1
[23:45:00][C][xiaomi_lywsdcgq:014]:   Humidity 'Salon Humidity'
[23:45:00][C][xiaomi_lywsdcgq:014]:     Device Class: 'humidity'
[23:45:00][C][xiaomi_lywsdcgq:014]:     State Class: 'measurement'
[23:45:00][C][xiaomi_lywsdcgq:014]:     Unit of Measurement: '%'
[23:45:00][C][xiaomi_lywsdcgq:014]:     Accuracy Decimals: 1
[23:45:00][C][xiaomi_lywsdcgq:015]:   Battery Level 'Salon Battery Level'
[23:45:00][C][xiaomi_lywsdcgq:015]:     Device Class: 'battery'
[23:45:00][C][xiaomi_lywsdcgq:015]:     State Class: 'measurement'
[23:45:00][C][xiaomi_lywsdcgq:015]:     Unit of Measurement: '%'
[23:45:00][C][xiaomi_lywsdcgq:015]:     Accuracy Decimals: 0
[23:45:00][C][xiaomi_lywsdcgq:012]: Xiaomi LYWSDCGQ
[23:45:00][C][xiaomi_lywsdcgq:013]:   Temperature 'Kuchnia Temperature'
[23:45:00][C][xiaomi_lywsdcgq:013]:     Device Class: 'temperature'
[23:45:00][C][xiaomi_lywsdcgq:013]:     State Class: 'measurement'
[23:45:00][C][xiaomi_lywsdcgq:013]:     Unit of Measurement: '°C'
[23:45:00][C][xiaomi_lywsdcgq:013]:     Accuracy Decimals: 1
[23:45:00][C][xiaomi_lywsdcgq:014]:   Humidity 'Kuchnia Humidity'
[23:45:00][C][xiaomi_lywsdcgq:014]:     Device Class: 'humidity'
[23:45:00][C][xiaomi_lywsdcgq:014]:     State Class: 'measurement'
[23:45:00][C][xiaomi_lywsdcgq:014]:     Unit of Measurement: '%'
[23:45:00][C][xiaomi_lywsdcgq:014]:     Accuracy Decimals: 1
[23:45:00][C][xiaomi_lywsdcgq:015]:   Battery Level 'Kuchnia Battery Level'
[23:45:00][C][xiaomi_lywsdcgq:015]:     Device Class: 'battery'
[23:45:00][C][xiaomi_lywsdcgq:015]:     State Class: 'measurement'
[23:45:00][C][xiaomi_lywsdcgq:015]:     Unit of Measurement: '%'
[23:45:00][C][xiaomi_lywsdcgq:015]:     Accuracy Decimals: 0
[23:45:00][C][esp32_ble_tracker:706]: BLE Tracker:
[23:45:00][C][esp32_ble_tracker:707]:   Scan Duration: 300 s
[23:45:00][C][esp32_ble_tracker:708]:   Scan Interval: 320.0 ms
[23:45:00][C][esp32_ble_tracker:709]:   Scan Window: 30.0 ms
[23:45:00][C][esp32_ble_tracker:710]:   Scan Type: ACTIVE
[23:45:00][C][ethernet:119]: Ethernet:
[23:45:00][C][ethernet:230]:   IP Address: 192.168.0.181
[23:45:00][C][ethernet:231]:   Hostname: 'zigbee-ble-bridge'
[23:45:00][C][ethernet:232]:   Subnet: 255.255.255.0
[23:45:00][C][ethernet:233]:   Gateway: 192.168.0.1
[23:45:00][C][ethernet:244]:   DNS1: 192.168.0.1
[23:45:00][C][ethernet:245]:   DNS2: 0.0.0.0
[23:45:00][C][ethernet:248]:   MAC Address: 24:0A:C4:BB:02:1B
[23:45:00][C][ethernet:249]:   Is Full Duplex: YES
[23:45:00][C][ethernet:250]:   Link Up: YES
[23:45:00][C][ethernet:251]:   Link Speed: 100
[23:45:00][C][ethernet:122]:   MDC Pin: 23
[23:45:00][C][ethernet:123]:   MDIO Pin: 18
[23:45:00][C][ethernet:124]:   Type: LAN8720
[23:45:00][C][mdns:084]: mDNS:
[23:45:00][C][mdns:085]:   Hostname: zigbee-ble-bridge
[23:45:00][C][ota:082]: Over-The-Air Updates:
[23:45:00][C][ota:083]:   Address: zigbee-ble-bridge.local:3232
[23:45:00][C][ota:086]:   Using Password.
[23:45:00][C][api:134]: API Server:
[23:45:00][C][api:135]:   Address: zigbee-ble-bridge.local:6053
[23:45:00][C][api:139]:   Using noise encryption: NO
[23:45:00][C][streamserver:089]: Stream Server:
[23:45:00][C][streamserver:096]:   Address: 192.168.0.181:1234
[23:49:14][I][app:102]: ESPHome version 2023.2.1 compiled on Feb 16 2023, 23:48:05
[23:49:14][C][status_led:019]: Status LED:
[23:49:14][C][status_led:020]:   Pin: GPIO2
[23:49:14][C][logger:293]: Logger:
[23:49:14][C][logger:294]:   Level: DEBUG
[23:49:14][C][logger:295]:   Log Baud Rate: 115200
[23:49:14][C][logger:296]:   Hardware UART: UART0
[23:49:14][C][uart.arduino_esp32:108]: UART Bus 1:
[23:49:14][C][uart.arduino_esp32:109]:   TX Pin: GPIO5
[23:49:14][C][uart.arduino_esp32:110]:   RX Pin: GPIO4
[23:49:14][C][uart.arduino_esp32:112]:   RX Buffer Size: 256
[23:49:14][C][uart.arduino_esp32:114]:   Baud Rate: 115200 baud
[23:49:14][C][uart.arduino_esp32:115]:   Data Bits: 8
[23:49:14][C][uart.arduino_esp32:116]:   Parity: NONE
[23:49:14][C][uart.arduino_esp32:117]:   Stop bits: 1
[23:49:14][C][switch.gpio:076]: GPIO Switch 'zRST_gpio'
[23:49:14][C][switch.gpio:084]:   Inverted: YES
[23:49:14][C][switch.gpio:099]:   Restore Mode: always OFF
[23:49:14][C][switch.gpio:031]:   Pin: GPIO32
[23:49:14][C][template.switch:076]: Template Switch 'Zigbee RST'
[23:49:14][C][template.switch:078]:   Icon: 'mdi:toggle-switch'
[23:49:14][C][template.switch:099]:   Restore Mode: restore defaults to OFF
[23:49:14][C][template.switch:060]:   Restore State: NO
[23:49:14][C][template.switch:061]:   Optimistic: NO
[23:49:14][C][switch.gpio:076]: GPIO Switch 'Zigbee BSL'
[23:49:14][C][switch.gpio:078]:   Icon: 'mdi:toggle-switch'
[23:49:14][C][switch.gpio:084]:   Inverted: YES
[23:49:14][C][switch.gpio:099]:   Restore Mode: always OFF
[23:49:14][C][switch.gpio:031]:   Pin: GPIO33
[23:49:14][C][template.switch:076]: Template Switch 'Firmware Update'
[23:49:14][C][template.switch:078]:   Icon: 'mdi:cellphone-arrow-down'
[23:49:14][C][template.switch:099]:   Restore Mode: restore defaults to OFF
[23:49:14][C][template.switch:060]:   Restore State: NO
[23:49:14][C][template.switch:061]:   Optimistic: NO
[23:49:14][C][restart:076]: Restart Switch 'Gateway Restart'
[23:49:14][C][restart:078]:   Icon: 'mdi:restart'
[23:49:14][C][restart:099]:   Restore Mode: restore defaults to OFF
[23:49:14][C][remote_transmitter:015]: Remote Transmitter...
[23:49:14][C][remote_transmitter:016]:   Channel: 0
[23:49:14][C][remote_transmitter:017]:   RMT memory blocks: 1
[23:49:14][C][remote_transmitter:018]:   Clock divider: 80
[23:49:14][C][remote_transmitter:019]:   Pin: GPIO16
[23:49:14][C][remote_transmitter:022]:     Carrier Duty: 50%
[23:49:14][C][xiaomi_lywsdcgq:012]: Xiaomi LYWSDCGQ
[23:49:14][C][xiaomi_lywsdcgq:013]:   Temperature 'Salon Temperature'
[23:49:14][C][xiaomi_lywsdcgq:013]:     Device Class: 'temperature'
[23:49:14][C][xiaomi_lywsdcgq:013]:     State Class: 'measurement'
[23:49:14][C][xiaomi_lywsdcgq:013]:     Unit of Measurement: '°C'
[23:49:14][C][xiaomi_lywsdcgq:013]:     Accuracy Decimals: 1
[23:49:14][C][xiaomi_lywsdcgq:014]:   Humidity 'Salon Humidity'
[23:49:14][C][xiaomi_lywsdcgq:014]:     Device Class: 'humidity'
[23:49:14][C][xiaomi_lywsdcgq:014]:     State Class: 'measurement'
[23:49:14][C][xiaomi_lywsdcgq:014]:     Unit of Measurement: '%'
[23:49:14][C][xiaomi_lywsdcgq:014]:     Accuracy Decimals: 1
[23:49:14][C][xiaomi_lywsdcgq:015]:   Battery Level 'Salon Battery Level'
[23:49:14][C][xiaomi_lywsdcgq:015]:     Device Class: 'battery'
[23:49:14][C][xiaomi_lywsdcgq:015]:     State Class: 'measurement'
[23:49:14][C][xiaomi_lywsdcgq:015]:     Unit of Measurement: '%'
[23:49:14][C][xiaomi_lywsdcgq:015]:     Accuracy Decimals: 0
[23:49:14][C][xiaomi_lywsdcgq:012]: Xiaomi LYWSDCGQ
[23:49:14][C][xiaomi_lywsdcgq:013]:   Temperature 'Kuchnia Temperature'
[23:49:14][C][xiaomi_lywsdcgq:013]:     Device Class: 'temperature'
[23:49:14][C][xiaomi_lywsdcgq:013]:     State Class: 'measurement'
[23:49:14][C][xiaomi_lywsdcgq:013]:     Unit of Measurement: '°C'
[23:49:14][C][xiaomi_lywsdcgq:013]:     Accuracy Decimals: 1
[23:49:14][C][xiaomi_lywsdcgq:014]:   Humidity 'Kuchnia Humidity'
[23:49:14][C][xiaomi_lywsdcgq:014]:     Device Class: 'humidity'
[23:49:14][C][xiaomi_lywsdcgq:014]:     State Class: 'measurement'
[23:49:14][C][xiaomi_lywsdcgq:014]:     Unit of Measurement: '%'
[23:49:14][C][xiaomi_lywsdcgq:014]:     Accuracy Decimals: 1
[23:49:14][C][xiaomi_lywsdcgq:015]:   Battery Level 'Kuchnia Battery Level'
[23:49:14][C][xiaomi_lywsdcgq:015]:     Device Class: 'battery'
[23:49:14][C][xiaomi_lywsdcgq:015]:     State Class: 'measurement'
[23:49:14][C][xiaomi_lywsdcgq:015]:     Unit of Measurement: '%'
[23:49:14][C][xiaomi_lywsdcgq:015]:     Accuracy Decimals: 0
[23:49:14][C][esp32_ble:214]: ESP32 BLE:
[23:49:14][C][esp32_ble_tracker:583]: BLE Tracker:
[23:49:14][C][esp32_ble_tracker:584]:   Scan Duration: 300 s
[23:49:14][C][esp32_ble_tracker:585]:   Scan Interval: 320.0 ms
[23:49:14][C][esp32_ble_tracker:586]:   Scan Window: 30.0 ms
[23:49:14][C][esp32_ble_tracker:587]:   Scan Type: ACTIVE
[23:49:14][C][esp32_ble_tracker:588]:   Continuous Scanning: True
[23:49:14][C][ethernet:167]: Ethernet:
[23:49:14][C][ethernet:285]:   IP Address: 192.168.0.181
[23:49:14][C][ethernet:286]:   Hostname: 'zigbee-ble-bridge'
[23:49:14][C][ethernet:287]:   Subnet: 255.255.255.0
[23:49:14][C][ethernet:288]:   Gateway: 192.168.0.1
[23:49:14][C][ethernet:293]:   DNS1: 192.168.0.1
[23:49:14][C][ethernet:294]:   DNS2: 0.0.0.0
[23:49:15][C][ethernet:301]:   MAC Address: 24:0A:C4:BB:02:1B
[23:49:15][C][ethernet:306]:   Is Full Duplex: YES
[23:49:15][C][ethernet:311]:   Link Speed: 100
[23:49:15][C][ethernet:172]:   MDC Pin: 23
[23:49:15][C][ethernet:173]:   MDIO Pin: 18
[23:49:15][C][ethernet:174]:   Type: LAN8720
[23:49:15][C][mdns:108]: mDNS:
[23:49:15][C][mdns:109]:   Hostname: zigbee-ble-bridge
[23:49:15][C][ota:093]: Over-The-Air Updates:
[23:49:15][C][ota:094]:   Address: zigbee-ble-bridge.local:3232
[23:49:15][C][ota:097]:   Using Password.
[23:49:15][C][api:138]: API Server:
[23:49:15][C][api:139]:   Address: zigbee-ble-bridge.local:6053
[23:49:15][C][api:143]:   Using noise encryption: NO
[23:49:15][C][stream_server:054]: Stream Server:
[23:49:15][C][stream_server:055]:   Address: zigbee-ble-bridge.local:1234

I'm always using IP to connect with the board, and every time i see notification that client is connected to stream server, while uart debugging is enable i see that bytes are sent to device on uart bus, but the device is not responding.

ssieb commented 1 year ago

How did you wire the ethernet? And can you get serial logs instead? All that you have there is the config dump.

ficueu commented 1 year ago

I can't do serial logs for the older release because i have only compiled binary without serial debug enaled. I can make logs on wifi and ethernet on latest release. There is wiring of the ethernet https://obrazki.elektroda.pl/2634825100_1676591157.png Pinout is updated in 1st post (i put one of test configuration with wifi instead of ethernet.. my bad).

ssieb commented 1 year ago

Can you get serial logs of the current version? There shouldn't be any changes in the uart handling, so it must be an interaction with something else.

ficueu commented 1 year ago

Scenario: Zigbee2Mqtt trying to connect with CC2652p via stream server.

Test 1 (device 1, ethernet, GPIO4/5): yaml:

esphome:
  name: esp-lan-test-ss
  friendly_name: esp-lan-test-ss

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:

ota:

status_led:
  pin:
    number: 2
    inverted: true

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 1

time:
  - platform: homeassistant
    id: homeassistant_time

external_components:
  - source: github://oxan/esphome-stream-server

stream_server:
  uart_id: uart_bus
  port: 1234

uart:
  - id: uart_bus
    rx_pin: GPIO4
    tx_pin: GPIO5
    baud_rate: 115200
    debug:

log:

INFO Successfully connected to esp-lan-test-ss.local
[22:16:25][I][app:102]: ESPHome version 2023.2.1 compiled on Feb 17 2023, 22:16:04
[22:16:25][C][status_led:019]: Status LED:
[22:16:25][C][status_led:020]:   Pin: GPIO2
[22:16:25][C][logger:293]: Logger:
[22:16:25][C][logger:294]:   Level: DEBUG
[22:16:25][C][logger:295]:   Log Baud Rate: 115200
[22:16:25][C][logger:296]:   Hardware UART: UART0
[22:16:25][C][uart.arduino_esp32:108]: UART Bus 1:
[22:16:25][C][uart.arduino_esp32:109]:   TX Pin: GPIO5
[22:16:25][C][uart.arduino_esp32:110]:   RX Pin: GPIO4
[22:16:25][C][uart.arduino_esp32:112]:   RX Buffer Size: 256
[22:16:25][C][uart.arduino_esp32:114]:   Baud Rate: 115200 baud
[22:16:25][C][uart.arduino_esp32:115]:   Data Bits: 8
[22:16:25][C][uart.arduino_esp32:116]:   Parity: NONE
[22:16:25][C][uart.arduino_esp32:117]:   Stop bits: 1
[22:16:25][C][homeassistant.time:010]: Home Assistant Time:
[22:16:25][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[22:16:25][C][ethernet:167]: Ethernet:
[22:16:25][C][ethernet:285]:   IP Address: 192.168.0.181
[22:16:25][C][ethernet:286]:   Hostname: 'esp-lan-test-ss'
[22:16:25][C][ethernet:287]:   Subnet: 255.255.255.0
[22:16:25][C][ethernet:288]:   Gateway: 192.168.0.1
[22:16:25][C][ethernet:293]:   DNS1: 192.168.0.1
[22:16:25][C][ethernet:294]:   DNS2: 0.0.0.0
[22:16:25][C][ethernet:301]:   MAC Address: 24:0A:C4:BB:02:1B
[22:16:25][C][ethernet:306]:   Is Full Duplex: YES
[22:16:25][C][ethernet:311]:   Link Speed: 100
[22:16:25][C][ethernet:172]:   MDC Pin: 23
[22:16:25][C][ethernet:173]:   MDIO Pin: 18
[22:16:25][C][ethernet:174]:   Type: LAN8720
[22:16:25][C][mdns:108]: mDNS:
[22:16:25][C][mdns:109]:   Hostname: esp-lan-test-ss
[22:16:25][C][ota:093]: Over-The-Air Updates:
[22:16:25][C][ota:094]:   Address: esp-lan-test-ss.local:3232
[22:16:25][C][api:138]: API Server:
[22:16:25][C][api:139]:   Address: esp-lan-test-ss.local:6053
[22:16:25][C][api:143]:   Using noise encryption: NO
[22:16:25][C][stream_server:054]: Stream Server:
[22:16:25][C][stream_server:055]:   Address: esp-lan-test-ss.local:1234
[22:17:48][D][stream_server:090]: New client connected from ::FFFF:192.168.0.10
[22:17:48][D][uart_debug:114]: >>> EF
[22:17:49][D][uart_debug:114]: >>> FE:00:21:01:20
[22:17:55][D][uart_debug:114]: >>> FE:00:21:01:20
[22:18:01][D][uart_debug:114]: >>> FE:00:21:01:20
[22:18:07][D][stream_server:158]: Client ::FFFF:192.168.0.10 disconnected
[22:18:10][D][stream_server:090]: New client connected from ::FFFF:192.168.0.10
[22:18:10][D][uart_debug:114]: >>> EF
[22:18:11][D][uart_debug:114]: >>> FE:00:21:01:20
[22:18:17][D][uart_debug:114]: >>> FE:00:21:01:20
[22:18:23][D][uart_debug:114]: >>> FE:00:21:01:20
[22:18:29][D][stream_server:158]: Client ::FFFF:192.168.0.10 disconnected

Test 2 (device 1, WiFi, GPIO4/5): yaml:

esphome:
  name: esp-lan-test-ss
  friendly_name: esp-lan-test-ss

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:

ota:

status_led:
  pin:
    number: 2
    inverted: true

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

time:
  - platform: homeassistant
    id: homeassistant_time

external_components:
  - source: github://oxan/esphome-stream-server

stream_server:
  uart_id: uart_bus
  port: 1234

uart:
  - id: uart_bus
    rx_pin: GPIO4
    tx_pin: GPIO5
    baud_rate: 115200
    debug:

log:

INFO Successfully connected to esp-lan-test-ss.local
[22:24:48][I][app:102]: ESPHome version 2023.2.1 compiled on Feb 17 2023, 22:23:50
[22:24:48][C][status_led:019]: Status LED:
[22:24:48][C][status_led:020]:   Pin: GPIO2
[22:24:48][C][wifi:504]: WiFi:
[22:24:48][C][wifi:362]:   Local MAC: 24:0A:C4:BB:02:18
[22:24:48][C][wifi:363]:   SSID: [redacted]
[22:24:48][C][wifi:364]:   IP Address: 192.168.0.195
[22:24:48][C][wifi:366]:   BSSID: [redacted]
[22:24:48][C][wifi:367]:   Hostname: 'esp-lan-test-ss'
[22:24:48][C][wifi:369]:   Signal strength: -45 dB ▂▄▆█
[22:24:48][C][wifi:373]:   Channel: 2
[22:24:48][C][wifi:374]:   Subnet: 255.255.255.0
[22:24:48][C][wifi:375]:   Gateway: 192.168.0.1
[22:24:48][C][wifi:376]:   DNS1: 192.168.0.1
[22:24:48][C][wifi:377]:   DNS2: 0.0.0.0
[22:24:48][C][logger:293]: Logger:
[22:24:48][C][logger:294]:   Level: DEBUG
[22:24:48][C][logger:295]:   Log Baud Rate: 115200
[22:24:48][C][logger:296]:   Hardware UART: UART0
[22:24:48][C][uart.arduino_esp32:108]: UART Bus 1:
[22:24:48][C][uart.arduino_esp32:109]:   TX Pin: GPIO5
[22:24:48][C][uart.arduino_esp32:110]:   RX Pin: GPIO4
[22:24:48][C][uart.arduino_esp32:112]:   RX Buffer Size: 256
[22:24:48][C][uart.arduino_esp32:114]:   Baud Rate: 115200 baud
[22:24:48][C][uart.arduino_esp32:115]:   Data Bits: 8
[22:24:48][C][uart.arduino_esp32:116]:   Parity: NONE
[22:24:48][C][uart.arduino_esp32:117]:   Stop bits: 1
[22:24:48][C][homeassistant.time:010]: Home Assistant Time:
[22:24:48][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[22:24:49][C][mdns:108]: mDNS:
[22:24:49][C][mdns:109]:   Hostname: esp-lan-test-ss
[22:24:49][C][ota:093]: Over-The-Air Updates:
[22:24:49][C][ota:094]:   Address: esp-lan-test-ss.local:3232
[22:24:49][C][api:138]: API Server:
[22:24:49][C][api:139]:   Address: esp-lan-test-ss.local:6053
[22:24:49][C][api:143]:   Using noise encryption: NO
[22:24:49][C][stream_server:054]: Stream Server:
[22:24:49][C][stream_server:055]:   Address: esp-lan-test-ss.local:1234
[22:25:11][D][stream_server:090]: New client connected from ::FFFF:192.168.0.10
[22:25:11][D][uart_debug:114]: >>> EF
[22:25:12][D][uart_debug:114]: >>> FE:00:21:01:20
[22:25:12][D][uart_debug:114]: <<< FE:02:61:01:59:06:3D
[22:25:12][D][uart_debug:114]: >>> FE:00:21:02:23
[22:25:12][D][uart_debug:114]: <<< FE:0A:61:02:02:01:02:07:01:14:64:34:01:00:2B
[22:25:12][D][uart_debug:114]: >>> FE:00:21:04:25
[22:25:12][D][uart_debug:114]: <<< FE:08:61:04:0E:29:81:22:00:4B:12:00:B0
[22:25:12][D][uart_debug:114]: >>> FE:02:21:13:82:00:B2
[22:25:12][D][uart_debug:114]: <<< FE:02:61:13:18:00:68
[22:25:12][D][uart_debug:114]: >>> FE:04:21:1C:82:00:00:00:BB
[22:25:12][D][uart_debug:114]: <<< FE:1A:61:1C:00:18:00:01:03:05:07:09:0B:0D:0F:02:02:02:06:08:0A:0C:0D:E7:01:00:66:8E:41:00:37
[22:25:12][D][uart_debug:114]: >>> FE:02:21:13:60:00:50
[22:25:12][D][uart_debug:114]: <<< FE:02:61:13:01:00:71
[22:25:12][D][uart_debug:114]: >>> FE:04:21:1C:60:00:00:00:59
[22:25:12][D][uart_debug:114]: <<< FE:03:61:1C:00:01:55:2A
[22:25:12][D][uart_debug:114]: >>> FE:02:21:13:21:00:11
[22:25:12][D][uart_debug:114]: <<< FE:02:61:13:74:00:04
[22:25:12][D][uart_debug:114]: >>> FE:04:21:1C:21:00:00:00:18
[22:25:12][D][uart_debug:114]: <<< FE:76:61:1C:00:74:63:05:02:33:0F:33:00:1E:00:00:00:01:05:01:8F:00:07:00:02:0D:1E:00:00:00:0B:00:00:00:00:00:00:00:00:00:00:00:42:1A:08:00:00:08:00:00:0F:0F:04:00:01:00:00:00:01:00:00:00:00:0E:29:81:22:00:4B:12:00:01:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:0F:05:00:01:64:0A:01:00:00:00:0B:E0:00:00:92
[22:25:12][D][uart_debug:114]: >>> FE:02:21:13:62:00:52
[22:25:12][D][uart_debug:114]: <<< FE:02:61:13:10:00:60
[22:25:12][D][uart_debug:114]: >>> FE:04:21:1C:62:00:00:00:5B
[22:25:13][D][uart_debug:114]: <<< FE:12:61:1C:00:10:01:03:05:07:09:0B:0D:0F:02:02:02:06:08:0A:0C:0D:78
[22:25:13][D][uart_debug:114]: >>> FE:02:21:13:3A:00:0A
[22:25:13][D][uart_debug:114]: <<< FE:02:61:13:11:00:61
[22:25:13][D][uart_debug:114]: >>> FE:04:21:1C:3A:00:00:00:03
and more...

Test 3 (device 2, ethernet - different device, it has extra pin to control power of the ethernet chip, GPIO34/15): yaml:

esphome:
  name: esp-lan-test-ss2
  friendly_name: esp-lan-test-ss2

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:

ota:

status_led:
  pin:
    number: 2
    inverted: true

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 1
  power_pin: GPIO12    

time:
  - platform: homeassistant
    id: homeassistant_time

external_components:
  - source: github://oxan/esphome-stream-server

stream_server:
  uart_id: uart_bus
  port: 1234

uart:
  - id: uart_bus
    rx_pin: GPIO34
    tx_pin: GPIO15
    baud_rate: 115200
    debug:

log:

INFO Successfully connected to esp-lan-test-ss2.local
[22:31:50][I][app:102]: ESPHome version 2023.2.1 compiled on Feb 17 2023, 22:29:32
[22:31:50][C][status_led:019]: Status LED:
[22:31:50][C][status_led:020]:   Pin: GPIO2
[22:31:50][C][logger:293]: Logger:
[22:31:50][C][logger:294]:   Level: DEBUG
[22:31:50][C][logger:295]:   Log Baud Rate: 115200
[22:31:50][C][logger:296]:   Hardware UART: UART0
[22:31:50][C][uart.arduino_esp32:108]: UART Bus 1:
[22:31:50][C][uart.arduino_esp32:109]:   TX Pin: GPIO15
[22:31:50][C][uart.arduino_esp32:110]:   RX Pin: GPIO34
[22:31:50][C][uart.arduino_esp32:112]:   RX Buffer Size: 256
[22:31:50][C][uart.arduino_esp32:114]:   Baud Rate: 115200 baud
[22:31:50][C][uart.arduino_esp32:115]:   Data Bits: 8
[22:31:50][C][uart.arduino_esp32:116]:   Parity: NONE
[22:31:50][C][uart.arduino_esp32:117]:   Stop bits: 1
[22:31:50][C][homeassistant.time:010]: Home Assistant Time:
[22:31:50][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[22:31:50][C][ethernet:167]: Ethernet:
[22:31:50][C][ethernet:285]:   IP Address: 192.168.0.179
[22:31:50][C][ethernet:286]:   Hostname: 'esp-lan-test-ss2'
[22:31:50][C][ethernet:287]:   Subnet: 255.255.255.0
[22:31:50][C][ethernet:288]:   Gateway: 192.168.0.1
[22:31:50][C][ethernet:293]:   DNS1: 192.168.0.1
[22:31:50][C][ethernet:294]:   DNS2: 0.0.0.0
[22:31:50][C][ethernet:301]:   MAC Address: 4C:EB:D6:7C:34:CF
[22:31:50][C][ethernet:306]:   Is Full Duplex: YES
[22:31:50][C][ethernet:311]:   Link Speed: 100
[22:31:50][C][ethernet:170]:   Power Pin: 12
[22:31:50][C][ethernet:172]:   MDC Pin: 23
[22:31:50][C][ethernet:173]:   MDIO Pin: 18
[22:31:50][C][ethernet:174]:   Type: LAN8720
[22:31:50][C][mdns:108]: mDNS:
[22:31:50][C][mdns:109]:   Hostname: esp-lan-test-ss2
[22:31:50][C][ota:093]: Over-The-Air Updates:
[22:31:50][C][ota:094]:   Address: esp-lan-test-ss2.local:3232
[22:31:50][C][api:138]: API Server:
[22:31:50][C][api:139]:   Address: esp-lan-test-ss2.local:6053
[22:31:50][C][api:143]:   Using noise encryption: NO
[22:31:50][C][stream_server:054]: Stream Server:
[22:31:50][C][stream_server:055]:   Address: esp-lan-test-ss2.local:1234
[22:32:26][D][api:102]: Accepted ::FFFF:192.168.0.10
[22:32:26][D][api.connection:918]: Home Assistant 2023.2.2 (::FFFF:192.168.0.10): Connected successfully
[22:32:26][D][time:045]: Synchronized time: 2023-02-17 22:32:26
[22:32:32][D][stream_server:090]: New client connected from ::FFFF:192.168.0.10
[22:32:32][D][uart_debug:114]: >>> EF
[22:32:33][D][uart_debug:114]: >>> FE:00:21:01:20
[22:32:33][D][uart_debug:114]: <<< FE:02:61:01:59:06:3D
[22:32:33][D][uart_debug:114]: >>> FE:00:21:02:23
[22:32:33][D][uart_debug:114]: <<< FE:0A:61:02:02:01:02:07:01:3B:89:34:01:00:E9
[22:32:33][D][uart_debug:114]: >>> FE:00:21:04:25
[22:32:33][D][uart_debug:114]: <<< FE:08:61:04:0E:29:81:22:00:4B:12:00:B0
[22:32:33][D][uart_debug:114]: >>> FE:02:21:13:82:00:B2
[22:32:33][D][uart_debug:114]: <<< FE:02:61:13:18:00:68
[22:32:33][D][uart_debug:114]: >>> FE:04:21:1C:82:00:00:00:BB
[22:32:33][D][uart_debug:114]: <<< FE:1A:61:1C:00:18:00:01:03:05:07:09:0B:0D:0F:02:02:02:06:08:0A:0C:0D:E5:01:00:A7:A1:3F:00:A5
[22:32:33][D][uart_debug:114]: >>> FE:02:21:13:60:00:50
[22:32:33][D][uart_debug:114]: <<< FE:02:61:13:01:00:71
[22:32:33][D][uart_debug:114]: >>> FE:04:21:1C:60:00:00:00:59
[22:32:34][D][uart_debug:114]: <<< FE:03:61:1C:00:01:55:2A
[22:32:34][D][uart_debug:114]: >>> FE:02:21:13:21:00:11
[22:32:34][D][uart_debug:114]: <<< FE:02:61:13:74:00:04
[22:32:34][D][uart_debug:114]: >>> FE:04:21:1C:21:00:00:00:18
and more..
ficueu commented 1 year ago

I tried to check with oscilloscope if the data was really sent do tx pin (GPIO5) but not, still high level in this pin so it means there is no send data. I changed pin to GPIO13 and i can see data on oscilloscope, chcecked few more pins and always i see data. Probably this issue is only correlated to GPIO5 as tx pin and ethernet component. Last test: GPIO5 driven by switch component - no issues, it works. How can i compile firmware with older esphome version but without deleting current esphome ha addon?

ssieb commented 1 year ago

The TX pin is high when idle.

How can i compile firmware with older esphome version but without deleting current esphome ha addon?

You can use the cli on some other computer.

ficueu commented 1 year ago

The TX pin is high when idle.

I know, so it means there is no data.

Maybe tomorrow i will try to find last release without this issue to locate this bug.

ficueu commented 1 year ago

2022.11.5. - OK 2022.12.0. - didn't work, so i chcecked changelog and found:

Because these core upgrade have aligned the version of ESP-IDF under the hood, ethernet is now able to be used when specifying ESP-IDF as your framework of choice.

But changing framework to ESP-IDF didn't help. I tried flashing firmware.bin via ESPHomeFlasher and firmware-factory.bin via web based uploader.

klickfisch commented 1 year ago

Found out that i got a defective board... maybe the uart controller. With a new board all functions work fine. ~It looks that i have/found the same problem. I'm using a ZigStar POE Gateway clone and got random uart connection losts every 1-15 hours. I even replaced the firmware from the manufacturer with a esphome selfbuild and got the same problems. Last test was to use usb for power and wired ethernet for communication - still the same problems. I have no idea whats wrong here. I found a hint from another Zigbee POE device manufacturer here: Note currently ESPHome Releases 2021.10 and forward do not have reliable serial connections to the zigbee module exhibiting in frequent (every few hours) disconnections. Compile with 2021.9 versions for reliable operation.

https://github.com/tube0013/tube_gateways/tree/main/models/current/tubeszb-cc2652-poe-2022/firmware/esphome/Previous_Version~