UART 'overrun' errors and missing bytes

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

UART 'overrun' errors and missing bytes

1,816 Views
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);

}

Labels (1)
0 Kudos
1 Reply

925 Views
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 Kudos