Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

XMC™ Forum Discussions

Not applicable
Hi, I am working on XMC4100 UART. I wanna change UART baudrate at run time.I wanna do these baudrate update in same function. This is my use case ..

Switch(Baudrate)
{

case 9600:
UART_Baudrate(9600);
Send("Baudrate at 9600 \n");
break;
case 115200:
UART_Baudrate(115200);
Send("Baudrate at 115200 \n");
break;
case 256000:
UART_Baudrate(256000);
Send("Baudrate at 256000 \n");
break
}


The baudrate which was set first (9600) is working fine. But when I am trying to update new baudrate, there is a mismatch. please help
0 Likes
4 Replies
Travis
Employee
Employee
First like received
You have to ensure that the UART had complete transmission and receive, before you can change the baud rate.
0 Likes
Not applicable
Hi Travis, Thanks for the response. Got solution for this problem. I just had to check TX and RX idle status bits before updating the new baudrate.
0 Likes
Not applicable
Salman11053 wrote:
Hi Travis, Thanks for the response. Got solution for this problem. I just had to check TX and RX idle status bits before updating the new baudrate.


could you please spell out which registers are you referring to? Do you mean PSR.RXIDLE and PSR.TXIDLE ?
0 Likes
chismo
Employee
Employee
First like received
Hello,

Yes, these must refer to the bits PSR.RXIDLE and PSR.TXIDLE.

Regards,
Min Wei
0 Likes