esphome / issues

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

setRxBufferSize error with QuinLED-ESP32-ABE board on 2022.12.6 #4078

Open mwolter805 opened 1 year ago

mwolter805 commented 1 year ago

The problem

Upgraded from 2022.9.1 to 2022.12.6 and can no longer connect to my QuinLED-ESP32-ABE board via ethernet. Reverting to 2022.9.1 does not resolve the issue.

Edit: Also tried flashing the same code to a new QuinLED-ESP32-ABE with the same results.

Which version of ESPHome has the issue?

2022.12.6

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

2023.1.5

What platform are you using?

ESP32

Board

QuinLED-ESP32-ABE

Component causing the issue

ethernet or part

Example YAML snippet

substitutions:
  name: matts-esp32
  friendly_name: Matts ESP32
  ip_address: 10.10.21.13
  pzem_1: HVAC
  pzem_2: TV_Equip
  pzem_3: Nightstand

esphome:
  name: ${name}
  platform: esp32
  board: wemos_d1_mini32

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO5
  use_address: ${ip_address}

mdns:
  disabled: true

api:
  password: !secret api_password
  reboot_timeout: 0s

ota:
  password: !secret ota_password

logger:
  baud_rate: 0  # Disable UART logging
  level: warn  # normal level for logger
#  level: debug # only use this level when debugging an issue
#  level: VERY_VERBOSE # only use this level if debug is not producing enough info to debug an issue
#  logs:
#    hx711: ERROR

web_server:
  port: 80

uart:

# PZEM UART Bus
  id: ubus
  rx_pin: 15
  tx_pin: 13
  baud_rate: 9600
  stop_bits: 2 # not sure if this should be 1 or 2

modbus:

# PZEM Modbus
  uart_id: ubus
  id: mbus

switch:

# Switch Virtual Restart
  - platform: restart
    name: "${friendly_name} ESP Restart"
    id: restart_switch

# Reset Energy for pzem_1
  - platform: uart
    uart_id: ubus
    id: reset_$pzem_1
    name: "${friendly_name} ${pzem_1} Energy Reset"
    data: [0x02, 0x42, 0x80, 0xE1]
    entity_category: config

# Reset Energy for pzem_2
  - platform: uart
    uart_id: ubus
    id: reset_$pzem_2
    name: "${friendly_name} ${pzem_2} Energy Reset"
    data: [0x03, 0x42, 0x81, 0x71]
    entity_category: config

# Reset Energy for pzem_3
  - platform: uart
    uart_id: ubus
    id: reset_$pzem_3
    name: "${friendly_name} ${pzem_3} Energy Reset"
    data: [0x04, 0x42, 0x83, 0x41]
    entity_category: config

sensor:

# Uptime Sensor
  - platform: uptime
    name: "${friendly_name} ESP Uptime"

# PZEM 1
  - platform: pzemac
    modbus_id: mbus
    address: 2
    energy:
      name: "${friendly_name} ${pzem_1} Energy"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kWh
    power:
      name: "${friendly_name} ${pzem_1} Power"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kW
    # current:
    #   name: "${friendly_name} ${pzem_1} Current"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    # voltage:
    #   name: "${friendly_name} ${pzem_1} Voltage"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # frequency:
    #   name: "${friendly_name} ${pzem_1} Frequency"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # power_factor:
    #   name: "${friendly_name} ${pzem_1} Factor"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    update_interval: 10s

# PZEM 2
  - platform: pzemac
    modbus_id: mbus
    address: 3
    energy:
      name: "${friendly_name} ${pzem_2} Energy"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kWh
    power:
      name: "${friendly_name} ${pzem_2} Power"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kW
    # current:
    #   name: "${friendly_name} ${pzem_2} Current"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    # voltage:
    #   name: "${friendly_name} ${pzem_2} Voltage"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # frequency:
    #   name: "${friendly_name} ${pzem_2} Frequency"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # power_factor:
    #   name: "${friendly_name} ${pzem_2} Factor"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    update_interval: 10s

