-
Notifications
You must be signed in to change notification settings - Fork 702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 I2C主机模式是否在I2C总线出问题时会导致程序崩溃? (AUD-5760) #1293
Comments
How did you solve this? i get no connection on the i2c on a Audio-dev kit log is like
|
@theGuen So I modified the
|
Environment
`ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7524
load:0x40078000,len:16540
load:0x40080400,len:4
--- 0x40080400: _init at ??:?
load:0x40080404,len:4312
entry 0x4008065c
I (29) boot: ESP-IDF v5.3.1-395-g707d097b01-dirty 2nd stage bootloader
I (29) boot: compile time Oct 12 2024 02:30:27
I (31) boot: Multicore bootloader
I (35) boot: chip revision: v3.0
I (39) qio_mode: Enabling default flash chip QIO
I (45) boot.esp32: SPI Speed : 40MHz
I (49) boot.esp32: SPI Mode : QIO
I (54) boot.esp32: SPI Flash Size : 16MB
I (58) boot: Enabling RNG early entropy source...
I (64) boot: Partition Table:
I (67) boot: ## Label Usage Type ST Offset Length
I (75) boot: 0 nvs WiFi data 01 02 00011000 00004000
I (82) boot: 1 otadata OTA data 01 00 00015000 00002000
I (90) boot: 2 phy_init RF data 01 01 00017000 00001000
I (97) boot: 3 ota_0 OTA app 00 10 00020000 00300000
I (105) boot: 4 ota_1 OTA app 00 11 00320000 00300000
I (112) boot: 5 storage Unknown data 01 81 00620000 00400000
I (120) boot: End of partition table
I (124) boot: No factory image, trying OTA 0
I (129) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=0f960h ( 63840) map
I (156) esp_image: segment 1: paddr=0002f988 vaddr=3ffbdb60 size=00690h ( 1680) load
I (157) esp_image: segment 2: paddr=00030020 vaddr=400d0020 size=25068h (151656) map
I (206) esp_image: segment 3: paddr=00055090 vaddr=3ffbe1f0 size=01e5ch ( 7772) load
I (208) esp_image: segment 4: paddr=00056ef4 vaddr=40080000 size=0dab0h ( 55984) load
I (237) boot: Loaded app from partition at offset 0x20000
I (279) boot: Set actual ota_seq=1 in otadata[0]
I (279) boot: Disabling RNG early entropy source...
I (290) quad_psram: This chip is ESP32-D0WD
I (290) esp_psram: Found 8MB PSRAM device
I (290) esp_psram: Speed: 40MHz
I (294) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
W (301) esp_psram: Virtual address not enough for PSRAM, map as much as we can. 4MB is mapped
I (311) cpu_start: Multicore app
I (326) cpu_start: Pro cpu start user code
I (326) cpu_start: cpu freq: 240000000 Hz
I (326) app_init: Application information:
I (331) app_init: Project name: IPB_AS_APP_ESP32
I (337) app_init: App version: 065255f-dirty
I (342) app_init: Compile time: Oct 12 2024 02:30:07
I (348) app_init: ELF file SHA256: fdd1478bc8660eae...
I (354) app_init: ESP-IDF: v5.3.1-395-g707d097b01-dirty
I (361) efuse_init: Min chip rev: v3.0
I (365) efuse_init: Max chip rev: v3.99
I (370) efuse_init: Chip rev: v3.0
I (375) heap_init: Initializing. RAM available for dynamic allocation:
I (382) heap_init: At 3FFAE6E0 len 0000F480 (61 KiB): DRAM
I (388) heap_init: At 3FFC0C40 len 0001F3C0 (124 KiB): DRAM
I (395) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (401) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (407) heap_init: At 4008DAB0 len 00012550 (73 KiB): IRAM
I (414) esp_psram: Adding pool of 4096K of PSRAM memory to heap allocator
I (422) spi_flash: detected chip: generic
I (426) spi_flash: flash io: qio
I (430) main_task: Started on CPU0
I (434) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (442) main_task: Calling app_main()
I (457) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (458) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (467) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (476) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (486) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
W (495) i2c_bus_v2: I2C master handle is NULL, will create new one
I (502) gpio: GPIO[15]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (511) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (522) main_task: Returned from app_main()
E (129283) i2c.master: I2C hardware NACK detected
E (129283) i2c.master: I2C transaction unexpected nack detected
E (129284) i2c.master: s_i2c_synchronous_transaction(880): I2C transaction failed
I (129292) gpio: GPIO[15]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (129301) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
E (129311) i2c.master: i2c_master_transmit_receive(1118): I2C transaction failed
E (134282) i2c.master: I2C hardware NACK detected
E (134283) i2c.master: I2C transaction unexpected nack detected
E (134283) i2c.master: s_i2c_synchronous_transaction(880): I2C transaction failed
I (134292) gpio: GPIO[15]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (134301) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
E (134311) i2c.master: i2c_master_transmit(1095): I2C transaction failed
E (137219) i2c.master: I2C hardware NACK detected
E (137220) i2c.master: I2C transaction unexpected nack detected
E (137220) i2c.master: s_i2c_synchronous_transaction(880): I2C transaction failed
I (137229) gpio: GPIO[15]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (137238) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
E (137248) i2c.master: i2c_master_transmit_receive(1118): I2C transaction failed
E (191284) i2c.master: I2C hardware NACK detected
E (191284) i2c.master: I2C transaction unexpected nack dete.master: s_i2c_synchronous_transaction(880): I2C transaction failed
I (191293) gpio: GPIO[15]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (191302) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
E (191312) i2c.master: i2c_master_transmit_receive(1118): I2C transaction failed
Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40085709 PS : 0x00060033 A0 : 0x8008235c A1 : 0x3ffbecf0
--- 0x40085709: i2c_ll_read_rxfifo at /opt/esp/idf/components/hal/esp32/include/hal/i2c_ll.h:576
(inlined by) i2c_isr_receive_handler at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:617
(inlined by) i2c_master_isr_handler_default at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:675
A2 : 0x3ffb7230 A3 : 0xffffffff A4 : 0x00000001 A5 : 0x3ffb755c
A6 : 0x3ffb755c A7 : 0x3ffb72a4 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x00000001 A11 : 0x3ff53000 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x0000cdcd SAR : 0x00000000 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
--- 0x4000c2e0: memcpy in ROM
0x4000c2f6: memcpy in ROM
Backtrace: 0x40085706:0x3ffbecf0 0x40082359:0x3ffbed30 0x40083d4d:0x3ffbed50 0x4000bfed:0x3f802f50 0x40087937:0x3f802f60 0x400859b1:0x3f802f80 0x400f2f7d:0x3f802fc0 0x400f3114:0x3f802ff0 0x400f3408:0x3f803020 0x400f3c59:0x3f803050 0x400d7194:0x3f8030e0 0x400d6e19:0x3f803110 0x400d65b2:0x3f803140
--- 0x40085706: i2c_ll_read_rxfifo at /opt/esp/idf/components/hal/esp32/include/hal/i2c_ll.h:576
(inlined by) i2c_isr_receive_handler at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:617
(inlined by) i2c_master_isr_handler_default at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:675
0x40082359: shared_intr_isr at /opt/esp/idf/components/esp_hw_support/intr_alloc.c:445
0x40083d4d: _xt_lowint1 at /opt/esp/idf/components/xtensa/xtensa_vectors.S:1240
0x4000bfed: _xtos_set_intlevel in ROM
0x40087937: vPortClearInterruptMaskFromISR at /opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:560
(inlined by) vPortExitCritical at /opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:509
0x400859b1: vPortExitCriticalSafe at /opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:596
(inlined by) s_i2c_start_end_command at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:357
0x400f2f7d: s_i2c_send_commands at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:479
0x400f3114: s_i2c_transaction_start at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:592
0x400f3408: s_i2c_synchronous_transaction at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:880
(inlined by) s_i2c_synchronous_transaction at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:860
0x400f3c59: i2c_master_transmit_receive at /opt/esp/idf/components/esp_driver_i2c/i2c_master.c:1118
0x400d7194: i2c_bus_read_bytes at /opt/esp/esp-adf/esp-adf-v2.7/components/esp_peripherals/driver/i2c_bus/i2c_bus_v2.c:206
0x400d6e19: extend_mcu_read_reg at /workspaces/components/extern_mcu/extend_mcu.c:53
0x400d65b2: extend_mcu_task at /workspaces/main/app/app_extend_mcu.c:96
`
Problem Description
ESP32与STM32通过i2c总线通讯,STM32一端是作为从机,STM32 硬件I2C控制器偶尔会崩溃,但会重启控制器。STM32 I2C控制器崩溃时,会导致I2C总线无法正常使用。ESP32 I2C经过长时间就会出现上述崩溃信息,从崩溃信息分析,应该是遇到了NULL指针。在idf-v4.4与adf-v2.6版本一起搭配使用的时候,没有遇到这样的崩溃。
Code
代码也相当简单,就ESP32不断通过I2C总线去读写STM32实现的I2C从设备。
The text was updated successfully, but these errors were encountered: