Skip to content

I2C driver behaviour after moving from 2.X.X to 3.2 #11374

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

Open
1 task done
handmade0octopus opened this issue May 17, 2025 · 0 comments
Open
1 task done

I2C driver behaviour after moving from 2.X.X to 3.2 #11374

handmade0octopus opened this issue May 17, 2025 · 0 comments
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@handmade0octopus
Copy link

Board

ESP32-S3 custom board

Device Description

Not relevant, same HW works perfectly on 2.X.X

Hardware Configuration

	#define I2C_SCL 	42
	#define I2C_SDA 	41

Version

latest stable Release (if not listed below)

IDE Name

Platformio

Operating System

w11

Flash frequency

nr

PSRAM enabled

yes

Upload speed

nr

Description

Randomly (eg after few minutes of querying) I get errors like this:

E (190508) i2c.master: s_i2c_synchronous_transaction(924): I2C transaction failed
E (190508) i2c.master: i2c_master_receive(1240): I2C transaction failed
[187037][E][esp32-hal-i2c-ng.c:311] i2cRead(): i2c_master_receive failed: [259] ESP_ERR_INVALID_STATE
[187046][E][Wire.cpp:523] requestFrom(): i2cRead returned Error 259

And after I have store prohibited:

Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x40379f6c  PS      : 0x00060033  A0      : 0x80377f34  A1      : 0x3fc9c570
A2      : 0x3c1f1460  A3      : 0xffffffff  A4      : 0x3c1f1764  A5      : 0x3c1f1764
A6      : 0x3fc9c570  A7      : 0x3c1f1494  A8      : 0x00000000  A9      : 0x00000000
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x60013000  A13     : 0x3fcc78bc
A14     : 0x00000001  A15     : 0x0000abab  SAR     : 0x00000000  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff


Backtrace: 0x40379f69:0x3fc9c570 0x40377f31:0x3fc9c5b0 0x4037a76d:0x3fc9c5d0 0x4200d8d3:0x3fcbca00 0x42009269:0x3fcbca30 0x4200d53f:0x3fcbca60 0x403807a6:0x3fcbca90
  #0  0x40379f69 in i2c_ll_read_rxfifo at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/hal/esp32s3/include/hal/i2c_ll.h:703
      (inlined by) i2c_isr_receive_handler at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_driver_i2c/i2c_master.c:676
      (inlined by) i2c_master_isr_handler_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_driver_i2c/i2c_master.c:714
  #1  0x3fc9c570 in _xt_exception_table at ??:?
  #2  0x40377f31 in shared_intr_isr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/intr_alloc.c:464
  #3  0x3fc9c5b0 in _xt_exception_table at ??:?
  #4  0x4037a76d in _xt_lowint1 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/xtensa/xtensa_vectors.S:1240
  #5  0x3fc9c5d0 in _xt_exception_table at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:67
  #6  0x4200d8d3 in PhysicalButtonHandle::handle() at src/hardware/Input.hpp:121 (discriminator 1)
  #7  0x42009269 in handleInput() at src/hardware/Input.hpp:155
  #8  0x4200d53f in inputTask(void*) at src/hardware/Input.hpp:174
  #9  0x403807a6 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

Line in question is..:

button = !gpio_get_level((gpio_num_t)pin);

I used Arduino version before because I though this is the problem but it isn't.

Sometime after message I do not get store prohibited!

Sketch

I use ADXL from Adafruit library and I pass I2CBME that I setup beforehand. It worked fine for few years on old Arduino so not sure if new I2C is causing issues with Adafruit I2C device  but it was working great for ages in my setup.




Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(&I2CBME);
// ...
I2CBME.begin((int) I2C_SDA, (int) I2C_SCL, 1000000UL);
I2CBME.setTimeOut(1);

accel.begin(0x1D);

accel.setDataRate(ADXL345_DATARATE_100_HZ);
accel.setRange(ADXL345_RANGE_4_G);



Then I call this every 10ms:

union AccelObject {
	uint8_t buff[6];
	struct {
		int16_t x;
		int16_t y;
		int16_t z;
	};
} accelObj;

// ...
loop {
// ...
accel.readBuff(ADXL345_REG_DATAX0, accelObj.buff, 6);
// ...
}

Debug Message

Sometimes it doesn't even reach reading GPIO:


E (21656) i2c.master: s_i2c_synchronous_transaction(924): I2C transaction failed
E (21656) i2c.master: i2c_master_receive(1240): I2C transaction failed
[ 21667][E][esp32-hal-i2c-ng.c:311] i2cRead(): i2c_master_receive failed: [259] ESP_ERR_INVALID_STATE
[ 21676][E][Wire.cpp:523] requestFrom(): i2cRead returned Error 259
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x40379f6c  PS      : 0x00060033  A0      : 0x80377f34  A1      : 0x3fc9c570
A2      : 0x3c1f1460  A3      : 0xffffffff  A4      : 0x3c1f1764  A5      : 0x3c1f1764
A6      : 0x3fc9c570  A7      : 0x3c1f1494  A8      : 0x00000000  A9      : 0x00000000
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x60013000  A13     : 0x3fcc78bc
A14     : 0x00000001  A15     : 0x0000abab  SAR     : 0x0000000a  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff


Backtrace: 0x40379f69:0x3fc9c570 0x40377f31:0x3fc9c5b0 0x4037a76d:0x3fc9c5d0 0x4200d53a:0x3fcbca60 0x403807a6:0x3fcbca90
  #0  0x40379f69 in i2c_ll_read_rxfifo at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/hal/esp32s3/include/hal/i2c_ll.h:703
      (inlined by) i2c_isr_receive_handler at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_driver_i2c/i2c_master.c:676
      (inlined by) i2c_master_isr_handler_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_driver_i2c/i2c_master.c:714
  #1  0x3fc9c570 in _xt_exception_table at ??:?
  #2  0x40377f31 in shared_intr_isr at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/intr_alloc.c:464
  #3  0x3fc9c5b0 in _xt_exception_table at ??:?
  #4  0x4037a76d in _xt_lowint1 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/xtensa/xtensa_vectors.S:1240
  #5  0x3fc9c5d0 in _xt_exception_table at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:67
  #6  0x4200d53a in inputTask(void*) at src/hardware/Input.hpp:173
  #7  0x403807a6 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@handmade0octopus handmade0octopus added the Status: Awaiting triage Issue is waiting for triage label May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant