S32K144 EVB - UART always reads STATUS_SUCCESS after Init

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 EVB - UART always reads STATUS_SUCCESS after Init

995 Views
vagabond
Contributor II

Hi guys,

I created an infinite while loop following a Processor Expert example for UART, and read data from the serial port.

/* Initialize for UART_PAL */
UART_Init(&uart_pal1_instance, &uart_pal1_Config0);

while(1)
{
error = UART_ReceiveData(&uart_pal1_instance, buffer_uart, 12UL);
if (error==STATUS_SUCCESS) //means data was received from PC

  {

    //...doing something with the data received

  }
}

This function works ok, except for the first time it loops, when error=STATUS_SUCCESS. There is no data on the serial bus.

While I can fix it by ignoring the first loop data, I don't know why it happens. 

Any ideas?

*btw, same thing happens with CAN communication, not just UART.

I'm using the on board Open SDA debugger, not sure it matters.

Thanks. 

0 Kudos
Reply
0 Replies