esphome / issues

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

MPR121 not working in 2024.6.0b #5913

Closed SmarterHomeLife closed 3 months ago

SmarterHomeLife commented 3 months ago

The problem

The MPR121 causes a panic and boot loop ending in safe mode being activated when the chip is connected.

Which version of ESPHome has the issue?

2024.6.0b2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.6.3

What platform are you using?

ESP8266

Board

D1 Mini

Component causing the issue

mpr121

Example YAML snippet

substitutions:
  devicename: homeiq-d1-remote-5d2a6a
  name: HomeIQ D1 Remote
  static_ip: 10.0.4.16

esphome:
  name: $devicename
  platform: ESP8266
  board: d1_mini
  name_add_mac_suffix: no

wifi:
  ssid: !secret ssid
  password: !secret psk
  fast_connect: on
  manual_ip:
    static_ip: $static_ip
    gateway: 10.0.4.1
    subnet: 255.255.255.0
#  use_address: devicename.local
  ap:
    ssid: $name WiFi
    password: !secret hotspot-psk

captive_portal:

web_server:
  port: 80
  version: 3

logger:

api:
  encryption:
    key: !secret esphome-key
  reboot_timeout: 0s

ota:
  platform: esphome
  password: !secret api-pwd

i2c:
  sda: D2
  scl: D1
  scan: true
  id: i2c1

mpr121:
  id: mpr121_component
  address: 0x5A
  touch_debounce: 3
  release_debounce: 3
  touch_threshold: 20
  release_threshold: 10

button:
  - platform: restart
    name: $name Restart

text_sensor:
  - platform: wifi_info
    ip_address:
      name: $name IP Address

binary_sensor:
  - platform: status
    name: $name Status

  - platform: mpr121
    id: button_0
    channel: 0
    name: Button 0
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_1
    channel: 1
    name: Button 1
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_2
    channel: 2
    name: Button 2
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_3
    channel: 3
    name: Button 3
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_4
    channel: 4
    name: Button 4
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_5
    channel: 5
    name: Button 5
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_6
    channel: 6
    name: Button 6
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_7
    channel: 7
    name: Button 7
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_8
    channel: 8
    name: Button 8
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_9
    channel: 9
    name: Button 9
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_10
    channel: 10
    name: Button 10
    filters:
      - delayed_on: 500ms

  - platform: mpr121
    id: button_11
    channel: 11
    name: Button 11
    filters:
      - delayed_on: 500ms

sensor:
  - platform: wifi_signal
    name: $name WiFi Signal
    update_interval: 60s

Anything in the logs that might be useful for us?

INFO ESPHome 2024.6.0b3
INFO Reading configuration /config/esphome/homeiq-d1-remote-5d2a6a.yaml...
INFO Generating C++ source...
/esphome/esphome/components/mpr121/binary_sensor/__init__.py:30: RuntimeWarning: coroutine 'register_parented' was never awaited
  cg.register_parented(var, hub)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
