From cec0b5b2734f96f70d66eb4710d9764b13fbc870 Mon Sep 17 00:00:00 2001 From: Terrence Date: Thu, 10 Jul 2025 15:52:46 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E8=AF=AF=E5=88=B7xmini-c3?= =?UTF-8?q?=E5=9B=BA=E4=BB=B6=E5=AF=BC=E8=87=B4=E6=B0=B8=E4=B9=85=E6=80=A7?= =?UTF-8?q?=E6=8D=9F=E5=AE=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/boards/xmini-c3/xmini_c3_board.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main/boards/xmini-c3/xmini_c3_board.cc b/main/boards/xmini-c3/xmini_c3_board.cc index 886d1ee5..96933514 100644 --- a/main/boards/xmini-c3/xmini_c3_board.cc +++ b/main/boards/xmini-c3/xmini_c3_board.cc @@ -73,6 +73,14 @@ private: }, }; ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_cfg, &codec_i2c_bus_)); + + // Print I2C bus info + if (i2c_master_probe(codec_i2c_bus_, 0x18, 1000) != ESP_OK) { + while (true) { + ESP_LOGE(TAG, "Failed to probe I2C bus, please check if you have installed the correct firmware"); + vTaskDelay(1000 / portTICK_PERIOD_MS); + } + } } void InitializeSsd1306Display() { @@ -177,15 +185,16 @@ private: } public: - XminiC3Board() : boot_button_(BOOT_BUTTON_GPIO) { - // 把 ESP32C3 的 VDD SPI 引脚作为普通 GPIO 口使用 - esp_efuse_write_field_bit(ESP_EFUSE_VDD_SPI_AS_GPIO); - + XminiC3Board() : boot_button_(BOOT_BUTTON_GPIO) { InitializeCodecI2c(); InitializeSsd1306Display(); InitializeButtons(); InitializePowerSaveTimer(); InitializeTools(); + + // 避免使用错误的固件,把 EFUSE 操作放在最后 + // 把 ESP32C3 的 VDD SPI 引脚作为普通 GPIO 口使用 + esp_efuse_write_field_bit(ESP_EFUSE_VDD_SPI_AS_GPIO); } virtual Led* GetLed() override {