esp32-s3 i2c failure in esp-idf 5.2
Posted: Tue Mar 05, 2024 2:25 am
Hi;
I recently upgraded my setup from esp-idf 5.1.2 to 5.2, and am trying to write a driver for a magnetic encoder that configures the chip via i2c. This code/driver runs fine on an esp32-c3 seeed module I have, but crashes the same way on two different esp32-s3 boards I've tried. I don't understand the error that's being offered. I am using:
and the problematic code is:
Specifically, the complaint is on the final line there, where I create a new i2c master bus.
I've tried specifying different pins for i2c, not sure what else to try to troubleshoot...
I recently upgraded my setup from esp-idf 5.1.2 to 5.2, and am trying to write a driver for a magnetic encoder that configures the chip via i2c. This code/driver runs fine on an esp32-c3 seeed module I have, but crashes the same way on two different esp32-s3 boards I've tried. I don't understand the error that's being offered. I am using:
Code: Select all
#include "driver/i2c_master.h"
Code: Select all
// Per these docs:
// https://docs.espressif.com/projects/esp-idf/en/v5.2/esp32/api-reference/peripherals/i2c.html#i2c_master_controller
// We are configuring the i2c master bus first.
i2c_master_bus_config_t i2c_master_config = {
.clk_source = I2C_CLK_SRC_DEFAULT,
.i2c_port = I2C_MASTER_PORT,
.scl_io_num = I2C_MASTER_SCL_IO, // SCL pin
.sda_io_num = I2C_MASTER_SDA_IO, // SCL pin
.glitch_ignore_cnt = 7, // a default from esp's docs
.flags.enable_internal_pullup = true,
};
i2c_master_bus_handle_t bus_handle;
i2c_new_master_bus(&i2c_master_config, &bus_handle);
Code: Select all
assert failed: xTaskRemoveFromEventList tasks.c:3826 (pxUnblockedTCB)
Backtrace: 0x403758e2:0x3fc9a2b0 0x40379ed1:0x3fc9a2d0 0x40380371:0x3fc9a2f0 0x4037bec2:0x3fc9a410 0x4037a744:0x3fc9a430 0x4037a7f6:0x3fc9a470 0x40376865:0x3fc9a490 0x40376945:0x3fc9a4c0 0x420082b3:0x3fc9a4e0 0x42006e61:0x3fc9a500 0x420069d2:0x3fc9a520 0x4200f77e:0x3fc9a540 0x4200ef4d:0x3fc9a560 0x4200efaa:0x3fc9a580 0x4200f5e9:0x3fc9a5b0 0x420136b7:0x3fc9a5e0 0x4201307a:0x3fc9a600 0x4200f7f5:0x3fc9a920 0x4201b565:0x3fc9a950 0x403800e5:0x3fc9a980 0x42009b8d:0x3fc9a9d0 0x4200b6fe:0x3fc9aa30 0x4200a925:0x3fc9aa90 0x4200ae88:0x3fc9aac0 0x4200834c:0x3fc9ab10 0x4037a8c1:0x3fc9ab60
0x403758e2: panic_abort at /Users/me/dev/github/esp-idf-v5.2/components/esp_system/panic.c:472
0x40379ed1: esp_system_abort at /Users/me/dev/github/esp-idf-v5.2/components/esp_system/port/esp_system_chip.c:93
0x40380371: __assert_func at /Users/me/dev/github/esp-idf-v5.2/components/newlib/assert.c:81
0x4037bec2: xTaskRemoveFromEventList at /Users/me/dev/github/esp-idf-v5.2/components/freertos/FreeRTOS-Kernel/tasks.c:3826 (discriminator 1)
0x4037a744: xQueueSemaphoreTake at /Users/me/dev/github/esp-idf-v5.2/components/freertos/FreeRTOS-Kernel/queue.c:1763
0x4037a7f6: xQueueTakeMutexRecursive at /Users/me/dev/github/esp-idf-v5.2/components/freertos/FreeRTOS-Kernel/queue.c:835
0x40376865: lock_acquire_generic at /Users/me/dev/github/esp-idf-v5.2/components/newlib/locks.c:144
0x40376945: _lock_acquire_recursive at /Users/me/dev/github/esp-idf-v5.2/components/newlib/locks.c:158
0x420082b3: uart_write at /Users/me/dev/github/esp-idf-v5.2/components/vfs/vfs_uart.c:209
0x42006e61: console_write at /Users/me/dev/github/esp-idf-v5.2/components/vfs/vfs_console.c:73 (discriminator 1)
0x420069d2: esp_vfs_write at /Users/me/dev/github/esp-idf-v5.2/components/vfs/vfs.c:482 (discriminator 4)
0x4200f77e: __swrite at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/stdio.c:94
0x4200ef4d: __sflush_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/fflush.c:224
0x4200efaa: _fflush_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/fflush.c:278
(inlined by) _fflush_r at /builds/idf/crosstool-NG/.build/src/newlib-git-af24ceb7/newlib/libc/include/stdio.h:417
0x4200f5e9: __sfvwrite_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/fvwrite.c:251
0x420136b7: __sprint_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/vfiprintf.c:429
(inlined by) __sprint_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/vfprintf.c:399
0x4201307a: _vfprintf_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/vfprintf.c:1774 (discriminator 1)
0x4200f7f5: vprintf at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin21.1/xtensa-esp-elf/src/newlib/newlib/libc/stdio/vprintf.c:34
0x4201b565: esp_log_writev at /Users/me/dev/github/esp-idf-v5.2/components/log/log.c:215
0x403800e5: esp_log_write at /Users/me/dev/github/esp-idf-v5.2/components/log/log.c:225
0x42009b8d: gpio_config at /Users/me/dev/github/esp-idf-v5.2/components/driver/gpio/gpio.c:408 (discriminator 1)
0x4200b6fe: i2c_common_set_pins at /Users/me/dev/github/esp-idf-v5.2/components/driver/i2c/i2c_common.c:235
0x4200a925: i2c_param_master_config at /Users/me/dev/github/esp-idf-v5.2/components/driver/i2c/i2c_master.c:642
0x4200ae88: i2c_new_master_bus at /Users/me/dev/github/esp-idf-v5.2/components/driver/i2c/i2c_master.c:799
0x4200834c: i2c_scan_task at /Users/me/dev/esp/i2c-scan/main/i2c-scan.c:62
0x4037a8c1: vPortTaskWrapper at /Users/me/dev/github/esp-idf-v5.2/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134