#17690·esp-idf

Interrupt watchdog timeout in i2c_master_cmd_begin (IDF 5.4.2 and 5.5.1) (IDFGH-16572)

Author: matharmanCreated Oct 3, 2025Updated Sep 30, 2026
LabelsType: BugStatus: Opened

Answers checklist.

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

IDF version.

v5.5.1

Espressif SoC revision.

ESP32-D0WD

Operating System used.

Linux

How did you build your project?

Command line with idf.py

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

None

Development Kit.

N/A

Power Supply used.

Battery

What is the expected behavior?

Interrupt watchdog timeout should not fire, even if I2C bus transactions would time out.

What is the actual behavior?

Some I2C bus transactions result in interrupt watchdog timeout.

Steps to reproduce.

Unknown. We have not reproduced this on the bench yet.

The i2c_read_bytes function and relevant macros+globals are extracted below:

c
#define AXP_SEMAPHORE_WAIT_TIME   1000

#define I2C_MASTER_NUM            ((i2c_port_t) CONFIG_I2C_MASTER_PORT_NUM)
#define I2C_MASTER_FREQ_HZ        CONFIG_I2C_MASTER_FREQUENCY /*!< I2C master clock frequency */
#define I2C_MASTER_SDA_IO         ((gpio_num_t) CONFIG_PMU_I2C_SDA)
#define I2C_MASTER_SCL_IO         ((gpio_num_t) CONFIG_PMU_I2C_SCL)

#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */
#define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */
#define I2C_MASTER_TIMEOUT_MS     1000

#define WRITE_BIT                 I2C_MASTER_WRITE       /*!< I2C master write */
#define READ_BIT                  I2C_MASTER_READ        /*!< I2C master read */
#define ACK_CHECK_EN              0x1                    /*!< I2C master will check ack from slave*/
#define ACK_CHECK_DIS             0x0                    /*!< I2C master will not check ack from slave */
#define ACK_VAL                   ((i2c_ack_type_t) 0x0) /*!< I2C ack value */
#define NACK_VAL                  ((i2c_ack_type_t) 0x1) /*!< I2C nack value */

//  A mutex to provide mutual exclusion for PMU operations
static StaticSemaphore_t memI2CMutex;
static SemaphoreHandle_t i2cMutexHdl;


esp_err_t i2c_read_bytes(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint8_t len)
{
    esp_err_t ret = ESP_FAIL;
    i2c_cmd_handle_t cmd;

    if (len == 0) {
        ret = ESP_OK;
        goto DONE_NO_MUTEX;
    }
    if (data == NULL) {
        ESP_LOGE(TAG, "NULL reference on i2c read");
        goto DONE_NO_MUTEX;
    }
    if (!xSemaphoreTake(i2cMutexHdl, pdMS_TO_TICKS(AXP_SEMAPHORE_WAIT_TIME))) {
        ESP_LOGE(TAG, "Failed to take i2c mutex");
        goto DONE_NO_MUTEX;
    }

    cmd = i2c_cmd_link_create();
    if (cmd == NULL) {
        ESP_LOGE(TAG, "Failed to allocate i2c read cmd link");
        goto DONE;
    }
    i2c_master_start(cmd);
    i2c_master_write_byte(cmd, (devAddr << 1) | WRITE_BIT, ACK_CHECK_EN);
    i2c_master_write_byte(cmd, regAddr, ACK_CHECK_EN);
    i2c_master_stop(cmd);
    ret = i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, pdMS_TO_TICKS(1000));
    i2c_cmd_link_delete(cmd);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "PMU i2c_master_cmd_begin FAILED");
        goto DONE;
    }
    cmd = i2c_cmd_link_create();
    if (cmd == NULL) {
        ESP_LOGE(TAG, "Failed to allocate i2c read cmd link");
        goto DONE;
    }
    i2c_master_start(cmd);
    i2c_master_write_byte(cmd, (devAddr << 1) | READ_BIT, ACK_CHECK_EN);
    if (len > 1) {
        i2c_master_read(cmd, data, len - 1, ACK_VAL);
    }
    i2c_master_read_byte(cmd, &data[len - 1], NACK_VAL);
    i2c_master_stop(cmd);
    ret = i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, pdMS_TO_TICKS(1000));
    i2c_cmd_link_delete(cmd);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "PMU READ FAILED");
    }
