My UART receive a null character sometimes

0

In an embedded system, I use a GPS with others devices connected on 3 UARTs. When I use cat or minicom command with UARTs /dev/ttyUSB0 and others, I lose characters (I receive null character instead of excepted characters).

/dev/ttyUSB0 : binary messages at 200Hz (230400 bauds)

/dev/ttyS2 : NMEA message at 1Hz (115200 bauds)

/dev/ttyS1 : NMEA message at 2Hz (115200 bauds)

Sometimes on /dev/ttyS2 :$GPZDA,5[00]5519.00,14,12,2016,,*69[0D][0A]

Sometimes on /dev/ttyS1 :$GPGGA,155513.50,...,472[00]79,M,2.4,0120*65[0D][0A]

The load average is 0.14, 0.11, 0.04.

I would like to known if there is an option in kernel to improve this ?

I use kernel 3.11.6

Thanks

Note : If I set the baud rate at 19200 for /dev/ttyS1 and /dev/ttyS2, the problem disappears for these serial port.

Note 2 : With a usb/serial converter, I have tried to wire TX line of /dev/ttyS2 to my computer and I have not null characteres. I suppose the signal is not disturbed. Futhermore, if I stop cat or minicom command on /dev/ttyUSB0 (200hz), the problem disappears.

D.Piquet

Posted 2016-12-15T10:21:44.503

Reputation: 1

Depending on the termios settings, a framing or parity error will be indicated by the line discipline with the replacement of the character with a NULL. "if I set the baud rate at 19200 ..., the problem disappears" -- Then you're trying to use a baudrate too fast for the conditions (e.g. cable too long, wire gauge too small, improper shielding, ???). – sawdust – 2016-12-16T00:15:43.970

I add the note 2. Else I have read termios manual : When neither IGNBRK nor BRKINT are set, a BREAK reads as a null byte ('\0'). I've tried to disable these options but I've the same problem (with cat on /dev/ttyUSB0) – D.Piquet – 2016-12-16T08:55:14.863

Read tha man page and my comment again. I was not referring to a BREAK condition, but a framing or parity error. From the termios man page: *If neither IGNPAR nor PARMRK is set, read a character with a parity error or framing error as \0.* – sawdust – 2016-12-16T09:10:19.697

No answers