Hello, I am facing strange behaviour when receiving long messages on /dev/ttyTHS1. This seems to happen at all baud rates. Increasing or decreasing the sender’s baud rate by ~1% does not change the result. So I believe this is not a clock/sync issue.
Also I already used:
systemctl disable nvgetty
The serial receive sometimes corrupts data by skipping a few bytes starting with always the 38th byte. The corrupted message also has 2, 4 or 6 etc. zeroes pre-pended to it.
To debug I am sending a message of 200 bytes, about 130 times a second. The first byte is 30 decimal, and the value increments each byte. So I am expecting to see:
[30] [31] [32] [33] … [228] [229]
Randomly, on average every 30 seconds / 4000 messages (but still very irregularly) the Jetson instead reads something like:
[0] [0] [0] [0] [30] [31] [32] [33] … [66] [67] [71] [72] … [228] [229]
→ 201 bytes, 4 zeroes, 3 bytes skipped
[0] [0] [30] [31] [32] [33] … [66] [67] [69] [70] … [228] [229]
→ 201 bytes, 2 zeroes, 1 byte skipped
[0] [0] [0] [0] [0] [0] [30] [31] [32] [33] … [66] [67] [76] [77] … [228] [229]
→ 198 bytes, 6 zeroes, 8 bytes skipped
[0] [0] [0] [0] [30] [31] [32] [33] … [66] [67] [73] [74] … [228] [229]
→ 199 bytes, 4 zeroes, 5 bytes skipped
(As far as I can tell, the number of zeroes is always even.)
Changing the contents of the message also does not effect the behaviour. Originally it happened with a data streaming protocol and I switched to this fixed message, but looking again at the early data the receiver always added zeroes and skipped bytes after the first 37 of the proper message.
Would be good to know if anyone ever faced such an issue or if this very specific problem is an indication of whats wrong.
This is the serial port configuration:
$ sudo stty -F /dev/ttyTHS1 -a
speed 1000000 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 0; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
Thanks!