aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/libboard/common/include/board_common.h4
-rw-r--r--firmware/libboard/common/source/uart_console.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/firmware/libboard/common/include/board_common.h b/firmware/libboard/common/include/board_common.h
index db030ad..1155158 100644
--- a/firmware/libboard/common/include/board_common.h
+++ b/firmware/libboard/common/include/board_common.h
@@ -77,8 +77,8 @@
#define PINS_UART { PIO_PA9A_URXD0|PIO_PA10A_UTXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** UART0 */
-/** Console baudrate always using 115200. */
-#define CONSOLE_BAUDRATE 115200
+/** Console baud rate in bps */
+#define CONSOLE_BAUDRATE 921600
/** UART peripheral used by the console (UART0). */
#define CONSOLE_UART UART0
/** UART peripheral ID used by the console (UART0). */
diff --git a/firmware/libboard/common/source/uart_console.c b/firmware/libboard/common/source/uart_console.c
index 3a00e49..bcfb0b7 100644
--- a/firmware/libboard/common/source/uart_console.c
+++ b/firmware/libboard/common/source/uart_console.c
@@ -85,7 +85,12 @@ extern void UART_Configure( uint32_t baudrate, uint32_t masterClock)
/* Configure baudrate */
/* Asynchronous, no oversampling */
- pUart->UART_BRGR = (masterClock / baudrate) / 16;
+ //pUart->UART_BRGR = (masterClock / baudrate) / 16;
+ if ((masterClock / baudrate) % 16 >= 7) {
+ pUart->UART_BRGR = ( masterClock / baudrate) / 16 + 1;
+ } else {
+ pUart->UART_BRGR = ( masterClock / baudrate) / 16 + 0;
+ }
/* Disable PDC channel */
pUart->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;