INFO Compiling app...
Processing homeiq-d1-remote-5d2a6a (board: d1_mini; framework: arduino; platform: platformio/espressif8266@4.2.1)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.2
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|-- Wire @ 1.0
|-- ArduinoJson @ 6.18.5
RAM:   [====      ]  43.9% (used 35976 bytes from 81920 bytes)
Flash: [=====     ]  51.3% (used 535333 bytes from 1044464 bytes)
========================= [SUCCESS] Took 15.03 seconds =========================
INFO Successfully compiled program.
esptool.py v4.7.0
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: c4:5b:be:5d:2a:6a
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x00083fff...
Compressed 539488 bytes to 373478...
Wrote 539488 bytes (373478 compressed) at 0x00000000 in 8.9 seconds (effective 484.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB1 with baud rate 115200
[20:22:51]\x8c\x82n\xc7r\x90\xf2n|\xecl\xc4l`bbrl\xe2nb\x82nl`\x8crl\xc4l\xe4\xfe[I][logger:034]: Log initialized
[20:22:51][C][safe_mode:079]: There have been 0 suspected unsuccessful boot attempts
[20:22:51][I][app:029]: Running through setup()...
[20:22:51][I][i2c.arduino:218]: Performing I2C bus recovery
[20:22:51][C][mpr121:014]: Setting up MPR121...
[20:22:51]
[20:22:51]--------------- CUT HERE FOR EXCEPTION DECODER ---------------
[20:22:51]
[20:22:51]Exception (28):
WARNING Exception type: Access to invalid address: LOAD (wild pointer?)
[20:22:51]epc1=0x40216948 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000025 depc=0x00000000
WARNING Decoded 0x40216948: esphome::mpr121::MPR121BinarySensor::setup()
[20:22:51]
[20:22:51]>>>stack>>>
WARNING Found stack trace! Trying to decode it
[20:22:51]
[20:22:51]ctx: cont
[20:22:51]sp: 3ffffdf0 end: 3fffffd0 offset: 0150
[20:22:51]3fffff40:  3fff1c00 00000083 00000064 40232be4  
WARNING Decoded 0x40232be4: delay
[20:22:51]3fffff50:  3ffefec0 3fff1cb4 3fff1cc4 40216c14  
WARNING Decoded 0x40216c14: esphome::mpr121::MPR121Component::setup()
[20:22:51]3fffff60:  3fffff61 3fffff60 00000000 3fff206c  
[20:22:51]3fffff70:  3fff1cb4 00000003 3ffefebc 4021f719  
WARNING Decoded 0x4021f719: esphome::Application::setup()
[20:22:51]3fffff80:  0000001c 0000001c 3fff2884 feefeffe  
[20:22:51]3fffff90:  00000010 00000000 feefeffe feefeffe  
[20:22:51]3fffffa0:  feefeffe feefeffe feefeffe 3fff04b8  
[20:22:51]3fffffb0:  3fffdad0 00000000 3fff048c 40231f0c  
WARNING Decoded 0x40231f0c: loop_wrapper() at core_esp8266_main.cpp
[20:22:51]3fffffc0:  feefeffe feefeffe 3fffdab0 4010048d  
WARNING Decoded 0x4010048d: cont_wrapper
[20:22:51]<<<stack<<<
[20:22:51]
[20:22:51]--------------- CUT HERE FOR EXCEPTION DECODER ---------------
[20:22:51]
[20:22:51] ets Jan  8 2013,rst cause:2, boot mode:(3,6)
[20:22:51]
[20:22:51]load 0x4010f000, len 3424, room 16 
[20:22:51]tail 0
[20:22:51]chksum 0x2e
[20:22:51]load 0x3fff20b8, len 40, room 8 
[20:22:51]tail 0
[20:22:51]chksum 0x2b
[20:22:51]csum 0x2b
[20:22:51]v00083b60
[20:22:51]~ld
[20:22:51]\x8c\x82n\xc7r\x90\xf2n|\xecl\xc4l`bbrl\xe2nb\x82nl`\x8crl\xc4l\xe4\xfe[I][logger:034]: Log initialized
[20:22:51][C][safe_mode:079]: There have been 1 suspected unsuccessful boot attempts
[20:22:51][I][app:029]: Running through setup()...
[20:22:51][I][i2c.arduino:218]: Performing I2C bus recovery
[20:22:51][C][mpr121:014]: Setting up MPR121...
[20:22:51]
[20:22:51]--------------- CUT HERE FOR EXCEPTION DECODER ---------------
[20:22:51]
[20:22:51]Exception (28):
WARNING Exception type: Access to invalid address: LOAD (wild pointer?)
[20:22:51]epc1=0x40216948 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000025 depc=0x00000000
WARNING Decoded 0x40216948: esphome::mpr121::MPR121BinarySensor::setup()
[20:22:51]
[20:22:51]>>>stack>>>
WARNING Found stack trace! Trying to decode it
[20:22:51]
[20:22:51]ctx: cont
[20:22:51]sp: 3ffffdf0 end: 3fffffd0 offset: 0150
[20:22:51]3fffff40:  3fff1c00 00000084 00000064 40232be4  
WARNING Decoded 0x40232be4: delay
[20:22:51]3fffff50:  3ffefec0 3fff1cb4 3fff1cc4 40216c14  
WARNING Decoded 0x40216c14: esphome::mpr121::MPR121Component::setup()
[20:22:51]3fffff60:  3fffff61 3fffff60 00000000 3fff206c  
[20:22:51]3fffff70:  3fff1cb4 00000003 3ffefebc 4021f719  
WARNING Decoded 0x4021f719: esphome::Application::setup()
[20:22:51]3fffff80:  0000001c 0000001c 3fff2884 feefeffe  
[20:22:51]3fffff90:  00000010 00000000 feefeffe feefeffe  
[20:22:51]3fffffa0:  feefeffe feefeffe feefeffe 3fff04b8  
[20:22:51]3fffffb0:  3fffdad0 00000000 3fff048c 40231f0c  
WARNING Decoded 0x40231f0c: loop_wrapper() at core_esp8266_main.cpp
[20:22:52]3fffffc0:  feefeffe feefeffe 3fffdab0 4010048d  
WARNING Decoded 0x4010048d: cont_wrapper
[20:22:52]<<<stack<<<
[20:22:52]
[20:22:52]--------------- CUT HERE FOR EXCEPTION DECODER ---------------
[20:22:52]
[20:22:52] ets Jan  8 2013,rst cause:2, boot mode:(3,6)
[20:22:52]
[20:22:52]load 0x4010f000, len 3424, room 16 
[20:22:52]tail 0
[20:22:52]chksum 0x2e
[20:22:52]load 0x3fff20b8, len 40, room 8 
[20:22:52]tail 0
[20:22:52]chksum 0x2b
[20:22:52]csum 0x2b
[20:22:52]v00083b60
[20:22:52]~ld
[20:22:52]\x8c\x82n\xc7r\x90\xf2n|\xecl\xc4l`bbrl\xe2nb\x82nl`\x8crl\xc4l\xe4\xfe[I][logger:034]: Log initialized
[20:22:52][C][safe_mode:079]: There have been 2 suspected unsuccessful boot attempts
[20:22:52][I][app:029]: Running through setup()...
[20:22:52][I][i2c.arduino:218]: Performing I2C bus recovery
[20:22:52][C][mpr121:014]: Setting up MPR121...

Additional information

No response

SmarterHomeLife commented 3 months ago

I rolled back to esphome 2024.5.5 and it's working perfectly.

To be clear, the firmware compiles and installs fine without the mpr121 connected it just fails the i2c scan but when I boot with the mpr121 connected I get the above.

coolinger commented 3 months ago

Just commenting my observations:

Only binary_sensor with platform mpr121 triggers the error.

Just using it as GPIO for input

- platform: gpio
    pin: 
      mpr121: mpr121c
      number: 4
      mode: INPUT
      inverted: True
    id: Num4

or output

output:
  - id: ext_5v_power
    platform: gpio
    pin:
      mpr121: mpr121c
      number: 10
      mode: OUTPUT
      inverted: true

or not using it at all does not trigger the error.

I have this problem on ESP32-WROVER and a ESP32-WROOM-32U devkits with 2024.6.1 from docker esphome/esphome. Rolling back to 2024.5 removes the error.

morris2009 commented 3 months ago

Same issue here. in 2024.6.0-dev it was still working in 2024.7.0-dev it is broken

[23:10:48][C][mpr121:014]: Setting up MPR121...

[23:10:49]Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. [23:10:49] [23:10:49]Core 1 register dump: [23:10:49]PC : 0x400e0908 PS : 0x00060030 A0 : 0x800e0969 A1 : 0x3ffb25e0
[23:10:49]A2 : 0x3ffb2b70 A3 : 0x0000005e A4 : 0x3ffb260c A5 : 0x00000001
[23:10:49]A6 : 0x00000001 A7 : 0x00000001 A8 : 0x801913ae A9 : 0x00000000
[23:10:49]A10 : 0x00000000 A11 : 0x00000002 A12 : 0x3ffb25e0 A13 : 0x00000002
[23:10:49]A14 : 0x00000001 A15 : 0x00000001 SAR : 0x00000004 EXCCAUSE: 0x0000001c
[23:10:49]EXCVADDR: 0x00000025 LBEG : 0x4008a394 LEND : 0x4008a3aa LCOUNT : 0xffffffff
[23:10:49] [23:10:49] [23:10:49]Backtrace:0x400e0905:0x3ffb25e00x400e0966:0x3ffb2610 0x400e0b0d:0x3ffb2630 0x40191db9:0x3ffb2650 0x40191e45:0x3ffb2670 0x400e6380:0x3ffb2690 0x400e90ca:0x3ffb26c0 0x400ef666:0x3ffb2820 [23:10:49] [23:10:49] [23:10:49] [23:10:49] [23:10:49]ELF file SHA256: 0000000000000000 [23:10:49] [23:10:49]Rebooting... [23:10:49]ets Jun 8 2016 00:22:57 [23:10:49] [23:10:49]rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) [23:10:49]configsip: 0, SPIWP:0xee [23:10:49]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 [23:10:49]mode:DIO, clock div:2 [23:10:49]load:0x3fff0030,len:1184 [23:10:49]load:0x40078000,len:13132 [23:10:49]load:0x40080400,len:3036 [23:10:49]entry 0x400805e4 [23:10:49][I][logger:156]: Log initialized [23:10:49][C][safe_mode:079]: There have been 10 suspected unsuccessful boot attempts