esphome / issues

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

Issues with ESP32-C3 PN532 over I2C #3018

Open adonno opened 2 years ago

adonno commented 2 years ago

The problem

I am able to flash and configure the ESP and the ESP is able to detect the PN532 over I2C but after detection it falls into a loop and does the same thing again and again

i've tried other sensors via I2C and they worked : i.e tof10120 & vl53l0x

Which version of ESPHome has the issue?

2022.2.0-dev

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32-IDF

Board

ESP32-C3-DevkitM-1 V1.6

Component causing the issue

PN532

Example YAML snippet

esphome:
  name: dtag
  platformio_options:
    board_build.f_flash: 40000000L
    board_build.flash_mode: dio
    board_build.flash_size: 4MB
esp32:
  variant: ESP32C3
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf
    version: recommended
#wifi:
#  ssid: tagreader_test
#  password: jesserokz

logger:

# api:

#ota:
#  safe_mode: true
#  reboot_timeout: 10min
#  num_attempts: 5

i2c:
  sda: 18
  scl: 19
  scan: true
  id: bus_a

pn532_i2c:
  update_interval: 1s

Anything in the logs that might be useful for us?

======================== [SUCCESS] Took 51.29 seconds ========================
INFO Successfully compiled program.
esptool.py v3.2
Serial port /dev/cu.usbserial-2220
Connecting....
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:a4:a0:78
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 0x00010000 to 0x0004dfff...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000d000 to 0x0000efff...
Compressed 252224 bytes to 134236...
Wrote 252224 bytes (134236 compressed) at 0x00010000 in 4.3 seconds (effective 468.4 kbit/s)...
Hash of data verified.
Compressed 20672 bytes to 12202...
Wrote 20672 bytes (12202 compressed) at 0x00000000 in 0.6 seconds (effective 260.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 129...
Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 391.7 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x0000d000 in 0.1 seconds (effective 565.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/cu.usbserial-2220 with baud rate 115200
[17:23:29]
[17:23:29]SPIWP:0xee
[17:23:29]mode:DIO, clock div:2
[17:23:29]load:0x3fcd6100,len:0x19d8
[17:23:29]load:0x403ce000,len:0x8d4
[17:23:29]load:0x403d0000,len:0x2dc0
[17:23:29]entry 0x403ce000
[17:23:29]I (32) boot: ESP-IDF 4.3.2 2nd stage bootloader
[17:23:29]I (32) boot: compile time 17:23:19
[17:23:29]I (32) boot: chip revision: 3
[17:23:29]I (33) boot_comm: chip revision: 3, min. bootloader chip revision: 0
[17:23:29]I (40) boot.esp32c3: SPI Speed      : 40MHz
[17:23:29]I (45) boot.esp32c3: SPI Mode       : DIO
[17:23:29]I (50) boot.esp32c3: SPI Flash Size : 4MB
[17:23:29]I (55) boot: Enabling RNG early entropy source...
[17:23:29]I (60) boot: Partition Table:
[17:23:29]I (64) boot: ## Label            Usage          Type ST Offset   Length
[17:23:29]I (71) boot:  0 nvs              WiFi data        01 02 00009000 00004000
[17:23:29]I (78) boot:  1 otadata          OTA data         01 00 0000d000 00002000
[17:23:29]I (86) boot:  2 phy_init         RF data          01 01 0000f000 00001000
[17:23:29]I (93) boot:  3 app0             OTA app          00 10 00010000 001c0000
[17:23:29]I (101) boot:  4 app1             OTA app          00 11 001d0000 001c0000
[17:23:29]I (108) boot: End of partition table
[17:23:29]I (113) boot: No factory image, trying OTA 0
[17:23:29]I (117) boot_comm: chip revision: 3, min. application chip revision: 0
[17:23:29]I (125) esp_image: segment 0: paddr=00010020 vaddr=3c030020 size=0ef70h ( 61296) map
[17:23:29]I (146) esp_image: segment 1: paddr=0001ef98 vaddr=3fc8ae00 size=01080h (  4224) load
[17:23:29]I (147) esp_image: segment 2: paddr=00020020 vaddr=42000020 size=220a4h (139428) map
[17:23:29]I (181) esp_image: segment 3: paddr=000420cc vaddr=3fc8be80 size=00ad4h (  2772) load
[17:23:29]I (182) esp_image: segment 4: paddr=00042ba8 vaddr=40380000 size=0ad58h ( 44376) load
[17:23:29]I (197) esp_image: segment 5: paddr=0004d908 vaddr=50000000 size=00010h (    16) load
[17:23:29]I (201) boot: Loaded app from partition at offset 0x10000
[17:23:29]I (235) boot: Set actual ota_seq=1 in otadata[0]
[17:23:29]I (235) boot: Disabling RNG early entropy source...
[17:23:29]I (246) cpu_start: Pro cpu up.
[17:23:29]I (258) cpu_start: Pro cpu start user code
[17:23:29]I (258) cpu_start: cpu freq: 160000000
[17:23:29]I (258) cpu_start: Application information:
[17:23:29]I (261) cpu_start: Project name:     dtag
[17:23:29]I (266) cpu_start: App version:      2022.2.0-dev
[17:23:29]I (271) cpu_start: Compile time:     Feb  5 2022 17:22:41
[17:23:29]I (277) cpu_start: ELF file SHA256:  77af4671c6c19fde...
[17:23:29]I (283) cpu_start: ESP-IDF:          4.3.2
[17:23:29]I (288) heap_init: Initializing. RAM available for dynamic allocation:
[17:23:29]I (295) heap_init: At 3FC8D900 len 00032700 (201 KiB): DRAM
[17:23:29]I (301) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
[17:23:29]I (308) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
[17:23:29]I (315) spi_flash: detected chip: generic
[17:23:29]I (319) spi_flash: flash io: dio
[17:23:29]I (323) sleep: Configure to isolate all GPIO pins in sleep state
[17:23:29]I (330) sleep: Enable automatic switch\xb9\xeb\xff[I][logger:214]: Log initialized
[17:23:29][I][app:029]: Running through setup()...
[17:23:29][I][i2c.idf:217]: Performing I2C bus recovery
[17:23:29][D][esp-idf:000]: I (352) gpio: GPIO[19]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 
[17:23:29]
[17:23:29][D][esp-idf:000]: I (352) gpio: GPIO[18]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 
[17:23:29]
[17:23:29][C][pn532:018]: Setting up PN532...
[17:23:29][D][pn532:033]: Found chip PN532
[17:23:29][D][pn532:034]: Firmware ver. 1.6
[17:23:30][I][app:062]: setup() finished successfully!
[17:23:35]E (5559) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[17:23:35]E (5559) task_wdt:  - loopTask (CPU 0)
[17:23:35]E (5559) task_wdt: Tasks currently running:
[17:23:35]E (5559) task_wdt: CPU 0: loopTask
[17:23:35]E (5559) task_wdt: Aborting.
[17:23:35]
[17:23:35]abort() was called at PC 0x4200b90f on core 0
[17:23:35]Core  0 register dump:
[17:23:35]MEPC    : 0x40380c96  RA      : 0x40385382  SP      : 0x3fc8cfb0  GP      : 0x3fc8b600  
WARNING Decoded 0x40380c96: panic_abort at /Users/andreadonno/.platformio/packages/framework-espidf/components/esp_system/panic.c:404
WARNING Decoded 0x40380c96: panic_abort at /Users/andreadonno/.platformio/packages/framework-espidf/components/esp_system/panic.c:404
[17:23:35]TP      : 0x3fc84a18  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
[17:23:35]S0/FP   : 0x3fc8cfec  S1      : 0x3fc8cfec  A0      : 0x3fc8cfec  A1      : 0x3fc8cfce  
[17:23:35]A2      : 0x00000000  A3      : 0x3fc8d019  A4      : 0x00000001  A5      : 0x3fc8d000  
[17:23:35]A6      : 0x7a797877  A7      : 0x76757473  S2      : 0x3fc8cfd0  S3      : 0x7fffffff  
[17:23:35]S4      : 0x3fc8b188  S5      : 0x3fc8b178  S6      : 0x3fc8b180  S7      : 0x3fc8b178  
[17:23:35]S8      : 0x000004be  S9      : 0xffffffff  S10     : 0x00000000  S11     : 0x00000000  
[17:23:35]T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
[17:23:35]MSTATUS : 0x00001801  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
[17:23:35]MHARTID : 0x00000000  
[17:23:35]
[17:23:35]Stack memory:
[17:23:35]3fc8cfb0: 0x00000000 0xffffffff 0x3fc8cfec 0x40389bee 0x3fc8b180 0x3fc8b178 0x3fc8b188 0x7fff0030
[17:23:35]3fc8cfd0: 0x30303234 0x66303962 0x3c034000 0x3fc8c360 0x3fc8cfd0 0x3fc8c37c 0x3fc8cfcc 0x726f6261
[17:23:35]3fc8cff0: 0x20292874 0x20736177 0x6c6c6163 0x61206465 0x43502074 0x34783020 0x62303032 0x20663039
[17:23:35]3fc8d010: 0x63206e6f 0x2065726f 0x00000030 0x00000000 0x3fc8d794 0x00000000 0x3c034000 0x4200b912
[17:23:35]3fc8d030: 0x00000000 0xffffffff 0x000004be 0x000015b7 0x00000000 0x3fc93e7c 0xffffffff 0x00000001
[17:23:35]3fc8d050: 0x3fc93a64 0x3fc93e7c 0xffffffff 0x00000001 0x00001881 0x80000007 0x3fc93e40 0x4038019e
[17:23:35]3fc8d070: 0x00000001 0x3fc91264 0xffffffff 0x3fc91264 0x3fc91264 0x00000001 0x3fc938a4 0xffffffff
[17:23:35]3fc8d090: 0x3fc938a4 0x3fc938a4 0x00000000 0x3fc8d0a0 0xffffffff 0x3fc8d0a0 0x3fc8d0a0 0x00000000
[17:23:35]3fc8d0b0: 0x3fc8d0b4 0xffffffff 0x3fc8d0b4 0x3fc8d0b4 0x00000000 0x3fc8d0c8 0xffffffff 0x3fc8d0c8
[17:23:35]3fc8d0d0: 0x3fc8d0c8 0x00000000 0x3fc8d0dc 0xffffffff 0x3fc8d0dc 0x3fc8d0dc 0x00000000 0x3fc8d0f0
[17:23:35]3fc8d0f0: 0xffffffff 0x3fc8d0f0 0x3fc8d0f0 0x00000000 0x3fc8d104 0xffffffff 0x3fc8d104 0x3fc8d104
[17:23:35]3fc8d110: 0x00000000 0x3fc8d118 0xffffffff 0x3fc8d118 0x3fc8d118 0x00000000 0x3fc8d12c 0xffffffff
[17:23:35]3fc8d130: 0x3fc8d12c 0x3fc8d12c 0x00000000 0x3fc8d140 0xffffffff 0x3fc8d140 0x3fc8d140 0x00000000
[17:23:35]3fc8d150: 0x3fc8d154 0xffffffff 0x3fc8d154 0x3fc8d154 0x00000000 0x3fc8d168 0xffffffff 0x3fc8d168
[17:23:35]3fc8d170: 0x3fc8d168 0x00000000 0x3fc8d17c 0xffffffff 0x3fc8d17c 0x3fc8d17c 0x00000000 0x3fc8d190
[17:23:35]3fc8d190: 0xffffffff 0x3fc8d190 0x3fc8d190 0x00000000 0x3fc8d1a4 0xffffffff 0x3fc8d1a4 0x3fc8d1a4
[17:23:35]3fc8d1b0: 0x00000000 0x3fc8d1b8 0xffffffff 0x3fc8d1b8 0x3fc8d1b8 0x00000000 0x3fc8d1cc 0xffffffff
[17:23:35]3fc8d1d0: 0x3fc8d1cc 0x3fc8d1cc 0x00000000 0x3fc8d1e0 0xffffffff 0x3fc8d1e0 0x3fc8d1e0 0x00000000
[17:23:35]3fc8d1f0: 0x3fc8d1f4 0xffffffff 0x3fc8d1f4 0x3fc8d1f4 0x00000000 0x3fc8d208 0xffffffff 0x3fc8d208
[17:23:35]3fc8d210: 0x3fc8d208 0x00000000 0x3fc8d21c 0xffffffff 0x3fc8d21c 0x3fc8d21c 0x00000000 0x3fc8d230
[17:23:35]3fc8d230: 0xffffffff 0x3fc8d230 0x3fc8d230 0x00000000 0x3fc8d244 0xffffffff 0x3fc8d244 0x3fc8d244
[17:23:35]3fc8d250: 0x00000000 0x3fc8d258 0xffffffff 0x3fc8d258 0x3fc8d258 0x00000000 0x3fc8d26c 0xffffffff
[17:23:35]3fc8d270: 0x3fc8d26c 0x3fc8d26c 0x00000000 0x3fc8d280 0xffffffff 0x3fc8d280 0x3fc8d280 0x00000000
[17:23:35]3fc8d290: 0x3fc8d294 0xffffffff 0x3fc8d294 0x3fc8d294 0x00000001 0x3fc8d2a8 0xffffffff 0x3fc8f66c
[17:23:35]3fc8d2b0: 0x3fc8f66c 0x00000000 0x3fc8d2bc 0xffffffff 0x3fc8d2bc 0x3fc8d2bc 0x3c0379b4 0x00000005
[17:23:35]3fc8d2d0: 0x3c034da8 0x0000000d 0x3c0349d4 0x00000015 0x3c031810 0x0000001d 0x00000000 0x00000000
[17:23:35]3fc8d2f0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
[17:23:35]3fc8d310: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
[17:23:35]3fc8d330: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
[17:23:35]3fc8d350: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
[17:23:35]3fc8d370: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
[17:23:35]3fc8d390: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
[17:23:35]
[17:23:35]
[17:23:35]
[17:23:35]ELF file SHA256: 77af4671c6c19fde
[17:23:35]
[17:23:35]Rebooting...
[17:23:35]ESP-ROM:esp32c3-api1-20210207
[17:23:35]Build:Feb  7 2021
[17:23:35]rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
[17:23:35]Saved PC:0x40380cc2
WARNING Decoded 0x40380cc2: esp_restart_noos_dig at /Users/andreadonno/.platformio/packages/framework-espidf/components/esp_system/system_api.c:62 (discriminator 1)
[17:23:35]SPIWP:0xee
[17:23:35]mode:DIO, clock div:2
[17:23:35]load:0x3fcd6100,len:0x19d8
[17:23:35]load:0x403ce000,len:0x8d4
[17:23:35]load:0x403d0000,len:0x2dc0
[17:23:35]entry 0x403ce000
[17:23:35]I (35) boot: ESP-IDF 4.3.2 2nd stage bootloader
[17:23:35]I (35) boot: compile time 17:23:19
[17:23:35]I (35) boot: chip revision: 3
[17:23:35]I (37) boot_comm: chip revision: 3, min. bootloader chip revision: 0
[17:23:35]I (44) boot.esp32c3: SPI Speed      : 40MHz
[17:23:35]I (48) boot.esp32c3: SPI Mode       : DIO
[17:23:35]I (53) boot.esp32c3: SPI Flash Size : 4MB
[17:23:35]I (58) boot: Enabling RNG early entropy source...
[17:23:35]I (63) boot: Partition Table:
[17:23:35]I (67) boot: ## Label            Usage          Type ST Offset   Length
[17:23:35]I (74) boot:  0 nvs              WiFi data        01 02 00009000 00004000
[17:23:35]I (82) boot:  1 otadata          OTA data         01 00 0000d000 00002000
[17:23:35]I (89) boot:  2 phy_init         RF data          01 01 0000f000 00001000
[17:23:35]I (97) boot:  3 app0             OTA app          00 10 00010000 001c0000
[17:23:35]I (104) boot:  4 app1             OTA app          00 11 001d0000 001c0000
[17:23:35]I (112) boot: End of partition table
[17:23:35]I (116) boot_comm: chip revision: 3, min. application chip revision: 0
[17:23:35]I (123) esp_image: segment 0: paddr=00010020 vaddr=3c030020 size=0ef70h ( 61296) map
[17:23:35]I (144) esp_image: segment 1: paddr=0001ef98 vaddr=3fc8ae00 size=01080h (  4224) load
[17:23:35]I (146) esp_image: segment 2: paddr=00020020 vaddr=42000020 size=220a4h (139428) map
[17:23:35]I (179) esp_image: segment 3: paddr=000420cc vaddr=3fc8be80 size=00ad4h (  2772) load
[17:23:35]I (180) esp_image: segment 4: paddr=00042ba8 vaddr=40380000 size=0ad58h ( 44376) load
[17:23:35]I (196) esp_image: segment 5: paddr=0004d908 vaddr=50000000 size=00010h (    16) load
[17:23:35]I (199) boot: Loaded app from partition at offset 0x10000
[17:23:35]I (200) boot: Disabling RNG early entropy source...
[17:23:35]I (216) cpu_start: Pro cpu up.
[17:23:36]I (885) cpu_start: Pro cpu start user code
[17:23:36]I (885) cpu_start: cpu freq: 160000000
[17:23:36]I (885) cpu_start: Application information:
[17:23:36]I (888) cpu_start: Project name:     dtag
[17:23:36]I (893) cpu_start: App version:      2022.2.0-dev
[17:23:36]I (898) cpu_start: Compile time:     Feb  5 2022 17:22:41
[17:23:36]I (904) cpu_start: ELF file SHA256:  77af4671c6c19fde...
[17:23:36]I (910) cpu_start: ESP-IDF:          4.3.2
[17:23:36]I (915) heap_init: Initializing. RAM available for dynamic allocation:
[17:23:36]I (922) heap_init: At 3FC8D900 len 00032700 (201 KiB): DRAM
[17:23:36]I (928) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
[17:23:36]I (935) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
[17:23:36]I (942) spi_flash: detected chip: generic
[17:23:36]I (946) spi_flash: flash io: dio
[17:23:36]I (950) sleep: Configure to isolate all GPIO pins in sleep state
[17:23:36]I (957) sleep: Enable automatic switch\xb9\xeb\xff[I][logger:214]: Log initialized
[17:23:36][I][app:029]: Running through setup()...
[17:23:36][I][i2c.idf:217]: Performing I2C bus recovery
[17:23:36][D][esp-idf:000]: I (979) gpio: GPIO[19]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 
[17:23:36]
[17:23:36][D][esp-idf:000]: I (979) gpio: GPIO[18]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 
[17:23:36]
[17:23:36][C][pn532:018]: Setting up PN532...
[17:23:36][D][pn532:033]: Found chip PN532
[17:23:36][D][pn532:034]: Firmware ver. 1.6
[17:23:36][I][app:062]: setup() finished successfully!

Additional information

No response

probot-esphome[bot] commented 2 years ago

Hey there @ottowinter, @jesserockz, mind taking a look at this issue as it has been labeled with an integration (pn532) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

pinsdorf commented 2 years ago

@adonno, you gave your I2C bus a custom name (id: bus_a). Did you try to reference this name in the PN532 configuration like this:

pn532_i2c:
  update_interval: 1s
  i2c_id: bus_a

The sensor has dip switches on the PCB to select the communication protocol. Did you set them correctly to I2C?