Mesa 5i25/6i25 my own component: how to begin?
You need to setp sampler.0.enable 1 too, to start sampling. Or net it to amp-enable, or something.
Please Log in or Create an account to join the conversation.
loadrt hostmot2
loadrt hm2_pci
loadrt threads name1=main_thread period1=100000 # name2=sample_thread period2=100000
# Unsure if periodN is optimal
loadrt sampler depth=500 cfg=FF
# Unsure if FIFO depth is optimal
addf hm2_5i25.0.read main_thread
#addf hm2_5i25.0.write main_thread
addf sampler.0 main_thread
net encPosition sampler.0.pin.0 hm2_5i25.0.encoder.00.position
net encVelocity sampler.0.pin.1 hm2_5i25.0.encoder.00.velocity
setp sampler.0.enable 1
loadusr halsampler -t # ~/halsample.out
start
Is is smart to use only one thread for both hm2_5i25.0.read and sampler.0 ?
If I run each of these commands from halrun interface, the data output never stops,
unless I interrupt it with Ctrl+C.
If I run this script as a file with halrun -f halsample.hal ,
then the data output stops by itself depedent on the period of the main_thread as I found out by trial and error.
I do not know why this happens as I do not see any hm2/hm2_5i25.0: Watchdog has bit!
in /var/log/linuxcnc.log .
Please Log in or Create an account to join the conversation.
loadrt threads name1=fast period1=25000 name2=slow period2=1000000
loadrt timedelta count=2
addf timedelta.0 fast
addf timedelta.1 slow
start
loadusr -Wn lat pyvcp lat.xml
net sl timedelta.1.max => lat.sl
net sj timedelta.1.jitter => lat.sj
net st timedelta.1.out => lat.st
net sv timedelta.1.avgerr => lat.sv
net bl timedelta.0.max => lat.bl
net bj timedelta.0.jitter => lat.bj
net bt timedelta.0.out => lat.bt
net bv timedelta.0.avgerr => lat.bv
net reset lat.reset => timedelta.0.reset timedelta.1.reset
loadrt sampler depth=1000 cfg=ssssssss
addf sampler.0 slow
net sl sampler.0.pin.0
net st sampler.0.pin.1
net sj sampler.0.pin.2
net sv sampler.0.pin.3
net bl sampler.0.pin.4
net bt sampler.0.pin.5
net bj sampler.0.pin.6
net bv sampler.0.pin.7
loadusr hallatencysampler -c 0 -t $LOGFILE
waitusr -i hallatencysampler
waitusr lat
The pyVCP panel widget bits aside, it shows the connections, thread speeds, depths etc that work.
This process is halted via the quit for the widget, you need to engineer something in to stop sampling
regards
Please Log in or Create an account to join the conversation.
So I wrote only a HAL script so far:
loadrt threads name1=main_thread period1=100000 # name2=sample_thread period2=100000
You seem to have two threads both running at 100uS. (And you are only using one of them)
That's unusually fast for a 5i25.read / write thread.
As the hm2 data is only updated after a .read there is no point sampling any faster.Is is smart to use only one thread for both hm2_5i25.0.read and sampler.0 ?
This might be a side-effect of the fast sampling, does it stop the same way with a 1000uS thread time?If I run this script as a file with halrun -f halsample.hal ,
then the data output stops by itself depedent on the period of the main_thread as I found out by trial and error..
Please Log in or Create an account to join the conversation.
No, I use only one thread as there is a comment sign "#" before name2:
So I wrote only a HAL script so far:
loadrt threads name1=main_thread period1=100000 # name2=sample_thread period2=100000
You seem to have two threads both running at 100uS. (And you are only using one of them)
halcmd: loadrt threads name1=main_thread period1=100000 # name2=sample_thread period2=100000
halcmd: show thread
Realtime Threads (flavor: xenomai) :
Period FP Name ( Time, Max-Time ) flags
100000 YES main_thread ( 0, 0 )
"Unusually fast" means unnecessarily fast? Probably, you right.That's unusually fast for a 5i25.read / write thread.
I just wanted to test out out how far I can go with my Intel NUC, 4 Celeron cores.
I hope I understand you correctly and you mean thread period saying thread time.
This might be a side-effect of the fast sampling, does it stop the same way with a 1000uS thread time?If I run this script as a file with halrun -f halsample.hal ,
then the data output stops by itself depedent on the period of the main_thread as I found out by trial and error..
So with thread period of 100uS the output stops after 2419 entries if I run this script as a file.
With thread period of 1000uS the output stops after 242 entries if I run this script as a file.
As said already, if I run this script interactively line by line from the halrun cmd, the data output never stops.
Please Log in or Create an account to join the conversation.
So with thread period of 100uS the output stops after 2419 entries if I run this script as a file.
With thread period of 1000uS the output stops after 242 entries if I run this script as a file.
That looks like a constant time (2.5 seconds).
What happens with halcmd -kf ?
You might even need halcmd -Ikf to keep the halcmd session open after the script completes.
www.linuxcnc.org/docs/html/man/man1/halcmd.1.html
Please Log in or Create an account to join the conversation.
So with thread period of 100uS the output stops after 2419 entries if I run this script as a file.
With thread period of 1000uS the output stops after 242 entries if I run this script as a file.
That looks like a constant time (2.5 seconds).
What happens with halcmd -kf ?
You might even need halcmd -Ikf to keep the halcmd session open after the script completes.
www.linuxcnc.org/docs/html/man/man1/halcmd.1.html
Yes, this was good advice.
With halrun -Ikf halsample.hal the script yields 741538 output lines if the thread period is 100uS, and then everything "freezes"
as it seems from my ssh connection, and I have to restart my Debian wheezy.
/var/log/linuxcnc.log did not show any errors.
With the thread period of 1000uS it lasts longer, I am still waiting to see if the output stops somewhere.
More than 1000000 output lines are already there.
But anyway that was just a starting point for me as I wanted to do all these things in C.
Please Log in or Create an account to join the conversation.
/var/log/linuxcnc.log did not show any errors.
Realtime modules can only write to /var/log/kernel.log (which you can also view with dmesg).
I have seen freezes like you mention when accidentally outputting far too much data to the kernel log, so it might be worth a look in there.
(Though, looking at the sampler.c code I don't see any rtapi_print commands in the realtime loop.)
Please Log in or Create an account to join the conversation.
/var/log/linuxcnc.log did not show any errors.
Realtime modules can only write to /var/log/kernel.log (which you can also view with dmesg).
I have seen freezes like you mention when accidentally outputting far too much data to the kernel log, so it might be worth a look in there.
(Though, looking at the sampler.c code I don't see any rtapi_print commands in the realtime loop.)
There is definetely not too much of Linuxcnc messages in /var/log/kern.log .
The nearest thing I found that could give me some hint about performance are these lines:
Nov 3 07:56:14 debian-cml2 kernel: [ 1.273344] Xenomai: SMI-enabled chipset found, but SMI workaround disabled
Nov 3 07:56:14 debian-cml2 kernel: [ 1.273344] (see xeno_hal.smi parameter). You may encounter
Nov 3 07:56:14 debian-cml2 kernel: [ 1.273344] high interrupt latencies!
Indeed I have not yet properly checked all possible latency issues.
Please Log in or Create an account to join the conversation.
In that case, forget what I said about the kernel log too, that only applies to LinuxCNC.
Please Log in or Create an account to join the conversation.