diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 917c5831a3..b3ca01e30e 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -199,6 +199,22 @@ example_test_pytest_esp32_wifi_two_dut: - build_pytest_examples_esp32 tags: [ esp32, wifi_two_dut ] +example_test_pytest_esp32c3eco7_wifi_two_dut: + extends: + - .pytest_examples_dir_template + - .rules:test:example_test-esp32c3-wifi + needs: + - build_pytest_examples_esp32c3 + tags: [ esp32c3eco7, wifi_two_dut ] + +example_test_pytest_esp32c2eco4_wifi_two_dut: + extends: + - .pytest_examples_dir_template + - .rules:test:example_test-esp32c2-wifi + needs: + - build_pytest_examples_esp32c2 + tags: [ esp32c2eco4, wifi_two_dut, xtal_26mhz] + example_test_pytest_esp32c3_flash_encryption: extends: - .pytest_examples_dir_template diff --git a/examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c2eco4_xtal26m b/examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c2eco4_xtal26m new file mode 100644 index 0000000000..14abf63b86 --- /dev/null +++ b/examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c2eco4_xtal26m @@ -0,0 +1,6 @@ +CONFIG_IDF_TARGET="esp32c2" +CONFIG_XTAL_FREQ_26=y +CONFIG_ESP32C2_REV_MIN_200=y + +CONFIG_EXAMPLE_USE_CI_ADDRESS=y +CONFIG_EXAMPLE_PEER_ADDR="${CI_PIPELINE_ID}" diff --git a/examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c3eco7 b/examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c3eco7 new file mode 100644 index 0000000000..bfdd97290d --- /dev/null +++ b/examples/bluetooth/nimble/blecent/sdkconfig.ci.esp32c3eco7 @@ -0,0 +1,12 @@ +CONFIG_IDF_TARGET="esp32c3" +CONFIG_ESP32C3_REV_MIN_101=y + +# +# BT config +# +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BT_BLUEDROID_ENABLED=n +CONFIG_BT_NIMBLE_ENABLED=y diff --git a/examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c2eco4_xtal26m b/examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c2eco4_xtal26m new file mode 100644 index 0000000000..bdbb290cac --- /dev/null +++ b/examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c2eco4_xtal26m @@ -0,0 +1,8 @@ +CONFIG_IDF_TARGET="esp32c2" +CONFIG_XTAL_FREQ_26=y +CONFIG_ESP32C2_REV_MIN_200=y +# +# Test Config +# +CONFIG_EXAMPLE_USE_CI_ADDRESS=y +CONFIG_EXAMPLE_CI_ADDRESS_OFFSET="${CI_PIPELINE_ID}" diff --git a/examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c3eco7 b/examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c3eco7 new file mode 100644 index 0000000000..2e43231011 --- /dev/null +++ b/examples/bluetooth/nimble/power_save/sdkconfig.ci.esp32c3eco7 @@ -0,0 +1,14 @@ +CONFIG_IDF_TARGET="esp32c3" +CONFIG_ESP32C3_REV_MIN_101=y + + +# MODEM SLEEP Options +CONFIG_BT_CTRL_MODEM_SLEEP=y +CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y +# Bluetooth low power clock +CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y +# Power up main XTAL during light sleep +CONFIG_BT_CTRL_MAIN_XTAL_PU_DURING_LIGHT_SLEEP=y + +# Enable power down of MAC and baseband in light sleep mode +CONFIG_ESP_PHY_MAC_BB_PD=y diff --git a/examples/bluetooth/nimble/pytest_nimble_test.py b/examples/bluetooth/nimble/pytest_nimble_test.py index 378d6cff43..425504bde7 100644 --- a/examples/bluetooth/nimble/pytest_nimble_test.py +++ b/examples/bluetooth/nimble/pytest_nimble_test.py @@ -1,6 +1,5 @@ -# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 - import os.path from typing import Tuple @@ -40,7 +39,7 @@ def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: @pytest.mark.wifi_two_dut @pytest.mark.xtal_26mhz @pytest.mark.parametrize( - 'config, count, app_path, baud', [ + 'config, count, app_path, baud, ', [ ('esp32c2_xtal26m', 2, f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', '74880'), @@ -51,6 +50,60 @@ def test_power_save_conn_esp32c2_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None: peripheral = dut[0] central = dut[1] + central.expect('Connection established', timeout=30) + peripheral.expect('connection established; status=0', timeout=30) + output = peripheral.expect(pexpect.TIMEOUT, timeout=30) + assert 'rst:' not in str(output) and 'boot:' not in str(output) + + +# Case 2: BLE power save test for ESP32C2ECO4 +@pytest.mark.wifi_two_dut +@pytest.mark.xtal_26mhz +@pytest.mark.esp32c2 +@pytest.mark.esp32c2eco4 +@pytest.mark.parametrize( + 'config, count, app_path, baud, target', + [ + ( + 'esp32c2eco4_xtal26m', + 2, + f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', + '74880', + 'esp32c2|esp32c2', + ), + ], + indirect=True, +) +def test_power_save_conn_esp32c2eco4(dut: Tuple[IdfDut, IdfDut]) -> None: + peripheral = dut[0] + central = dut[1] + + central.expect('Connection established', timeout=30) + peripheral.expect('connection established; status=0', timeout=30) + output = peripheral.expect(pexpect.TIMEOUT, timeout=30) + assert 'rst:' not in str(output) and 'boot:' not in str(output) + + +# Case 2: BLE power save test for ESP32C3ECO7 +@pytest.mark.esp32c3 +@pytest.mark.wifi_two_dut +@pytest.mark.esp32c3eco7 +@pytest.mark.parametrize( + 'config, count, app_path, target', + [ + ( + 'esp32c3eco7', + 2, + f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', + 'esp32c3|esp32c3', + ), + ], + indirect=True, +) +def test_power_save_conn_esp32c3eco7(dut: Tuple[IdfDut, IdfDut]) -> None: + peripheral = dut[0] + central = dut[1] + peripheral.expect('NimBLE_BLE_PRPH: BLE Host Task Started', timeout=5) central.expect('NimBLE_BLE_CENT: BLE Host Task Started', timeout=5) peripheral.expect('Returned from app_main()', timeout=5) diff --git a/examples/wifi/.build-test-rules.yml b/examples/wifi/.build-test-rules.yml index 866ec74d2b..bbc7bc2bce 100644 --- a/examples/wifi/.build-test-rules.yml +++ b/examples/wifi/.build-test-rules.yml @@ -7,9 +7,9 @@ examples/wifi/ftm: examples/wifi/getting_started: disable_test: - - if: IDF_TARGET != "esp32" + - if: IDF_TARGET in ["esp32s2", "esp32s3"] temporary: true - reason: lack of runners + reason: lack of runners for other chips examples/wifi/iperf: disable_test: diff --git a/examples/wifi/getting_started/pytest_wifi_getting_started.py b/examples/wifi/getting_started/pytest_wifi_getting_started.py index 5e095d27dc..9f5697c93f 100644 --- a/examples/wifi/getting_started/pytest_wifi_getting_started.py +++ b/examples/wifi/getting_started/pytest_wifi_getting_started.py @@ -1,6 +1,5 @@ -# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 - import os.path from typing import Tuple @@ -22,6 +21,8 @@ from pytest_embedded_idf.dut import IdfDut @pytest.mark.esp32 +@pytest.mark.esp32c2 +@pytest.mark.esp32c3 @pytest.mark.wifi_two_dut @pytest.mark.parametrize( 'count, app_path', [ @@ -42,3 +43,65 @@ def test_wifi_getting_started(dut: Tuple[IdfDut, IdfDut]) -> None: station.expect(f'{tag}: got ip:', timeout=60) station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60) softap.expect('station .+ join, AID=', timeout=60) + + +@pytest.mark.esp32c2 +@pytest.mark.esp32c2eco4 +@pytest.mark.xtal_26mhz +@pytest.mark.wifi_two_dut +@pytest.mark.parametrize( + 'config, baud, app_path, count, target', + [ + ( + 'esp32c2eco4_xtal26m', + '74880', + f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}', + 2, + 'esp32c2|esp32c2', + ), + ], + indirect=True, +) +def test_wifi_getting_started_esp32c2eco4_xtal_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None: + softap = dut[0] + station = dut[1] + + ssid = softap.app.sdkconfig.get('ESP_WIFI_SSID') + password = softap.app.sdkconfig.get('ESP_WIFI_PASSWORD') + assert station.app.sdkconfig.get('ESP_WIFI_SSID') == ssid + assert station.app.sdkconfig.get('ESP_WIFI_PASSWORD') == password + + tag = 'wifi station' + station.expect(f'{tag}: got ip:', timeout=60) + station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60) + softap.expect('station .+ join, AID=', timeout=60) + + +@pytest.mark.esp32c3 +@pytest.mark.esp32c3eco7 +@pytest.mark.wifi_two_dut +@pytest.mark.parametrize( + 'config, app_path, count, target', + [ + ( + 'esp32c3eco7', + f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}', + 2, + 'esp32c3|esp32c3', + ), + ], + indirect=True, +) +def test_wifi_getting_started_esp32c3eco7(dut: Tuple[IdfDut, IdfDut]) -> None: + softap = dut[0] + station = dut[1] + + ssid = softap.app.sdkconfig.get('ESP_WIFI_SSID') + password = softap.app.sdkconfig.get('ESP_WIFI_PASSWORD') + assert station.app.sdkconfig.get('ESP_WIFI_SSID') == ssid + assert station.app.sdkconfig.get('ESP_WIFI_PASSWORD') == password + + tag = 'wifi station' + station.expect(f'{tag}: got ip:', timeout=60) + station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60) + softap.expect('station .+ join, AID=', timeout=60) diff --git a/examples/wifi/getting_started/softAP/sdkconfig.ci.esp32c2eco4_xtal26m b/examples/wifi/getting_started/softAP/sdkconfig.ci.esp32c2eco4_xtal26m new file mode 100644 index 0000000000..651a6cc578 --- /dev/null +++ b/examples/wifi/getting_started/softAP/sdkconfig.ci.esp32c2eco4_xtal26m @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32c2" +CONFIG_XTAL_FREQ_26=y +CONFIG_ESP32C2_REV_MIN_200=y diff --git a/examples/wifi/getting_started/softAP/sdkconfig.ci.esp32c3eco7 b/examples/wifi/getting_started/softAP/sdkconfig.ci.esp32c3eco7 new file mode 100644 index 0000000000..ad055155c9 --- /dev/null +++ b/examples/wifi/getting_started/softAP/sdkconfig.ci.esp32c3eco7 @@ -0,0 +1,2 @@ +CONFIG_IDF_TARGET="esp32c3" +CONFIG_ESP32C3_REV_MIN_101=y diff --git a/examples/wifi/getting_started/station/sdkconfig.ci.esp32c2eco4_xtal26m b/examples/wifi/getting_started/station/sdkconfig.ci.esp32c2eco4_xtal26m new file mode 100644 index 0000000000..651a6cc578 --- /dev/null +++ b/examples/wifi/getting_started/station/sdkconfig.ci.esp32c2eco4_xtal26m @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32c2" +CONFIG_XTAL_FREQ_26=y +CONFIG_ESP32C2_REV_MIN_200=y diff --git a/examples/wifi/getting_started/station/sdkconfig.ci.esp32c3eco7 b/examples/wifi/getting_started/station/sdkconfig.ci.esp32c3eco7 new file mode 100644 index 0000000000..ad055155c9 --- /dev/null +++ b/examples/wifi/getting_started/station/sdkconfig.ci.esp32c3eco7 @@ -0,0 +1,2 @@ +CONFIG_IDF_TARGET="esp32c3" +CONFIG_ESP32C3_REV_MIN_101=y diff --git a/pytest.ini b/pytest.ini index 9b6594c97e..b604e06d36 100644 --- a/pytest.ini +++ b/pytest.ini @@ -63,6 +63,8 @@ markers = MSPI_F4R8: runner with Quad Flash and Octal PSRAM MSPI_F4R4: runner with Quad Flash and Quad PSRAM adc: ADC related tests should run on adc runners + esp32c3eco7: esp32c3 major version(v1.1) chips + esp32c2eco4: esp32c2 major version(v2.0) chips # multi-dut markers wifi_two_dut: tests should be run on runners which has two wifi duts connected.