Reducing Jitter
- Escain
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 6
- Thank you received: 1
07 Oct 2017 18:41 #100055
by Escain
Reducing Jitter was created by Escain
Hello 
I am currently trying to get LinuxCNC working on a Raspberry Pi. It's about a few weeks that I am trying, so I guess is the moment to ask, but my expertise is still limited: forgive me if I ask some newbie stuff.
So, what is the current status:
First, I installed a fresh Raspian Linux on the machine.
Second, I Cross-compiled an RT kernel following the page here . After that, using `uname` print the correct new kernel with PREEMPT in it.I did some tests with "cyclictest" and results, even if not very good, are still bellow 150us maximum and average 20us
I configured the kernel to start with following options:
After, I cloned LinuxCNC and following this guide
What with LinuxCNC?
Running the test: "latency-histogram" I get terrible results with maximum jitter over 700-1400us
It seem to me that there is no preemption usage, but I am unable to check it.
Also, trying to add CPU affinity to the two latency-histogram threads does not seem to help.
Conclusion and question
I fully understand that the RaspberryPi cheap computer will not provides 5us jitter control, but at the moment it seem the CPU is able of more than what I got.
My question/s are:
How to ensure LinuxCNC is using Preemptive kernel features?
If using Preemptive, why is the jitter so high?
Any hint of how to improve and bound this jitter?
Notes:
LinuxCNC version used: 2.8.0~pre1, from today repository status.

I am currently trying to get LinuxCNC working on a Raspberry Pi. It's about a few weeks that I am trying, so I guess is the moment to ask, but my expertise is still limited: forgive me if I ask some newbie stuff.
So, what is the current status:
First, I installed a fresh Raspian Linux on the machine.
Second, I Cross-compiled an RT kernel following the page here . After that, using `uname` print the correct new kernel with PREEMPT in it.
Linux raspberrypi 4.9.50-rt37-v7+ #2 SMP PREEMPT RT Wed Sep 20 21:44:16 CEST 2017 armv7l GNU/Linux
I configured the kernel to start with following options:
sdhci_bcm2708.enable_llm=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.fiq_enable=0 dwc_otg.nak_holdoff=0 isolcpus=0,1
After, I cloned LinuxCNC and following this guide
git clone git://github.com/linuxcnc/linuxcnc.git linuxcnc-dev
sudo apt-get install dpkg-dev
cd linuxcnc-dev/debian
./configure uspace
cd ..
dpkg-checkbuilddeps
apt-get install <all list>
apt-get install bwidget
apt-get install libtk-img
apt-get install tclx
cd src
./configure --with-realtime=uspace | tee ../configure.log
make | tee ../make.log
sudo make setuid | tee ../makesetuid.log
source ../scripts/rip-environment
runtiests
What with LinuxCNC?
Running the test: "latency-histogram" I get terrible results with maximum jitter over 700-1400us
It seem to me that there is no preemption usage, but I am unable to check it.
Also, trying to add CPU affinity to the two latency-histogram threads does not seem to help.
Conclusion and question
I fully understand that the RaspberryPi cheap computer will not provides 5us jitter control, but at the moment it seem the CPU is able of more than what I got.
My question/s are:
How to ensure LinuxCNC is using Preemptive kernel features?
If using Preemptive, why is the jitter so high?
Any hint of how to improve and bound this jitter?
Notes:
LinuxCNC version used: 2.8.0~pre1, from today repository status.
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23323
- Thank you received: 4948
10 Oct 2017 22:51 - 10 Oct 2017 22:52 #100174
by andypugh
Replied by andypugh on topic Reducing Jitter
Does "halrun" then "exit" say "Note: using POSIX realtime" ?
Last edit: 10 Oct 2017 22:52 by andypugh.
The following user(s) said Thank You: Escain
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23323
- Thank you received: 4948
10 Oct 2017 22:54 #100175
by andypugh
Replied by andypugh on topic Reducing Jitter
I think that there are kernel compilation options that need to be set to allow preempt-rt to work properly too.
wiki.linuxfoundation.org/realtime/docume...ions/preemptrt_setup
wiki.linuxfoundation.org/realtime/docume...ions/preemptrt_setup
The following user(s) said Thank You: Escain
Please Log in or Create an account to join the conversation.
- Escain
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 6
- Thank you received: 1
11 Oct 2017 17:29 - 11 Oct 2017 17:30 #100219
by Escain
Replied by Escain on topic Reducing Jitter
Thanks andipugh for your answer, I appreciate it!
I obviously set the CONFIG_PREEMPT_RT_FULL, but I did not had a look to the debug options nor other possibly related configurations. I will have a look deeper.
Halrun return the following line:
Note: Using POSIX realtime
I obviously set the CONFIG_PREEMPT_RT_FULL, but I did not had a look to the debug options nor other possibly related configurations. I will have a look deeper.
Halrun return the following line:
Note: Using POSIX realtime
Last edit: 11 Oct 2017 17:30 by Escain.
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23323
- Thank you received: 4948
11 Oct 2017 23:23 #100244
by andypugh
OK, that means that it is using preempt-rt.
Off the Stretch preempt-rt ISO, with no tweaks, my PC is managing about 10uS latency, so you seem to be a bit unlucky.
Replied by andypugh on topic Reducing Jitter
Note: Using POSIX realtime
OK, that means that it is using preempt-rt.
Off the Stretch preempt-rt ISO, with no tweaks, my PC is managing about 10uS latency, so you seem to be a bit unlucky.
The following user(s) said Thank You: Escain
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 20247
- Thank you received: 6886
23 Oct 2017 15:38 #100676
by tommylight
Replied by tommylight on topic Reducing Jitter
I am using a version of machinekit on RPI3 ( 2 of them ), had to update and switch to software GL so it is more usable, there is nothing i could do to lower latency but i did not try much as it works nicely with the PiDiCNC controlers.
The following user(s) said Thank You: Escain
Please Log in or Create an account to join the conversation.
Time to create page: 0.112 seconds