diff options
author | Kévin Redon <kredon@sysmocom.de> | 2018-08-28 19:19:03 +0200 |
---|---|---|
committer | Kévin Redon <kredon@sysmocom.de> | 2018-08-28 19:19:10 +0200 |
commit | 80d947660208d99ccd09693277a0f59924d9310b (patch) | |
tree | 56b2b6098c584d93b5a78b9a269798e7d02959d1 | |
parent | e2b0f971e52f0e6baf74bd28b567e9d72286ad78 (diff) |
UART: switch baud rate to 921600 bps
the higher baud rate allows for more debugging (without dropping
data) and is well supported by USB for UART adapters (this
standard baud rate is 8 x 115200).
the closest matching integer value is calculated for UART CR.
no floating point calculation can be used since this would
increase the size of the resulting binary by ~ 2kB (for the
softfp). this is not possible for the DFU since it already is
close to the maximum size of 16 kB.
Change-Id: I82b74f697342d580ccb79ada4715f35f4e8cca86
-rw-r--r-- | firmware/libboard/common/include/board_common.h | 4 | ||||
-rw-r--r-- | firmware/libboard/common/source/uart_console.c | 7 |
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; |