LyraT v4.3 crash using I2C adf + esp32-arduino Wire Library

rainerseck
Posts: 2
Joined: Thu Apr 08, 2021 3:44 pm

LyraT v4.3 crash using I2C adf + esp32-arduino Wire Library

Postby rainerseck » Thu Apr 08, 2021 3:52 pm

Hello,

there is an issue Using "Arduino wire library using I2C crashes the board LyraT Board V4.3 " .
I am using:
idf: v3.3.5-14-g7c8602753
adf: v2.2-92-g59e5e02
esp32-arduino: V1.06

I am using the arduino u8g2 library which communicate via I2C with a display:

a)
#define I2C_SCL 23
#define I2C_SDA 18
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE,I2C_SCL,I2C_SDA);

b)The call to u8g2.begin(); (which uses Wire) comes before call to
audio_board_handle_t board_handle = audio_board_init();

Then:

Crash in

audio_board_handle_t board_handle = audio_board_init();

I (4766) HTTP_MP3_WEBRADIO_PLAY: [ 1 ] Start audio codec chip
D:/esp32idf/esp-idf/components/esp_ringbuf/ringbuf.c:975 (xRingbufferReceiveUpToFromISR)- assert failed!
abort() was called at PC 0x4008afd3 on core 1
0x4008afd3: xRingbufferReceiveUpToFromISR at D:/esp32idf/esp-idf/components/esp_ringbuf/ringbuf.c:975 (discriminator 1)

ELF file SHA256: efb6c1b75581f6bc

Backtrace: 0x40089ecc:0x3ffbee10 0x4008a115:0x3ffbee30 0x4008afd3:0x3ffbee50 0x40088d9d:0x3ffbee80 0x4008384d:0x3ffbeeb0 0x4017bf93:0x3ffbc540 0x400d3de2:0x3ffbc560 0x4008d05d:0x3ffbc580 0x4008b4a6:0x3ffbc5a0
0x40089ecc: invoke_abort at D:/esp32idf/esp-idf/components/esp32/panic.c:715

0x4008a115: abort at D:/esp32idf/esp-idf/components/esp32/panic.c:715

0x4008afd3: xRingbufferReceiveUpToFromISR at D:/esp32idf/esp-idf/components/esp_ringbuf/ringbuf.c:975 (discriminator 1)

0x40088d9d: i2c_isr_handler_default at D:/esp32idf/esp-idf/components/driver/i2c.c:1134

0x4008384d: _xt_lowint1 at D:/esp32idf/esp-idf/components/freertos/xtensa_vectors.S:1154

0x4017bf93: esp_pm_impl_waiti at D:/esp32idf/esp-idf/components/esp32/pm_esp32.c:492

0x400d3de2: esp_vApplicationIdleHook at D:/esp32idf/esp-idf/components/esp32/freertos_hooks.c:108

0x4008d05d: prvIdleTask at D:/esp32idf/esp-idf/components/freertos/tasks.c:3507

0x4008b4a6: vPortTaskWrapper at D:/esp32idf/esp-idf/components/freertos/port.c:403

c) Deactivation u8g2 usage in my code no crash in audio_board_init();, rest works fine.

Do I oversee something?

Regards

Rainer

rainerseck
Posts: 2
Joined: Thu Apr 08, 2021 3:44 pm

Re: LyraT v4.3 crash using I2C adf + esp32-arduino Wire Library

Postby rainerseck » Sun Apr 11, 2021 2:02 pm

After further attempts I realized that the GPIOS IO23 and IO18 executed on J22 are already used by the ADF framework when initializing the I2S interface. Thus an independent use of the IO18 and IO23 is apparently not possible.

I tried to bypass the use of the IDF/ADF I2C/I2S driver by using the SlowSoftWire and SlowSoftI2CMaster libraries. The I2C protocol (master only) is emulated in the libraries via software and the SCL/SDA signals are generated by direct digital writing to the IO pins.

If you use IO14 and IO15 (JTAG connector) then this works fine for my purposes. For controlling I2C displays the low speed of the soft I2C realization is sufficient. The Lyrat v4.3 has no display.

If you try to use IO23 and IO18 then the ADF framework runs into I2S driver usage problems and crashes.

It is a pity that this I2C problem is not covered in the "ESP32-LyraT V4.3 Getting Started Guide".

Regards
Rainer

andiaa
Posts: 1
Joined: Tue Apr 20, 2021 10:37 am

Re: LyraT v4.3 crash using I2C adf + esp32-arduino Wire Library

Postby andiaa » Tue Apr 20, 2021 3:48 pm

Rainer,

I2S has nothing to do with I2C. The problem is, that the I2C Bus is already initialized by audio_board_init();.
The Audio Chip is also attached to the I2C Bus for communication with the ESP32.
So any attempt to initialize the Bus again with wire library will fail.

Basically it should be possible to attach another I2C Device to the Bus.
I'm trying to attach an I2C GPIO Expansion. For that I try to modify the VOIP Example. I have the same problems.
We have to find the I2C Bus initialization deep in the code and modify it for our needs.

Who is online

Users browsing this forum: No registered users and 13 guests