-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
i2c Core 0 panic'ed (Load access fault) issue (IDFGH-8722) #10163
Comments
I bisect to below bad commit which causes the esp32c3 panic: 803fc3f is the first bad commit
|
The problem is if a i2c device is not available, it hit panic in current master tree now. |
@AxelLin Yes, I added hardware pointer to NULL if I2C controller deleted. So, basically, I think |
In previous esp-idf versions, it's fine to init with below calls: But now it needs to call with below order (otherwise hit the panic). Such change breaks existing code (e.g. out-of-tree library: https://github.com/UncleRus/esp-idf-lib/blob/master/components/i2cdev/i2cdev.c#L207-L212 ) BTW, if the order of above calls does matter, please make it clear in your API documentation. |
i2c_driver_install() needs to be called before i2c_param_config(). This fixes panic reported on [1]. Link: [1] espressif/esp-idf#10163 Signed-off-by: Axel Lin <axel.lin@ingics.com>
@mythbuster5 i.e. below call sequence will cause panic if a sensor is not available:
For testing , I comment out i2c_hal_deinit(&i2c_context[i2c_num].hal); in i2c_driver_delete() then I no longer hit this panic. |
@mythbuster5 Any update for this regression fix? |
I also have the same issue. I had though initially that it was my adding in of espcoredump component to capture unrelated panic issues to flash. Because we had used PSRAM in some of our task stacks, we temporarily cut stack size for LVGL and frame buffers for LVGL because the coredump to flash is not available if PSRAM is set to be used with the common heap. I had inadvertently thought that and IDF framework update was necessary (we were on the version from Aug '22) and never thought that I2C drivers would have changed that much. We also used the "Uncle Rus" I2Cdev component from github. We are on an ESP32S3 with 16MBflash and 8MB PSRAM. I can confirm that "comment out i2c_hal_deinit(&i2c_context[i2c_num].hal); in i2c_driver_delete()" works |
There are several issues with commit 803fc3f.
|
@AxelLin Generally I'm sorry for busy on other high priority tasks these days. I will find time to get this one fixed. |
So you even didn't read my comment #10163 (comment) . There could be multiple i2c devices on the bus:
Assume the first device is not on the bus, in the 2nd iteration the i2c_param_config() is called after i2c_driver_delete(). |
Actually, it's not about confusing at all. |
@AxelLin Will get it fixed, thanks |
i2c_driver_install() needs to be called before i2c_param_config(). This fixes panic reported on [1]. Link: [1] espressif/esp-idf#10163 Signed-off-by: Axel Lin <axel.lin@ingics.com>
Answers checklist.
General issue report
Module or chip used: ESP32-C3-DevKitM-1
IDF version: v5.1-dev-1751-gc09322430a
Build System: idf.py
Compiler version: riscv32-esp-elf-gcc (crosstool-NG esp-2022r1-RC1) 11.2.0
Operating System: Linux
Power Supply: USB
Hi,
Something in i2c was broken in the master tree.
I got below panic after pulling the esp-idf update from the master tree.
(My application was working before pulling the esp-idf update today).
Guru Meditation Error: Core 0 panic'ed (Load access fault). Exception was unhandled.
Stack dump detected
Core 0 register dump:
MEPC : 0x42049330 RA : 0x42049326 SP : 0x3fca33a0 GP : 0x3fc95800
0x42049330: i2c_ll_disable_intr_mask at /home/axel/esp/esp-idf/components/hal/esp32c3/include/hal/i2c_ll.h:229
(inlined by) i2c_param_config at /home/axel/esp/esp-idf/components/driver/i2c.c:760
0x42049326: i2c_param_config at /home/axel/esp/esp-idf/components/driver/i2c.c:760
TP : 0x3fc69ad4 T0 : 0x00000000 T1 : 0x4038f5d0 T2 : 0xffffffff
0x4038f5d0: gpspi_flash_ll_set_miso_bitlen at /home/axel/esp/esp-idf/components/hal/esp32c3/include/hal/gpspi_flash_ll.h:259
(inlined by) spi_flash_hal_gpspi_configure_host_io_mode at /home/axel/esp/esp-idf/components/hal/spi_flash_hal_common.inc:142
S0/FP : 0x3fca33d4 S1 : 0x0000000b A0 : 0x00000001 A1 : 0x00000001
A2 : 0x00000007 A3 : 0xffff0000 A4 : 0x00000001 A5 : 0x00000000
A6 : 0xa0000000 A7 : 0x0000000a S2 : 0x00000000 S3 : 0x3fc958e0
S4 : 0x00000000 S5 : 0x3fc958e0 S6 : 0x00000000 S7 : 0x00000000
S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000
T3 : 0x00000000 T4 : 0x00000002 T5 : 0x00000800 T6 : 0x0000000e
MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000005 MTVAL : 0x00000028
0x40380001: _vector_table at ??:?
MHARTID : 0x00000000
Backtrace:
0x42049330 in i2c_ll_disable_intr_mask (mask=65535, hw=0x0) at /home/axel/esp/esp-idf/components/hal/esp32c3/include/hal/i2c_ll.h:229
229 hw->int_ena.val &= (~mask);
#0 0x42049330 in i2c_ll_disable_intr_mask (mask=65535, hw=0x0) at /home/axel/esp/esp-idf/components/hal/esp32c3/include/hal/i2c_ll.h:229
#1 i2c_param_config (i2c_num=, i2c_conf=i2c_conf@entry=0x3fca33d4) at /home/axel/esp/esp-idf/components/driver/i2c.c:760
#2 0x42018af2 in i2c_setup_port (dev=dev@entry=0x3fc99ca8 ) at /home/axel/esp/esp-idf-dev/esp-idf-lib/components/i2cdev/i2cdev.c:208
#3 0x42018d7e in i2c_dev_probe (dev=dev@entry=0x3fc99ca8 , operation_type=operation_type@entry=I2C_DEV_WRITE) at /home/axel/esp/esp-idf-dev/esp-idf-lib/components/i2cdev/i2cdev.c:246
The text was updated successfully, but these errors were encountered: