SiLabs Zero: Fix clocking when using LEUART for USB board controller

When initializing for use with the board controller, the LEUART must
be clocked from HF clock as the baud rate is otherwise too high.

Do this by first initializing to "standard" 9600, then call serial_baud
which will handle setting up the clocks and dividers.
pull/1501/head
Mikko Polojarvi 2015-12-15 14:22:10 +02:00 committed by Steven Cooreman
parent ff494c4000
commit 1c47e974ff
1 changed files with 5 additions and 1 deletions

View File

@ -175,7 +175,7 @@ static void uart_init(serial_t *obj, uint32_t baudrate, SerialParity parity, int
}
init.enable = leuartDisable;
init.baudrate = baudrate;
init.baudrate = 9600;
init.databits = leuartDatabits8;
#ifdef LEUART_USING_LFXO
init.refFreq = LEUART_LF_REF_FREQ;
@ -183,6 +183,10 @@ static void uart_init(serial_t *obj, uint32_t baudrate, SerialParity parity, int
init.refFreq = LEUART_REF_FREQ;
#endif
LEUART_Init(obj->serial.periph.leuart, &init);
if (baudrate != 9600) {
serial_baud(obj, baudrate);
}
} else {
USART_InitAsync_TypeDef init = USART_INITASYNC_DEFAULT;