From a2e3055d2d4d84577d4c9c95b2dc740a705d1bfd Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 26 Jun 2025 00:03:52 +1000 Subject: [PATCH] tests/extmod_hardware: Add UART config for STM32WB boards. Signed-off-by: Damien George --- tests/extmod_hardware/machine_uart_irq_rx.py | 11 ++++++++--- tests/extmod_hardware/machine_uart_irq_rxidle.py | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/extmod_hardware/machine_uart_irq_rx.py b/tests/extmod_hardware/machine_uart_irq_rx.py index ecc95e62a..3602c260e 100644 --- a/tests/extmod_hardware/machine_uart_irq_rx.py +++ b/tests/extmod_hardware/machine_uart_irq_rx.py @@ -24,9 +24,14 @@ elif "esp32" in sys.platform: tx_pin = 4 rx_pin = 5 elif "pyboard" in sys.platform: - uart_id = 4 - tx_pin = None # PA0 - rx_pin = None # PA1 + if "STM32WB" in sys.implementation._machine: + # LPUART(1) is on PA2/PA3 + uart_id = "LP1" + else: + # UART(4) is on PA0/PA1 + uart_id = 4 + tx_pin = None + rx_pin = None elif "samd" in sys.platform and "ItsyBitsy M0" in sys.implementation._machine: uart_id = 0 tx_pin = "D1" diff --git a/tests/extmod_hardware/machine_uart_irq_rxidle.py b/tests/extmod_hardware/machine_uart_irq_rxidle.py index af2412c75..634369150 100644 --- a/tests/extmod_hardware/machine_uart_irq_rxidle.py +++ b/tests/extmod_hardware/machine_uart_irq_rxidle.py @@ -26,9 +26,14 @@ elif "mimxrt" in sys.platform: uart_id = 1 tx_pin = None elif "pyboard" in sys.platform: - uart_id = 4 - tx_pin = None # PA0 - rx_pin = None # PA1 + if "STM32WB" in sys.implementation._machine: + # LPUART(1) is on PA2/PA3 + uart_id = "LP1" + else: + # UART(4) is on PA0/PA1 + uart_id = 4 + tx_pin = None + rx_pin = None elif "renesas-ra" in sys.platform: uart_id = 9 tx_pin = None # P602 @ RA6M2