From 500cc894b51f74f3c8b8d8d15a1bccab376645c0 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 11 Apr 2022 16:40:41 +0200 Subject: [PATCH] Fix USB CDC on ESP32C3 Fix USB CDC on ESP32C3 (https://github.com/espressif/arduino-esp32/issues/6264) --- tasmota/support_wifi.ino | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tasmota/support_wifi.ino b/tasmota/support_wifi.ino index d271de1cc..04d44e78b 100644 --- a/tasmota/support_wifi.ino +++ b/tasmota/support_wifi.ino @@ -116,7 +116,18 @@ void WifiConfig(uint8_t type) } } +#ifdef CONFIG_IDF_TARGET_ESP32C3 + // https://github.com/espressif/arduino-esp32/issues/6264#issuecomment-1040147331 + // There's an include for this but it doesn't define the function if it doesn't think it needs it, so manually declare the function +extern "C" void phy_bbpll_en_usb(bool en); +#endif // CONFIG_IDF_TARGET_ESP32C3 + void WifiSetMode(WiFiMode_t wifi_mode) { +#ifdef CONFIG_IDF_TARGET_ESP32C3 + // https://github.com/espressif/arduino-esp32/issues/6264#issuecomment-1094376906 + // This brings the USB serial-jtag back to life. Suggest doing this immediately after wifi startup. + phy_bbpll_en_usb(true); +#endif // CONFIG_IDF_TARGET_ESP32C3 if (WiFi.getMode() == wifi_mode) { return; } if (wifi_mode != WIFI_OFF) {