Visweshwar Srinivasan

Changing baud rate of LPC 4370

Discussion created by Visweshwar Srinivasan on Nov 27, 2018
Latest reply on Dec 3, 2018 by Victor Jimenez

I don't know how to change the UART's baudrate for an LPC4370 microcontroller. I am using an example program from LPCExpresso to change the baudrate, from the board.c file. It has a function as follows:


Chip_UART_SetBaud(DEBUG_UART, 115200);


I have also included the function definition below:


uint32_t Chip_UART_SetBaud(LPC_USART_T *pUART, uint32_t baudrate)
uint32_t div, divh, divl, clkin;

/* Determine UART clock in rate without FDR */
clkin = Chip_Clock_GetRate(Chip_UART_GetClockIndex(pUART));
div = clkin / (baudrate * 16);

/* High and low halves of the divider */
divh = div / 256;
divl = div - (divh * 256);

Chip_UART_SetDivisorLatches(pUART, divl, divh);

/* Fractional FDR alreadt setup for 1 in UART init */

return clkin / div;


As seen, the baud rate is set by dividing the clkin by div. I am trying to achieve a baud rate higher than 115200, and it doesn't really work as it does for transferring data serially to an Arduino, as it does at 115200. I am new to using the microcontroller, any help would be greatly appreciated.