diff --git a/Devices/waveshare-esp32-s3-rlcd/Source/Configuration.cpp b/Devices/waveshare-esp32-s3-rlcd/Source/Configuration.cpp index 3cbf0dae..d943d5f1 100644 --- a/Devices/waveshare-esp32-s3-rlcd/Source/Configuration.cpp +++ b/Devices/waveshare-esp32-s3-rlcd/Source/Configuration.cpp @@ -9,6 +9,8 @@ #include #include +#include +#include using namespace tt::hal; @@ -61,12 +63,23 @@ static bool initBoot() { // Drive HIGH to enable the speaker amplifier gpio_set_level(GPIO_NUM_46, 1); - // 2. Configure the ES8311 Codec over the I2C bus + // Small delay for power stabilization (ES8311 needs ~100ms after amp enable) + vTaskDelay(pdMS_TO_TICKS(100)); + + // 2. Configure the ES8311 Codec over the I2C bus — non-blocking, probe first + // I2C0 now uses esp32-i2c-master driver (no CONFLICT) auto* i2c_bus = device_find_by_name("i2c0"); if (i2c_bus != nullptr) { - error_t error = initCodec(i2c_bus); - if (error != ERROR_NONE) { - LOG_E(TAG, "Failed to initialize ES8311 codec: %s", error_to_string(error)); + // Probe if ES8311 is present before full init to avoid bus lock + if (i2c_controller_has_device_at_address(i2c_bus, ES8311_I2C_ADDR, pdMS_TO_TICKS(200)) == ERROR_NONE) { + error_t error = initCodec(i2c_bus); + if (error != ERROR_NONE) { + LOG_E(TAG, "Failed to initialize ES8311 codec: %s (non-fatal, continuing)", error_to_string(error)); + } else { + LOG_I(TAG, "ES8311 codec initialized"); + } + } else { + LOG_W(TAG, "ES8311 not found at 0x%02x, skipping codec init (audio disabled)", ES8311_I2C_ADDR); } } else { LOG_E(TAG, "i2c0 bus not found, skipping ES8311 initialization"); diff --git a/Devices/waveshare-esp32-s3-rlcd/waveshare,esp32-s3-rlcd.dts b/Devices/waveshare-esp32-s3-rlcd/waveshare,esp32-s3-rlcd.dts index a1dbeb4d..1ce44a0b 100644 --- a/Devices/waveshare-esp32-s3-rlcd/waveshare,esp32-s3-rlcd.dts +++ b/Devices/waveshare-esp32-s3-rlcd/waveshare,esp32-s3-rlcd.dts @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -35,7 +35,7 @@ }; i2c0 { - compatible = "espressif,esp32-i2c"; + compatible = "espressif,esp32-i2c-master"; port = ; clock-frequency = <400000>; pin-sda = <&gpio0 13 GPIO_FLAG_NONE>; diff --git a/Drivers/ST7305/Source/St7305Display.cpp b/Drivers/ST7305/Source/St7305Display.cpp index b9c3b058..e73a4973 100644 --- a/Drivers/ST7305/Source/St7305Display.cpp +++ b/Drivers/ST7305/Source/St7305Display.cpp @@ -57,15 +57,18 @@ bool St7305Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc return false; } + // ST7305 needs extra delay after reset before init — prevents freeze on fast boot if (esp_lcd_panel_reset(panelHandle) != ESP_OK) { LOGGER.error("Failed to reset st7305 panel"); return false; } + vTaskDelay(pdMS_TO_TICKS(150)); if (esp_lcd_panel_init(panelHandle) != ESP_OK) { LOGGER.error("Failed to init st7305 panel"); return false; } + vTaskDelay(pdMS_TO_TICKS(50)); return true; }