# PZEM 3
  - platform: pzemac
    modbus_id: mbus
    address: 4
    energy:
      name: "${friendly_name} ${pzem_3} Energy"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kWh
    power:
      name: "${friendly_name} ${pzem_3} Power"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kW
    # current:
    #   name: "${friendly_name} ${pzem_3} Current"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    # voltage:
    #   name: "${friendly_name} ${pzem_3} Voltage"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # frequency:
    #   name: "${friendly_name} ${pzem_3} Frequency"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # power_factor:
    #   name: "${friendly_name} ${pzem_3} Factor"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    update_interval: 10s

Anything in the logs that might be useful for us?

2022.12.6 Flash Logs
Using '/dev/cu.usbserial-83410' as serial port.
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Connecting....

Chip Info:
 - Chip Family: ESP32
 - Chip Model: ESP32-D0WD-V3 (revision 3)
 - Number of Cores: 2
 - Max CPU Frequency: 240MHz
 - Has Bluetooth: YES
 - Has Embedded Flash: NO
 - Has Factory-Calibrated ADC: YES
 - MAC Address: 44:17:93:5C:FA:04
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
 - Flash Size: 4MB
 - Flash Mode: dio
 - Flash Frequency: 40MHz
Erasing flash (this may take a while)...
Chip erase completed successfully in 2.7s
Flash will be erased from 0x00001000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x000a0fff...
Compressed 15872 bytes to 10319...
Writing at 0x00001000... (100 %)Wrote 15872 bytes (10319 compressed) at 0x00001000 in 0.3 seconds (effective 380.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 144...
Writing at 0x00008000... (100 %)Wrote 3072 bytes (144 compressed) at 0x00008000 in 0.0 seconds (effective 1201.2 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 2259.5 kbit/s)...
Hash of data verified.
Compressed 593616 bytes to 363757...
Writing at 0x0009fbf0... (100 %)Wrote 593616 bytes (363757 compressed) at 0x00010000 in 9.4 seconds (effective 506.7 kbit/s)...
Hash of data verified.

Leaving...
Hard Resetting...
Hard resetting via RTS pin...
Done! Flashing is complete!

Showing logs:
[12:22:23][    24][E][HardwareSerial.cpp:525] setRxBufferSize(): RX Buffer can't be resized when Serial is already running.
[12:22:23]

Additional information

No response

mwolter805 commented 1 year ago

Left log viewer open for a longer duration and noticed several of the following entries.

E (30884) esp.emac: emac_esp32_transmit(229): insufficient TX buffer size
mwolter805 commented 1 year ago

Noticed the following entry in the change logs for 2022.12.0

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.

This led to attempting to change the sketch to esp-idf and it appeared to resolve the issues.

Notable Changes:

Below is the full config

# substitutions:
#   name: matts-esp32
#   friendly_name: Matts ESP32
#   ip_address: 10.10.21.13
#   pzem_1: HVAC
#   pzem_2: TV_Equip
#   pzem_3: Nightstand

esphome:
  name: matts-esp32
  # name: ${name}

esp32:
  board: wemos_d1_mini32
  # board: mhetesp32devkit # this is what's listed in Quin's sketch https://quinled.info/quinled-an-penta-diy-esphome-example-configuration/
  framework:
    type: esp-idf

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO5
  use_address: 10.10.21.13
  # use_address: ${ip_address}

mdns:
  disabled: true

api:
  password: !secret api_password
  reboot_timeout: 0s

ota:
  password: !secret ota_password

logger:
  baud_rate: 0  # Disable UART logging
  level: warn  # normal level for logger
#  level: debug # only use this level when debugging an issue
#  level: VERY_VERBOSE # only use this level if debug is not producing enough info to debug an issue
#  logs:
#    hx711: ERROR

## web_server is not compatible with esp-idf as of v2022.12.7
# web_server:
#   port: 80

uart:

# PZEM UART Bus
  id: ubus
  rx_pin: 15
  tx_pin: 13
  baud_rate: 9600
  stop_bits: 2 # not sure if this should be 1 or 2

modbus:

# PZEM Modbus
  uart_id: ubus
  id: mbus

switch:

# Switch Virtual Restart
  - platform: restart
    name: "Matts ESP32 ESP Restart"
    # name: "${friendly_name} ESP Restart"
    id: restart_switch

# Reset Energy for pzem_1
  - platform: uart
    uart_id: ubus
    id: reset_HVAC
    # id: reset_$pzem_1
    name: "Matts ESP32 HVAC Energy Reset"
    # name: "${friendly_name} ${pzem_1} Energy Reset"
    data: [0x02, 0x42, 0x80, 0xE1]
    entity_category: config

# Reset Energy for pzem_2
  - platform: uart
    uart_id: ubus
    id: reset_TV_Equip
    # id: reset_$pzem_2
    name: "Matts ESP32 TV_Equip Energy Reset"
    # name: "${friendly_name} ${pzem_2} Energy Reset"
    data: [0x03, 0x42, 0x81, 0x71]
    entity_category: config

# Reset Energy for pzem_3
  - platform: uart
    uart_id: ubus
    id: reset_Nightstand
    # id: reset_$pzem_3
    name: "Matts ESP32 Nightstand Energy Reset"
    # name: "${friendly_name} ${pzem_3} Energy Reset"
    data: [0x04, 0x42, 0x83, 0x41]
    entity_category: config

sensor:

# Uptime Sensor
  - platform: uptime
    name: "Matts ESP32 ESP Uptime"
    # name: "${friendly_name} ESP Uptime"

# PZEM 1
  - platform: pzemac
    modbus_id: mbus
    address: 2
    energy:
      name: "Matts ESP32 HVAC Energy"
      # name: "${friendly_name} ${pzem_1} Energy"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kWh
    power:
      name: "Matts ESP32 HVAC Power"
      # name: "${friendly_name} ${pzem_1} Power"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kW
    # current:
    #   name: "${friendly_name} ${pzem_1} Current"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    # voltage:
    #   name: "${friendly_name} ${pzem_1} Voltage"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # frequency:
    #   name: "${friendly_name} ${pzem_1} Frequency"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # power_factor:
    #   name: "${friendly_name} ${pzem_1} Factor"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    update_interval: 10s

# PZEM 2
  - platform: pzemac
    modbus_id: mbus
    address: 3
    energy:
      name: "Matts ESP32 TV_Equip Energy"
      # name: "${friendly_name} ${pzem_2} Energy"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kWh
    power:
      name: "Matts ESP32 TV_Equip Power"
      # name: "${friendly_name} ${pzem_2} Power"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kW
    # current:
    #   name: "${friendly_name} ${pzem_2} Current"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    # voltage:
    #   name: "${friendly_name} ${pzem_2} Voltage"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # frequency:
    #   name: "${friendly_name} ${pzem_2} Frequency"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # power_factor:
    #   name: "${friendly_name} ${pzem_2} Factor"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    update_interval: 10s

# PZEM 3
  - platform: pzemac
    modbus_id: mbus
    address: 4
    energy:
      name: "Matts ESP32 Nightstand Energy"
      # name: "${friendly_name} ${pzem_3} Energy"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kWh
    power:
      name: "Matts ESP32 Nightstand Power"
      # name: "${friendly_name} ${pzem_3} Power"
      filters:
        - multiply: 0.001
        - or:
          - throttle: 1min
          - delta: .01
      accuracy_decimals: 3
      unit_of_measurement: kW
    # current:
    #   name: "${friendly_name} ${pzem_3} Current"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    # voltage:
    #   name: "${friendly_name} ${pzem_3} Voltage"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # frequency:
    #   name: "${friendly_name} ${pzem_3} Frequency"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .1
    # power_factor:
    #   name: "${friendly_name} ${pzem_3} Factor"
    #   filters:
    #     - or:
    #       - throttle: 1min
    #       - delta: .01
    update_interval: 10s
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.