fix UART baudrate on LPC176X

This commit is contained in:
Desuuuu 2021-04-06 01:05:23 +02:00
parent f8decd96e4
commit 3de6447315
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,7 @@ t5uid1_init(uint32_t baud)
// Setup baud // Setup baud
LPC_UARTx->LCR = (1<<7); // set DLAB bit LPC_UARTx->LCR = (1<<7); // set DLAB bit
enable_pclock(PCLK_UARTx); enable_pclock(PCLK_UARTx);
uint32_t pclk = SystemCoreClock; uint32_t pclk = get_pclock_frequency(PCLK_UARTx);
uint32_t div = pclk / (baud * 16); uint32_t div = pclk / (baud * 16);
LPC_UARTx->DLL = div & 0xff; LPC_UARTx->DLL = div & 0xff;
LPC_UARTx->DLM = (div >> 8) & 0xff; LPC_UARTx->DLM = (div >> 8) & 0xff;