From 74ee9df48c0387a2b0cf2034e7e3694fa2b74e3e Mon Sep 17 00:00:00 2001 From: Sugar Glider Date: Mon, 17 Mar 2025 12:36:10 -0300 Subject: [PATCH] fix(uart): Fixes UART CI script to work with Arduino Core 3.2.x (#11077) * fix(uart): ci uart test fail on esp32s2 after uart break * fix(uart): ci error with change pins test on ESP32 * fix(uart): ci test with perimgr using esp32 fails * feat(uart): avoid electrical noise before setting pins * fix(uart_ci): fixes the UART CI sketch due to IDF 5.3 pull up change * fix(uart_ci): keeping previous formatting and applying changes * feat(uart_ci): trick for passing esp32 wokwi ci test Wokwi ESP32 fails with the pinMode() in line 56|58 Real device with Arduino Core 3.1.2 and 3.2 needs it to fix the issue. This patch will skip the pinMode() when compiling with Wokwi and make it pass the CI test case. * feat(uart_ci): reverting the wokwi patch, once it didn't make any difference * fix(wokwi): Change CPU freq to 80 * fix(wokwi): Change CPU freq to 120 * ci(pre-commit): Apply automatic fixes * fix(uart_ci): fixes a couple typos in commentatries --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: Me No Dev Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- tests/validation/uart/diagram.esp32.json | 2 +- tests/validation/uart/uart.ino | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/validation/uart/diagram.esp32.json b/tests/validation/uart/diagram.esp32.json index a31c06d83..c2fbd952f 100644 --- a/tests/validation/uart/diagram.esp32.json +++ b/tests/validation/uart/diagram.esp32.json @@ -6,7 +6,7 @@ { "type": "board-esp32-devkit-c-v4", "id": "esp", - "attrs": { "cpuFrequency": "40" } + "attrs": { "cpuFrequency": "120" } } ], "connections": [ diff --git a/tests/validation/uart/uart.ino b/tests/validation/uart/uart.ino index 358276c00..794fc9aff 100644 --- a/tests/validation/uart/uart.ino +++ b/tests/validation/uart/uart.ino @@ -53,6 +53,8 @@ public: : uart_num(num), serial(serial_ref), peeked_char(-1), default_rx_pin(rx_pin), default_tx_pin(tx_pin), recv_msg("") {} void begin(unsigned long baudrate) { + // pinMode will force enabling the internal pullup resistor (IDF 5.3.2 Change) + pinMode(default_rx_pin, INPUT_PULLUP); serial.begin(baudrate, SERIAL_8N1, default_rx_pin, default_tx_pin); while (!serial) { delay(10); @@ -365,6 +367,8 @@ void change_pins_test(void) { if (TEST_UART_NUM == 1) { UARTTestConfig &config = *uart_test_configs[0]; + // pinMode will force enabling the internal pullup resistor (IDF 5.3.2 Change) + pinMode(NEW_RX1, INPUT_PULLUP); config.serial.setPins(NEW_RX1, NEW_TX1); TEST_ASSERT_EQUAL(NEW_RX1, uart_get_RxPin(config.uart_num)); TEST_ASSERT_EQUAL(NEW_TX1, uart_get_TxPin(config.uart_num));