From 2658995b11690b4d54409eb066020aba17395680 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 18 May 2013 18:55:21 +0300 Subject: [PATCH] Set UCSR0A in serial_init It contains the U2X0 bit, which must be cleared to get the desired bitrate. Some versions of the Arduino bootloader appear to leave it set. --- common/serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/serial.c b/common/serial.c index 2bf6901..a5e5cae 100644 --- a/common/serial.c +++ b/common/serial.c @@ -11,6 +11,7 @@ void serial_init(uint16_t baud) baud = (F_CPU/16+baud/2)/baud-1; UBRR0H = baud>>8; UBRR0L = baud; + UCSR0A = 0; UCSR0C = BIT(UCSZ00) | BIT(UCSZ01); // 8N1 UCSR0B = BIT(RXEN0) | BIT(TXEN0) | BIT(RXCIE0); } -- 2.43.0