UART 2Baud rates on single UART
Posted: Wed Apr 19, 2017 3:50 pm
Hi everyone ,
I'm struggling with the UART communication. I need to change the baud rate on a single UART to implement a specific protocol. So my goal is to have two baud rates right after each other at a transmission with a minimum of change delay.
I tried to do that on low level, so I used something like the following code:
The code has a good behaviour till I add the 2nd "uart_set_baudrate()" function. The result is a time drift somewhere (this depends on the length of the sent data) in Data2 .
So I think the problem consists of timing problems.
Has anyone an idea how to fix that or had the same issue
Thanks!
I'm struggling with the UART communication. I need to change the baud rate on a single UART to implement a specific protocol. So my goal is to have two baud rates right after each other at a transmission with a minimum of change delay.
I tried to do that on low level, so I used something like the following code:
Code: Select all
//Setup
uartBegin(...);
//Loop
while(1){
uart_set_baudrate(BAUDRATE1);
uartWrite(Data1)
uart_set_baudrate(BAUDRATE2);
uartWrite(Data2)
}
So I think the problem consists of timing problems.
Has anyone an idea how to fix that or had the same issue
Thanks!