aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-03-01 12:53:39 -0500
committerKevin O'Connor <kevin@koconnor.net>2022-03-01 12:55:06 -0500
commit7ce409d7a59ae377205ac27d73e435164e1c96b3 (patch)
tree0343a81d79390238bc01b95b7d304080dbbe630b
parent682d38f5902fa696e6b40f6068a2ed06284e9527 (diff)
downloadkutter-7ce409d7a59ae377205ac27d73e435164e1c96b3.tar.gz
kutter-7ce409d7a59ae377205ac27d73e435164e1c96b3.tar.xz
kutter-7ce409d7a59ae377205ac27d73e435164e1c96b3.zip
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 <kevin@koconnor.net>
-rw-r--r--src/lpc176x/serial.c2
1 files changed, 1 insertions, 1 deletions
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;