From: Mikko Rasa Date: Sat, 18 May 2013 15:55:21 +0000 (+0300) Subject: Set UCSR0A in serial_init X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2658995b11690b4d54409eb066020aba17395680;p=model-railway-devices.git 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. --- 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); }