From 642be1c0c22fa098bc3d5a4d719f778bc2955cec Mon Sep 17 00:00:00 2001 From: agdl Date: Thu, 18 Oct 2018 23:33:02 +0200 Subject: [PATCH] Improved baud rate settings formula --- cores/arduino/UART.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/arduino/UART.cpp b/cores/arduino/UART.cpp index c8ef04dea..727ffc81c 100644 --- a/cores/arduino/UART.cpp +++ b/cores/arduino/UART.cpp @@ -197,7 +197,7 @@ void UartClass::begin(unsigned long baud, uint16_t config) int8_t sigrow_val = SIGROW.OSC16ERR5V; baud_setting *= (1024 + sigrow_val); - baud_setting /= 1024; + baud_setting /= (1024 - sigrow_val); // assign the baud_setting, a.k.a. BAUD (USART Baud Rate Register) (*_hwserial_module).BAUD = (int16_t) baud_setting;