esp-idf icon indicating copy to clipboard operation
esp-idf copied to clipboard

Store access fault I2C Master (IDFGH-17073)

Open simoberny opened this issue 1 month ago • 2 comments

Answers checklist.

  • [x] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • [x] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • [x] I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

5.5.1

Espressif SoC revision.

ESP32-P4 (revision v1.3)

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

Custom board

Power Supply used.

USB

What is the expected behavior?

I'm working on a custom board with ESP32P4 + C6, and I'm communicating as a master with another custom device via I2C. The communication pattern is WRITE + READ to verify that the values ​​have been written correctly. This means that two writes and one read are occurring during communication. For the read I need the STOP condition so I'm using i2c_master_transmit + i2c_master_receive. Monitoring the communication with the oscilloscope, everything seems fine.

We wanted to heavily stress the communication to identify any possible issue. We're already seeing a good error rate of 10^-5, and the errors themselves aren't a problem. But we've found that when there are a lot of consecutive communication errors, the board sometimes reboots due to a Store access fault, and we'd like to avoid this situation.

What is the actual behavior?

During the stress phase, using very tight timings (or none), thus writing and reading in a loop, errors occasionally appear on the bus. As noted above, this isn't a problem, to test purpose I'm causing the error grounding the SCL at runtime. The problem is that after a series of errors (and apparently only once it resumes communicating correctly), the ESP crashes and restarts with the stack trace below indicating a Store access fault.

Normally I also save the coredump to flash, but in this case it is empty because it indicates that the crash occurred in the context of an ISR interrupt.

The current timings are: LOOP -> write slave -> 1ms (tick) -> write for reading -> 1ms (tick) -> read slave -> LOOP

The writing phase consist in writing a packet of 13 byte and reading 14byte.

If I add delays in case of an error in one of the phase above, or if I add a small delay of 2ms between the writing, the situation improves dramatically and I get no fault.

I mean... I know I can go slower, it is just stress test, but I wonder if it is a symptom of some bug within the library or some problem in error handling.

Steps to reproduce.

  1. Stress test a communication with 13 byte packet + 14byte read with a slave device
  2. Force error in the communication, like grounding the SCL
  3. Observe the ESP restarting by store access fault

Debug Logs.

E (30485) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30485) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (30546) i2c.master: clear bus failed.
E (30546) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30546) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30552) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
E (30617) i2c.master: clear bus failed.
E (30617) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30617) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30623) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (30688) i2c.master: clear bus failed.
E (30688) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30688) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30694) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
E (30760) i2c.master: clear bus failed.
E (30760) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30760) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30766) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (30833) i2c.master: clear bus failed.
E (30833) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30833) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30839) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
E (30904) i2c.master: clear bus failed.
E (30904) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30904) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30910) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (30978) i2c.master: clear bus failed.
E (30978) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (30978) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (30984) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
E (31049) i2c.master: clear bus failed.
E (31049) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (31049) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (31055) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (31569) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (31569) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
E (31631) i2c.master: clear bus failed.
E (31631) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (31631) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (31637) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (31702) i2c.master: clear bus failed.
E (31702) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (31702) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (31708) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
E (31774) i2c.master: clear bus failed.
E (31774) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (31774) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (31780) i2c.master: i2c_master_transmit_receive(1248): I2C transaction failed
E (31845) i2c.master: clear bus failed.
E (31845) i2c.master: s_i2c_transaction_start(617): reset hardware failed
E (31845) i2c.master: s_i2c_synchronous_transaction(945): I2C transaction failed
E (31851) i2c.master: i2c_master_multi_buffer_transmit(1214): I2C transaction failed
Guru Meditation Error: Core  0 panic'ed (Store access fault). Exception was unhandled.

Core  0 register dump:
MEPC    : 0x4ff03ac0  RA      : 0x4ff03a92  SP      : 0x4ff1c450  GP      : 0x4ff18400
--- 0x4ff03ac0: i2c_ll_read_rxfifo at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/hal/esp32p4/include/hal/i2c_ll.h:684
--- (inlined by) i2c_isr_receive_handler at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/esp_driver_i2c/i2c_master.c:696
--- (inlined by) i2c_master_isr_handler_default at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/esp_driver_i2c/i2c_master.c:735
--- 0x4ff03a92: i2c_isr_receive_handler at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/esp_driver_i2c/i2c_master.c:693
--- (inlined by) i2c_master_isr_handler_default at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/esp_driver_i2c/i2c_master.c:735
TP      : 0x4ff35240  T0      : 0x00000fff  T1      : 0x00000002  T2      : 0x00000000
S0/FP   : 0x4ff35290  S1      : 0x4ff352b4  A0      : 0x00000000  A1      : 0x00000000
A2      : 0x500c5000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x4821c460
A6      : 0x00000004  A7      : 0x00001c00  S2      : 0x4ff355b4  S3      : 0x4ff355b4
S4      : 0x00000000  S5      : 0x4ff355c4  S6      : 0x4ff20000  S7      : 0x0000000f
S8      : 0x4ff20000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000
T3      : 0x00000000  T4      : 0x4ff3eeac  T5      : 0x00001800  T6      : 0x00000000
MSTATUS : 0x00001880  MTVEC   : 0x4ff00003  MCAUSE  : 0x00000007  MTVAL   : 0x4821c460
--- 0x4ff00003: _vector_table at ??:?
MHARTID : 0x00000000

Stack memory:
4ff1c450: 0x00000000 0xb8000012 0x4ff2c358 0x00000000 0x00000000 0x00000000 0x00000000 0x4ff0bf7a
--- 0x4ff0bf7a: SysTickIsrHandler at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/freertos/port_systick.c:149
4ff1c470: 0x00001880 0x4ff355c4 0x00000000 0x4ff35734 0x00001880 0xb8000010 0x4ff3390c 0x4ff00b6e
--- 0x4ff00b6e: shared_intr_isr at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/esp_hw_support/intr_alloc.c:478
4ff1c490: 0x00001880 0xb8000010 0x00000000 0x4ff002d0 0x00000000 0x00000000 0x00000000 0x00000000
--- 0x4ff002d0: _interrupt_handler at C:/Users/simone.bernabe/esp/v5.5.1/esp-idf/components/riscv/vectors.S:460

Diagnostic report archive.

idf-diag-e53c9706-0a68-4d75-a940-34e2aaa59302.zip

More Information.

Using #include "driver/i2c_master.h"

simoberny avatar Jan 09 '26 09:01 simoberny