From ede39b61a86f845bef76c04535008b4741196d8c Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 14 Mar 2024 17:43:26 -0300 Subject: [PATCH] fix: UART0 boot pin setup UART0 pins are set by ROM Boot to default values. This must be reflected into Arduino HardwareSerial in order to allow it to correctly detach it and then attach it to something else. Summary: UART0 constructor sets default RX/TX pins as done in boot time. --- cores/esp32/HardwareSerial.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index adca2ffb6aa..efb974fe038 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -99,6 +99,8 @@ _eventTask(NULL) } } #endif + // do the same as boot time, that will set default UART0 pins RX, TX. + if(uart_nr == 0) uartSetPins(0, SOC_RX0, SOC_TX0, -1, -1); } HardwareSerial::~HardwareSerial()