aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2014-05-30 19:48:19 +1000
committerDean Camera <dean@fourwalledcubicle.com>2014-05-30 19:48:19 +1000
commit1b93c85b208577dc97771637931d6dd2256cbafe (patch)
treebce3bc6cca90f0bfcd2e8d8bc924667f6c12fab2
parentf63496a117f6f084ad42854894f052d9a4cd755a (diff)
downloadlufa-1b93c85b208577dc97771637931d6dd2256cbafe.tar.gz
lufa-1b93c85b208577dc97771637931d6dd2256cbafe.tar.bz2
lufa-1b93c85b208577dc97771637931d6dd2256cbafe.zip
Fixed spurious 0xFE USART byte sent in the USBtoSerial project when the baud rate is changed (thanks to Carl Kjeldsen).
-rw-r--r--LUFA/DoxygenPages/ChangeLog.txt2
-rw-r--r--Projects/USBtoSerial/USBtoSerial.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index c1dcef955..299427091 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -13,6 +13,8 @@
* when a pipe configuration failed (thanks to Helge Suess)
* - Fixed incorrect LED driver definitions for the Arduino Leonardo board (thanks to Zoltán Szőke)
* - Fixed incorrect XMEGA DFLL reference frequency (thanks to Martin Aakerberg)
+ * - Library Applications:
+ * - Fixed spurious 0xFE USART byte sent in the USBtoSerial project when the baud rate is changed (thanks to Carl Kjeldsen)
*
* \section Sec_ChangeLog140302 Version 140302
* <b>New:</b>
diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c
index 758e30ca6..1c791d95d 100644
--- a/Projects/USBtoSerial/USBtoSerial.c
+++ b/Projects/USBtoSerial/USBtoSerial.c
@@ -232,6 +232,9 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
break;
}
+ /* Keep the TX line held high (idle) while the USART is reconfigured */
+ PORTD |= (1 << 3);
+
/* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */
UCSR1B = 0;
UCSR1A = 0;
@@ -244,5 +247,8 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
UCSR1C = ConfigMask;
UCSR1A = (1 << U2X1);
UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
+
+ /* Release the TX line after the USART has been reconfigured */
+ PORTD &= ~(1 << 3);
}