XMC4500 UART not always reciving data

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

cross mob
Not applicable
Hello,
I am trying to communicate between STM32F4 and XMC4500 via UART.
I made simple function to initialize connection and XMC doesn't always see data coming back from STM

	
while(init == 1)
{
UART_Receive(&UART_0, rec_data, 6);
if((rec_data[0] == 0x00) && (rec_data[2] == 0xCC) && (rec_data[4] == 0x00))
{
uint8_t ack = 0;
while(ack == 0)
{
UART_Transmit(&UART_0, &odp[0], 1);
UART_Receive(&UART_0, &ack, 1);
while(UART_IsRxBusy(&UART_0));
for(uint32_t i = 0; i < 5000;i++);
}
init = 0;
}


The problem happens inside the"ack while", where XMC is constantly sending odp[0], and ignoring STMs response (which is the same value as odp[0]).
I've checked signal on a signal analyzer and it seems that UART_Receive just does nothing, while(UART_IsRxBusy(&UART_0)); finishes after just one check on a statement.

Any solutions?
0 Replies