Hello Rens,
Which UART are you using? Please notice that you need to use UART1, UART2, UART3 or UART4 in order to change the baudrate on the go.
In the corresponding user manual of the LPC (UM10732) page 212 section Remark you will find the steps to change the baudrate on the go.
Here is an example of a function to re declare the baudrate:
static void setupBaudrate(uint32_t baudrate)
{
LPC_USART1->CFG = 0x00;
UART_CONFIG_T cfg =
{
0, /* U_PCLK frequency in Hz */
baudrate, /* Baud Rate in Hz */
1, /* 8N1 */
0, /* Asynchronous Mode */
NO_ERR_EN /* Enable No Errors */
};
cfg.sys_clk_in_hz = Chip_Clock_GetSystemClockRate();
/* Initialize the UART with the configuration parameters */
(void)LPC_UARTND_API->uart_init(uartHandle, &cfg);
}
I tried this function along with the example periph_uart_n_rom_polling provided in the LPCOpen and it worked correctly.
Please let me know if you have any more doubts.
Have a great day,
Victor.
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------