UART 'overrun' errors and missing bytes

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

UART 'overrun' errors and missing bytes

2,406 次查看
danebouchie
Contributor II

Using a K-10 Processor with Processor Expert In KDS, we where trying to port over some code from a previous coldfire chip which simply takes characters from a uart and stores them into a buffer. Our baud rate is 115200.

 

Using a legacy UART component (AsyncSerial), using UART_OnRxCharExt(), we are able to retrieve byte-by-byte and store each one in our own buffer. Problem is, when sending larger streams (30+ bytes a time), a few bytes go missing and we receive an 'overrun' error.

 

Using the Serial_LDD with a ReadBlock() of a large number of bytes, we are able to pull in all data successfully, however, if we attempt to read character-by-character using a recursive method the same error occurs:

 

i=0;

ReadBlock(&char_buffer,1);

 

void Wireless_OnBlockReceived() {

buffer[i++] = char_buffer;

if (i > 200)

     i = 0; // This line is actually not reached during our test as the error occurs on the first "stream"

ReadBlock(char_buffer,1);

}

标签 (1)
0 项奖励
回复
1 回复

1,515 次查看
marek_neuzil
NXP Employee
NXP Employee

Hello,

According to your description, you are using high baudrate for the UART device but the the application is not able receive character subsequently due to overhead of the UART interrupt service routine, user subroutines and other interrupts (the overrun error). In this case you can do:

- Use higher Core clock and bus clock to execute code faster.

- Use eDMA for receiving of characters and storing them into your buffer.

- Use Init_UART for initialization code of the UART device and write optimized interrupt subroutine for your use case (application).

Best Regards,

Marek Neuzil

0 项奖励
回复