From 7ce409d7a59ae377205ac27d73e435164e1c96b3 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 1 Mar 2022 12:53:39 -0500 Subject: [PATCH] lpc176x: Fix serial ordering of initialization The serial device needs to be enabled before setting the DLAB bit. This prevented UART3 from working. Signed-off-by: Kevin O'Connor --- src/lpc176x/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lpc176x/serial.c b/src/lpc176x/serial.c index 87a79270..07af6e57 100644 --- a/src/lpc176x/serial.c +++ b/src/lpc176x/serial.c @@ -75,8 +75,8 @@ void serial_init(void) { // Setup baud - LPC_UARTx->LCR = (1<<7); // set DLAB bit enable_pclock(PCLK_UARTx); + LPC_UARTx->LCR = (1<<7); // set DLAB bit uint32_t pclk = get_pclock_frequency(PCLK_UARTx); uint32_t div = pclk / (CONFIG_SERIAL_BAUD * 16); LPC_UARTx->DLL = div & 0xff;