From 9bcddb55c65256cae6cd4aca9da43e3ea84f9482 Mon Sep 17 00:00:00 2001 From: wanckl Date: Wed, 18 Mar 2026 11:50:35 +0800 Subject: [PATCH 1/2] fix(driver_twai): reamde doc correct Closes https://github.com/espressif/esp-idf/issues/18326 --- examples/peripherals/twai/twai_utils/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/peripherals/twai/twai_utils/README.md b/examples/peripherals/twai/twai_utils/README.md index 56c702b8cc..059b9a5273 100644 --- a/examples/peripherals/twai/twai_utils/README.md +++ b/examples/peripherals/twai/twai_utils/README.md @@ -34,7 +34,7 @@ ESP32 Pin Transceiver TWAI Bus --------- ----------- -------- GPIO4 (TX) --> CTX GPIO5 (RX) <-- CRX -3.3V --> VCC +3.3V/5V --> VCC GND --> GND TWAI_H <--> TWAI_H TWAI_L <--> TWAI_L From d757aa02f417e2496250074b19f216063d7bbdd9 Mon Sep 17 00:00:00 2001 From: wanckl Date: Wed, 18 Mar 2026 15:46:44 +0800 Subject: [PATCH 2/2] fix(driver_twai): test script update --- components/driver/test_apps/legacy_twai/README.md | 2 +- .../driver/test_apps/legacy_twai/pytest_twai.py | 2 +- .../test_apps/test_twai/pytest_driver_twai.py | 14 +++----------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/components/driver/test_apps/legacy_twai/README.md b/components/driver/test_apps/legacy_twai/README.md index 5edaa3c4ca..2c46f54aa0 100644 --- a/components/driver/test_apps/legacy_twai/README.md +++ b/components/driver/test_apps/legacy_twai/README.md @@ -4,5 +4,5 @@ # Enable Socket CAN Device with bitrate 250Kbps ```bash -sudo ip link set can0 up type can bitrate 250000 restart-ms 100 +sudo ip link set can0 up type can bitrate 250000 ``` diff --git a/components/driver/test_apps/legacy_twai/pytest_twai.py b/components/driver/test_apps/legacy_twai/pytest_twai.py index f8d4b70a7a..e0ab973e77 100644 --- a/components/driver/test_apps/legacy_twai/pytest_twai.py +++ b/components/driver/test_apps/legacy_twai/pytest_twai.py @@ -54,7 +54,7 @@ def esp_reset_and_wait_ready(dut: Dut) -> None: @pytest.fixture(name='socket_can') def fixture_create_socket_can() -> Bus: # Set up the socket CAN with the bitrate - start_command = 'sudo -n ip link set can0 up type can bitrate 250000 restart-ms 100' + start_command = 'sudo -n ip link set can0 up type can bitrate 250000' stop_command = 'sudo -n ip link set can0 down' status_command = 'sudo -n ip -details link show can0' diff --git a/components/esp_driver_twai/test_apps/test_twai/pytest_driver_twai.py b/components/esp_driver_twai/test_apps/test_twai/pytest_driver_twai.py index 62e945d92d..261a0e37a2 100644 --- a/components/esp_driver_twai/test_apps/test_twai/pytest_driver_twai.py +++ b/components/esp_driver_twai/test_apps/test_twai/pytest_driver_twai.py @@ -47,16 +47,10 @@ def esp_enter_flash_mode(dut: Dut) -> None: ser.setDTR(False) # Back RTS/DTR to 1/1 to avoid affect to esptool -def esp_reset_and_wait_ready(dut: Dut) -> None: - dut.serial.hard_reset() - time.sleep(0.5) - dut.expect_exact('Press ENTER to see the list of tests') - - @pytest.fixture(name='socket_can') def fixture_create_socket_can() -> Bus: # Set up the socket CAN with the bitrate - start_command = 'sudo -n ip link set can0 up type can bitrate 250000 restart-ms 100' + start_command = 'sudo -n ip link set can0 up type can bitrate 250000' stop_command = 'sudo -n ip link set can0 down' status_command = 'sudo -n ip -details link show can0' @@ -88,8 +82,7 @@ def fixture_create_socket_can() -> Bus: @pytest.mark.parametrize('config', ['release'], indirect=True) @idf_parametrize('target', soc_filtered_targets('SOC_TWAI_SUPPORTED == 1'), indirect=['target']) def test_driver_twai_listen_only(dut: Dut, socket_can: Bus) -> None: - esp_reset_and_wait_ready(dut) - + dut.expect_exact('Press ENTER to see the list of tests') dut.write('"twai_listen_only"') # wait the DUT to finish initialize @@ -110,8 +103,7 @@ def test_driver_twai_listen_only(dut: Dut, socket_can: Bus) -> None: @pytest.mark.parametrize('config', ['release'], indirect=True) @idf_parametrize('target', soc_filtered_targets('SOC_TWAI_SUPPORTED == 1'), indirect=['target']) def test_driver_twai_remote_request(dut: Dut, socket_can: Bus) -> None: - esp_reset_and_wait_ready(dut) - + dut.expect_exact('Press ENTER to see the list of tests') dut.write('"twai_remote_request"') print('Waiting remote frame ...')