SAM9G25 UART: random data overrun / NULL byte in receive data

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

martelpaul56
Posts: 1
Joined: Mon Nov 05, 2018 6:10 pm

SAM9G25 UART: random data overrun / NULL byte in receive data

Mon Nov 05, 2018 9:07 pm

Regarding the UARTs on the CORE9G25 Corewind SOM running Linux version 4.4.16: when receiving data packets sent from an external device, sometimes the data stream contains a random NULL character (0x00). Examples:

The string from the device: "12345"
SEND: [0x31][0x32][0x33][0x34][0x35]
RECV: [0x31][0x32][0x34][0x00][0x35]

SEND: [0x31][0x32][0x33][0x34][0x35]
RECV: [0x31][0x33][0x00][0x34][0x35]

The SEND data has been verified correct at the UART input using a logic analyzer.

The RECV data is the result of a user-space linux "read" of ttyS1. The character count returned by read includes the NULL character. (i.e. the returned value in these examples is 5)

The baud rate was initially 115200. Reducing it to 57600 reduces the frequency of the error, but does not eliminate it. This appears to be a UART overrun due to the kernel too busy to process the UART interrupt. But in this case we would expect a character count of 4 and a missing character.

We have also seen random ttyS0 overruns reported by the console port.

Looking for guidance as to what to look for in terms of characterization, kernel configuration, etc. Especially whether any others have seen this issue and how it was addressed.

Thanks for any information. Much appreciated.
blue_z
Location: USA
Posts: 1759
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAM9G25 UART: random data overrun / NULL byte in receive data

Mon Nov 05, 2018 11:34 pm

martelpaul56 wrote: when receiving data packets sent from an external device, sometimes the data stream contains a random NULL character (0x00).
You neglect to mention salient information.
Besides the baud rate, what serial configuration is the sender using?
Besides the baud rate, what serial configuration is the receiver (i.e. your SAM9G25) using?
What are the termios settings that your program is using when this issue occurs?

FYI termios (i.e. the terminal subsystem which you use to read from a serial terminal aka UART) can be configured to replace a received character that has a parity or framing error with a null byte.

martelpaul56 wrote: This appears to be a UART overrun due to the kernel too busy to process the UART interrupt.
...
We have also seen random ttyS0 overruns reported by the console port.
Describe the problem's symptoms, not your guesses
Is DMA enabled for receive channels?

FYI the U[S]ART statistics as compiled by the driver are retrievable from /proc/tty/driver/atmel_serial.
The legend is:
  • tx: characters transmitted
    rx: characters received
    fe: frame errors
    pe: parity errors
    brk: break conditions
    oe: receiver overruns

Regards

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 3 guests