mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
Merge branch 'fix/twai_test_and_readme' into 'master'
fix(driver_twai): readme doc and pytest script correct Closes IDFGH-17354 and IDFCI-3117 See merge request espressif/esp-idf!46728
This commit is contained in:
@@ -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
|
||||
```
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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 ...')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user