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
This commit is contained in:
Kevin Redon 2018-08-28 19:19:03 +02:00
parent e2b0f971e5
commit 80d9476602
2 changed files with 8 additions and 3 deletions

View File

@ -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). */

View File

@ -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;