DONE:
    xSemaphoreGive(i2cMutexHdl);
DONE_NO_MUTEX:
    return ret == ESP_OK ? 0 : -1;
}

Debug Logs.

Backtrace. This is collected from remote field units using our own coredump-like feature.

plain
Previous boot panic (int_wdt) on core 0
boot time(us): 128689535257
reason: Interrupt wdt timeout on CPU0
description: unknown
Backtrace CPU0: 0x4008579F 0x4000BFED 0x40098732 0x40157287 0x40157BFE 0x401582DC 0x400FBC3D 0x401156B7 0x4011583F 0x400F30E4 0x400F8495 0x400DAFEA 0x401E9B0E 
0x4008579f: _xt_lowint1 at /opt/esp/idf/components/xtensa/xtensa_vectors.S:1240
0x40098732: 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:514
0x40157287: i2c_hw_disable at /opt/esp/idf/components/driver/i2c/i2c.c:266
0x40157bfe: i2c_hw_fsm_reset at /opt/esp/idf/components/driver/i2c/i2c.c:726
0x401582dc: i2c_master_cmd_begin at /opt/esp/idf/components/driver/i2c/i2c.c:1627
0x400fbc3d: i2c_read_bytes at /project/main/port_i2c.c:72
0x401156b7: a_ina219_iic_read at /project/components/ina219/driver_ina219.c:78
0x4011583f: ina219_set_mode at /project/components/ina219/driver_ina219.c:558
0x400f30e4: ina219_api_read at /project/main/ina219_api.c:261
0x400f8495: update_sys_data at /project/main/imported.cpp:912
0x400dafea: app_main at /project/main/main.cpp:547
0x401e9b0e: main_task at /opt/esp/idf/components/freertos/app_startup.c:208


Backtrace CPU1: 0x4009526B 0x400971BD 0x40098037 0x401EADD6 
0x4009526b: xt_utils_wait_for_intr at /opt/esp/idf/components/xtensa/include/xt_utils.h:82
 (inlined by) esp_cpu_wait_for_intr at /opt/esp/idf/components/esp_hw_support/cpu.c:55
0x400971bd: esp_pm_impl_waiti at /opt/esp/idf/components/esp_pm/pm_impl.c:1042
0x40098037: esp_vApplicationIdleHook at /opt/esp/idf/components/esp_system/freertos_hooks.c:56
0x401eadd6: prvIdleTask at /opt/esp/idf/components/freertos/FreeRTOS-Kernel/tasks.c:4350

We've been experiencing this since v5.4.x, but upon releasing a new firmware version running v5.5.1, the incidence has increased dramatically. We monitor reset causes across the fleet in 12 hour intervals and consistently about 1500 of 13000 (11.5%) units have experienced this in each interval. In 5.4.x, the rate was approx 3.8%.

There does not seem to be a consistency to the devices experiencing this, so we do not suspect hardware issues.

Diagnostic report archive.

Declining to provide due to sensitive source file names & etc. We are using the stock ESP IDF 5.5.1 docker image for building so there are no environment deviations.

The sdkconfig file has been provided for peripheral configurations and watchdog time outs.

sdkconfig.txt

More Information.

DISCLAIMER: though I checked the box that I have tested on the latest branch(es), I have not. This is because we have yet to reproduce this on the bench so, I cannot test with a build on a non-5.5.1 version. For the same reason, I do not have any scope or logic analyzer data of the buses. Still working towards this goal...


We are using a 16MB SPIRAM with no bank switching enabled. This is also why we continue to use the rev1 ESP32. Upgrading to a new revision is not possible.

On this I2C bus we have one PMIC and two INA219 sensors. The sensors have configurable address with some selection pins. One is configured to address 0b1000000 and one to address 0b1000001, so they are not conflicting with one another.

The SDA and SCL lines have 10kOhm pullups to 3.3V.

All I2C reads take place in the main task, so there should never be contention for the mutex there -- it is merely for future proofing / tasks deleted since previous app revisions.

We have captured other backtraces of the exact same I2C driver call flow when reading the PMIC, too, but I cannot provide these backtraces for sensitive information reasons.