mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
ff494c4000
commit
1c47e974ff
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue