Vf50 UART issue (Linux)

Hello,

on our system we use /dev/ttyLP2 for RS-485 communication.
It’s possible, that sometimes there are interferences on the serial line resulting in invalid received data.

It works fine, but after some communication it stops working properly:
A message on the serial line contains n bytes, but my application only receives n-1 bytes and I get a select() timeout.
Then select() without a timeout is started.
When the next message appears (maybe after a minute), the first received byte is the missing (last) byte of the last message. And again, the last byte of the new message is missing.

This makes the application unusable.
The problem persists until the application is restarted (reinitializing the serial line).

Do you have a solution for this problem?

Thank you very much,

Sandro

In v2.5b3 image DMA mode is disabled by default due to some issues with DMA implementation, starting with v2.6b1 DMA is enabled again by default (after re-implementing the DMA code). With DMA approach there are much fewer chances to have overruns. In PIO mode especially on higher baud rates and the slower Colibri VF50, overruns can happen and to ensure that no character are lost, use hardware flow control signals such as RTS/CTS or lower baud rates. In PIO mode if overrun happens one need to re-initate the FIFOs (which is not done in PIO mode), this patch does reinitating the FIFOs if overerun happens or try with DMA mode on our latest images.

Note that overruns are rather common especially on ttyLP2 since this UART only has 8 byte FIFO. What baudrate are you using?

The used baudrate is 115200 (can not be changed) and we run the UART in RS-485 mode. The problem seems to appear while the kernel is handling USB errors (we are doing some EMC tests).
I’ll try the patch.

There is good amount of chance to hit an overrun when CPU is very busy. May be you can try ttyLP1 which has 16 byte FIFO. If the data is critical and to avoid overruns I would recommend to use RTS/CTS flow control or use DMA mode.