S32K144 EVB - UART always reads STATUS_SUCCESS after Init

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K144 EVB - UART always reads STATUS_SUCCESS after Init

839 次查看
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. 

标记 (4)
0 项奖励
回复
0 回复数