Hello @linuxdev,
I have just performed the same tests on 5.0.2 and 4.6.2.
In the enclosed zip file SerialTest.zip (31.3 KB) is the test program source code and binary, the test script and 4 folders containing results.
I am using the same setup for all tests: same NX and NX dev kit carrier board, ttyTHS0 TX and RX binded together.
The machine is rebooted before each test.
I simplified the test program so that it is as simple as possible.
We initialize ttyTHS0 @ 460800 in blocking mode, then we launch a write thread and a read thread.
The write threads writes the same string at approximately 200Hz, a 60-character string 0x1 0x2 0x2 … 0x2 0x3
The read thread parses the serial data character by character, waits for the expected START_BYTE character 0x1 then reads until it finds another START_BYTE, or until we have read 60 characters. We then check if the received string corresponds to what we expect.
The main program also dumps some serial statistics every 10 seconds.
To perform a test, launching the test.sh script performs the following:
sudo jetson_clocks
sudo nvpmodel -m 8
Dump /etc/nv_tegra_release to folder
Launch the test program (redirecting output to folder), set with chrt FIFO 99 to the associated PID, move ttyTHS0 interrupts to CPU id 1
Waits 10 minutes
Dump /proc/interrupts to folder
Tests on Jetpack 4.6.2:
462-idle: only the test script was launched
462-clocks: the test script was launched, and we run as root in another terminal 10 seconds later: watch -n 0.1 “setsid jetson_clocks --show”
Tests on Jetpack 5.0.2:
502-idle: only the test script was launched
502-clocks: the test script was launched, and we run as root in another terminal 10 seconds later: watch -n 0.1 “setsid jetson_clocks --show”
As the content of out.txt states, we have 0 total errors in 462-idle 462-clocks and 502-idle (“0 total errors”).
Regarding 502-clocks, we have a total of 388 packet errors (0.32% of all packets), the errors are distributed quite evenly during the acquisition.
I also tried in 462-clocks mode to launch 6 terminals instead of 1 performing watch -n 0.1 “setsid jetson_clocks --show”, total CPU usage was ~20%, still no errors.
It is very puzzling as to how we can have such a difference!
Launching the jetson_clocks --show script multiple times is just an example to generate CPU activity, any other CPU stimulation will work too.
This test program was stripped down from a more efficient version where the serial port is polled using select() in non blocking mode, on which of course we have the same problem.
I also tried to compile and use a realtime version of the kernel on 5.0.2, I did not get any improvements.
I did the tests on the same NX to make sure we had an identical setup, but I do have multiple NX so if more tests are advised, I can easily switch Jetpack versions from now on, or recompile any kernel with different settings.
Thank you very much for your help!