Skip to content

Commit c872128

Browse files
committed
Restore +1 in baud divider calculation
1 parent fe2b7e7 commit c872128

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/UART.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void UartClass::begin(unsigned long baud, uint16_t config)
142142
uint8_t oldSREG = SREG;
143143
cli();
144144

145-
baud_setting = (((8 * F_CPU_CORRECTED) / baud) ) / 2;
145+
baud_setting = (((8 * F_CPU_CORRECTED) / baud) + 1) / 2;
146146
// Disable CLK2X
147147
(*_hwserial_module).CTRLB &= (~USART_RXMODE_CLK2X_gc);
148148
(*_hwserial_module).CTRLB |= USART_RXMODE_NORMAL_gc;

0 commit comments

Comments
 (0)