I2C errors when mute is active during boot or OTA
Sometimes when mute is active during boot (or maybe it happens only during OTA), the following errors occur:
I (14:05:40.417) WILLOW/WAS: WebSocket connected
I (14:05:40.417) WILLOW/WAS: sending WAS hello
E (14:05:40.778) I2C_BUS: ./deps/esp-adf/components/esp_peripherals/driver/i2c_bus/i2c_bus.c:115 (i2c_bus_write_bytes):I2C
...
E (14:05:57.813) I2C_BUS: ./deps/esp-adf/components/esp_peripherals/driver/i2c_bus/i2c_bus.c:115 (i2c_bus_write_bytes):I2C Bus WriteReg Error
I (14:05:57.862) WILLOW/INPUT: unmute
E (14:05:57.875) DRV8311: es8311.c:487 (es8311_codec_init): es8311 initialize failed
E (14:05:57.875) AUDIO_HAL: codec init failed!
E (14:05:57.877) AUDIO_BOARD: board.c:66 (audio_board_codec_init): Got NULL Pointer
E (14:05:57.886) AUDIO_HAL: audio_hal handle is null
I (14:05:57.891) WILLOW/AUDIO: audio_hal_ctrl_codec: ESP_FAIL
----------------------------- ESP Audio Platform -----------------------------
| |
| ESP_AUDIO-v1.8.0-017893b-9815982 |
| Compile date: Aug 15 2024-04:10:00 |
------------------------------------------------------------------------------
I (14:05:57.934) WILLOW/AUDIO: audio player initialized
E (14:05:57.939) AUDIO_HAL: audio_hal handle is null
I suspect this is introduced by 2fa6c6c413897757da054f7447b4e8e451d6b87b. Reverting 20780c45c614aaba985409f6a266b81e0ab89ce3 fixes it, but then #319 is a problem again.
The problem still occurs after 50904ea9c49fe4764aea9c1951619c77303ca557 which uses the new i2c_master driver. The log output is completely different:
E (12:14:14.248) i2c.master: I2C transaction timeout detected
E (12:14:14.249) i2c.master: s_i2c_synchronous_transaction(892): I2C transaction failed
E (12:14:14.255) i2c.master: i2c_master_transmit(1133): I2C transaction failed
...
E (12:14:14.795) i2c.master: I2C transaction timeout detected
E (12:14:14.795) i2c.master: s_i2c_synchronous_transaction(892): I2C transaction failed
E (12:14:14.803) i2c.master: i2c_master_transmit(1133): I2C transaction failed
I (12:14:14.873) WILLOW/WAS: WebSocket connected
I (12:14:14.873) WILLOW/WAS: sending WAS hello
E (12:14:15.010) i2c.master: s_i2c_synchronous_transaction(892): I2C transaction failed
E (12:14:15.011) i2c.master: i2c_master_transmit(1133): I2C transaction failed
...
I (12:14:21.723) WILLOW/AUDIO: audio_hal_ctrl_codec: ESP_OK
What's interesting is that now audio_hal_ctrl_codec does not return ESP_FAIL, so the WAS locate command works, with sound. The log spam is far from ideal though.
When calling init_lvgl_touch() before init_audio() in main.c, it seems the I2C communication with the touch controller also fails:
I (12:20:39.709) WILLOW/LVGL: detected GT911 touch controller on address 0x5d
E (12:20:39.716) i2c.master: I2C transaction unexpected nack detected
E (12:20:39.722) i2c.master: s_i2c_synchronous_transaction(892): I2C transaction failed
E (12:20:39.731) i2c.master: i2c_master_transmit_receive(1156): I2C transaction failed
E (12:20:39.739) lcd_panel.io.i2c: panel_io_i2c_rx_buffer(140): i2c transaction failed
E (12:20:39.748) GT911: touch_gt911_read_cfg(388): GT911 read error!
E (12:20:39.755) GT911: esp_lcd_touch_new_i2c_gt911(159): GT911 init failed
E (12:20:39.763) GT911: Error (0x103)! Touch controller GT911 initialization failed!
E (12:20:39.771) WILLOW/LVGL: failed to initialize GT911 touch screen: ESP_ERR_INVALID_STATE
So the problem is not limited to the ES8311.
I've tried adding a i2c_master_bus_reset() at the end of init_i2c(), but that doesn't seem to help.