From 05faa941c29cff3c5c250be4b6079062c0189ed0 Mon Sep 17 00:00:00 2001 From: Peter Dragun Date: Mon, 16 Feb 2026 10:15:30 +0100 Subject: [PATCH 1/2] fix(esp32c5): Do not disable UART0 sclk when USB Serial/JTAG is primary console This is a workaround for rom code issue, which can cause the chip to end in infinite loop when reset is triggered from esptool/idf-monitor. This is only applicable to ESP32-C5 rev <= 1.0. Closes https://github.com/espressif/esp-idf/issues/18089 --- components/esp_system/port/soc/esp32c5/clk.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/esp_system/port/soc/esp32c5/clk.c b/components/esp_system/port/soc/esp32c5/clk.c index 04556907a63..f86a08fc4e3 100644 --- a/components/esp_system/port/soc/esp32c5/clk.c +++ b/components/esp_system/port/soc/esp32c5/clk.c @@ -253,5 +253,15 @@ __attribute__((weak)) void esp_perip_clk_init(void) clk_gate_config.disable_pvt_clk = true; #endif +#if defined(CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG) && CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG + /* ESP32-C5 rev <= 1.0: Do not disable UART0 sclk when USB Serial/JTAG is primary console. + * Disabling it would cause the chip to end in infinite loop on reset (workaround for rom code issue). + * See: IDFGH-17050 + */ + if (efuse_hal_chip_revision() <= 100) { + clk_gate_config.disable_uart0_clk = false; + } +#endif + periph_ll_clk_gate_set_default(rst_reason, &clk_gate_config); } From 69d8b42adf5873160778746e54314ca905566cc4 Mon Sep 17 00:00:00 2001 From: Peter Dragun Date: Mon, 16 Feb 2026 15:51:00 +0100 Subject: [PATCH 2/2] ci: enable esp32c5 for usb_serial_jtag tests --- .../test_apps/.build-test-rules.yml | 4 ++-- .../usb_serial_jtag/pytest_usb_serial_jtag.py | 10 +++++++--- .../usb_serial_jtag_vfs/pytest_usb_serial_jtag_vfs.py | 10 +++++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/components/esp_driver_usb_serial_jtag/test_apps/.build-test-rules.yml b/components/esp_driver_usb_serial_jtag/test_apps/.build-test-rules.yml index 14434dcd9c9..f91a716f8e9 100644 --- a/components/esp_driver_usb_serial_jtag/test_apps/.build-test-rules.yml +++ b/components/esp_driver_usb_serial_jtag/test_apps/.build-test-rules.yml @@ -7,7 +7,7 @@ components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag: temporary: true reason: p4 rev3 migration # TODO: IDF-14364 disable_test: - - if: IDF_TARGET in ["esp32c5", "esp32h4", "esp32h21", "esp32s31"] + - if: IDF_TARGET in ["esp32h4", "esp32h21", "esp32s31"] temporary: true reason: No runners. depends_components: @@ -25,7 +25,7 @@ components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag_vfs: temporary: true reason: p4 rev3 migration # TODO: IDF-14364 disable_test: - - if: IDF_TARGET in ["esp32c5", "esp32h4", "esp32h21", "esp32s31"] + - if: IDF_TARGET in ["esp32h4", "esp32h21", "esp32s31"] temporary: true reason: No runners. depends_components: diff --git a/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag/pytest_usb_serial_jtag.py b/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag/pytest_usb_serial_jtag.py index 85d10b69551..9e73cb98564 100644 --- a/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag/pytest_usb_serial_jtag.py +++ b/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag/pytest_usb_serial_jtag.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut @@ -13,7 +13,9 @@ from pytest_embedded_idf.utils import idf_parametrize ], indirect=True, ) -@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4'], indirect=['target']) +@idf_parametrize( + 'target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4', 'esp32c5'], indirect=['target'] +) @pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration') def test_usb_serial_jtag_dev(dut: Dut) -> None: # type: ignore dut.expect_exact('Press ENTER to see the list of tests') @@ -36,7 +38,9 @@ def test_usb_serial_jtag_dev(dut: Dut) -> None: # type: ignore ], indirect=True, ) -@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4'], indirect=['target']) +@idf_parametrize( + 'target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4', 'esp32c5'], indirect=['target'] +) @pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration') def test_usb_serial_jtag_rom_dev(dut: Dut) -> None: # type: ignore dut.expect_exact('Press ENTER to see the list of tests') diff --git a/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag_vfs/pytest_usb_serial_jtag_vfs.py b/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag_vfs/pytest_usb_serial_jtag_vfs.py index 3c5976309ed..6406c967e5a 100644 --- a/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag_vfs/pytest_usb_serial_jtag_vfs.py +++ b/components/esp_driver_usb_serial_jtag/test_apps/usb_serial_jtag_vfs/pytest_usb_serial_jtag_vfs.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut @@ -13,7 +13,9 @@ from pytest_embedded_idf.utils import idf_parametrize ], indirect=True, ) -@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4'], indirect=['target']) +@idf_parametrize( + 'target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4', 'esp32c5'], indirect=['target'] +) @pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration') def test_usj_vfs_select(dut: Dut) -> None: test_message = 'test123456789!@#%^&*' @@ -34,7 +36,9 @@ def test_usj_vfs_select(dut: Dut) -> None: ], indirect=True, ) -@idf_parametrize('target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4'], indirect=['target']) +@idf_parametrize( + 'target', ['esp32s3', 'esp32c3', 'esp32c6', 'esp32h2', 'esp32c61', 'esp32p4', 'esp32c5'], indirect=['target'] +) @pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='p4 rev3 migration') def test_usj_vfs_read_return(dut: Dut) -> None: test_message = '!(@*#&(!*@&#((SDasdkjhad\nce'