aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/stm32/usart.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/stm32/usart.c b/lib/stm32/usart.c
index 3de0eb4..a2c9f16 100644
--- a/lib/stm32/usart.c
+++ b/lib/stm32/usart.c
@@ -52,8 +52,10 @@ void usart_set_baudrate(u32 usart, u32 baud)
* marketting bable to sound awesome. It is nothing else but a
* simple divider to generate the correct baudrate. >_< If I
* am wrong feel free to correct me on that. :) (esden)
+ *
+ * Changed to round rather than floor (Fergus)
*/
- USART_BRR(usart) = clock / baud;
+ USART_BRR(usart) = (2*clock + baud) / (2*baud);
}
void usart_set_databits(u32 usart, u32 bits)