Update serial_api.c

Fixed the incorrect clocksource for the baud generator. Should be MainClock instead of SystemCoreClock. This also allows the correct use of the PLL for MainClock and SystemCoreClock without breaking the serial baudrate.
pull/870/head
Wim 2015-01-27 21:04:17 +01:00
parent 6fefefa3bb
commit fd82a674ab
1 changed files with 4 additions and 3 deletions

View File

@ -117,9 +117,10 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
/* Peripheral reset control to UART, a "1" bring it out of reset. */
LPC_SYSCON->PRESETCTRL &= ~(0x1 << (3 + uart_n));
LPC_SYSCON->PRESETCTRL |= (0x1 << (3 + uart_n));
UARTSysClk = SystemCoreClock / LPC_SYSCON->UARTCLKDIV;
//WH
UARTSysClk = MainClock / LPC_SYSCON->UARTCLKDIV;
// set default baud rate and format
serial_baud (obj, 9600);
serial_format(obj, 8, ParityNone, 1);