I have reserved core 3 using isolcpus=3D3. I can start GForth with all it's=
tasks on core 3 with "taskset". But this is not what I want to do, as only= the stepper-thread shall use this CPU for best performance. So I try to us=
e " 3 stick-to-core" but it does not seem to work. Is this tested on a rasp= >i?
The 22decimal is written to core#. As far as I understand, this should be 0=
Christof Eberspaecher <chwe...@gmail.com> writes:
I have reserved core 3 using isolcpus=3D3. I can start GForth with all it's=
tasks on core 3 with "taskset". But this is not what I want to do, as only=
the stepper-thread shall use this CPU for best performance. So I try to us=
e " 3 stick-to-core" but it does not seem to work. Is this tested on a rasp=
i?
Apparently not tested at all, because it always returns EINVAL before setting thread affinity. I have now fixed this:
<http://git.savannah.gnu.org/cgit/gforth.git/commit/?id=c6e54a12ad1a68e2353284df9c5caf0cbdab749b>
I have tested the result on a PC, and it now works. I would be very surprised if it did not on a Raspi.
What I used for fixing this bug: <https://stackoverflow.com/questions/1407786/how-to-set-cpu-affinity-of-a-particular-pthread>,
The 22decimal is written to core#. As far as I understand, this should be 0=
22 as return value is EINVAL; it should be 0.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/
EuroForth 2022: http://www.euroforth.org/ef22/cfp.html
Hi,
background: The goal is to control a small lathe with a Raspberry Pi
using GForth 0-7-9. The axis are moved by step motors. The idea is to
use a maximum step frequency, that always allows to stop within one full >step. So if there is a time lag, steps should not be lost. Linear motion
is done by a separate pthread.
I have reserved core 3 using isolcpus=3. I can start GForth with all
it's tasks on core 3 with "taskset". But this is not what I want to do,
as only the stepper-thread shall use this CPU for best performance. So I
try to use " 3 stick-to-core" but it does not seem to work. Is this
tested on a raspi?
Thanks for some hints!
Christof
In article <aff8f55b-e72e-4cc5...@googlegroups.com>,
Christof Eberspaecher <chwe...@gmail.com> wrote:
Hi,
background: The goal is to control a small lathe with a Raspberry Pi
using GForth 0-7-9. The axis are moved by step motors. The idea is to
use a maximum step frequency, that always allows to stop within one full >step. So if there is a time lag, steps should not be lost. Linear motion >is done by a separate pthread.
I have reserved core 3 using isolcpus=3. I can start GForth with allI had some bad experience with isolating CPU's. I have an 8 bit core AMD
it's tasks on core 3 with "taskset". But this is not what I want to do,
as only the stepper-thread shall use this CPU for best performance. So I >try to use " 3 stick-to-core" but it does not seem to work. Is this
tested on a raspi?
and I tried to isolate a CPU for midi bitbanging (midi is a asynchronous serial signal of 31.25 kHz). This works as far as the software is concerned with 320 us for 10 bits, e.g. generating a 16 us high 16 us low signal,
up till the 50 ns resolution of the logical analyser.
You have to do other things, such as manipulating the boot up.
I run mprime on the background, and mprime run as if there 8 cores available, trying to interfere with my midi. So it tried to
run an 8the mprime on the "isolated" core. Of course I killed mprime,
but this is a cludge.
Furthermore, in inspecting a 32 us square wave, it was obvious that
there are numerous interruptions with different time intervals.
midi is robust that it doesn't care to miss-present an event from time
to time, but there was no way I get a scale out of this.
I managed to control mechanical instruments up till mS precision
or better (in Forth) , the isolcpu/taskset is no good for what
we have in mind.
It is interesting to see whether actual examples exists for isolcpu
that accomplishes something useful. Then start from there.
Thanks for some hints!Groetjes Albert
Christof
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
none albert schrieb am Montag, 25. Juli 2022 um 11:05:32 UTC+2:given by decreasing torque against friction. At this moment I still think/hope, that this speed can be done with GForth without RT-kernel too, if you don't do too much with the LAN in parallel. There will be some jitter though.
In article <aff8f55b-e72e-4cc5...@googlegroups.com>,
Christof Eberspaecher <chwe...@gmail.com> wrote:
Hi,
background: The goal is to control a small lathe with a Raspberry Pi >using GForth 0-7-9. The axis are moved by step motors. The idea is to >use a maximum step frequency, that always allows to stop within one full >step. So if there is a time lag, steps should not be lost. Linear motion >is done by a separate pthread.
I have reserved core 3 using isolcpus=3. I can start GForth with all >it's tasks on core 3 with "taskset". But this is not what I want to do, >as only the stepper-thread shall use this CPU for best performance. So I >try to use " 3 stick-to-core" but it does not seem to work. Is this >tested on a raspi?I had some bad experience with isolating CPU's. I have an 8 bit core AMD and I tried to isolate a CPU for midi bitbanging (midi is a asynchronous serial signal of 31.25 kHz). This works as far as the software is concerned
with 320 us for 10 bits, e.g. generating a 16 us high 16 us low signal,
up till the 50 ns resolution of the logical analyser.
You have to do other things, such as manipulating the boot up.
I run mprime on the background, and mprime run as if there 8 cores available, trying to interfere with my midi. So it tried to
run an 8the mprime on the "isolated" core. Of course I killed mprime,
but this is a cludge.
Furthermore, in inspecting a 32 us square wave, it was obvious that
there are numerous interruptions with different time intervals.
midi is robust that it doesn't care to miss-present an event from time
to time, but there was no way I get a scale out of this.
I managed to control mechanical instruments up till mS precisionThanks, Albert, for sharing your findings!
or better (in Forth) , the isolcpu/taskset is no good for what
we have in mind.
It is interesting to see whether actual examples exists for isolcpu
that accomplishes something useful. Then start from there.
Thanks for some hints!Groetjes Albert
Christof
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
At the moment using Raspi4b @ 4*1.8GHz average latency with GForth seems to be about 60 µs with seldom peaks up to 1500µs with isolcpus. If you switch windows of Chromium browser in parallel, you can produce additional large latency.
With Preempt-RT kernel 100µs seems to be a possible limit: https://lemariva.com/blog/2019/09/raspberry-pi-4b-preempt-rt-kernel-419y-performance-test
My hitherto existing solution for the lathe is a combination of Python on Raspi together with a Parallax Propeller 1 running Tachyon Forth for the stepping linear interpolation. I have used that with down to 500µs per 1/4 microstep. The speed limit is
Gruß Christof
Ha, EDIT: I had done wrong the part of inserting isolcpus=3D3 into cmdline.= >txt. It must be inserted into the one and only line! I have had it in a sec= >ond line.
Now it is possible to start only one pthread in core 3 and maximum latency = >is <150=C2=B5s. :-)
In article <aff8f55b-e72e-4cc5...@googlegroups.com>,
Christof Eberspaecher <chwe...@gmail.com> wrote:
Hi,
background: The goal is to control a small lathe with a Raspberry Pi
using GForth 0-7-9. The axis are moved by step motors. The idea is to
use a maximum step frequency, that always allows to stop within one full >step. So if there is a time lag, steps should not be lost. Linear motion
is done by a separate pthread.
I have reserved core 3 using isolcpus=3. I can start GForth with allI had some bad experience with isolating CPU's. I have an 8 bit core AMD
it's tasks on core 3 with "taskset". But this is not what I want to do,
as only the stepper-thread shall use this CPU for best performance. So I >try to use " 3 stick-to-core" but it does not seem to work. Is this
tested on a raspi?
and I tried to isolate a CPU for midi bitbanging (midi is a asynchronous serial signal of 31.25 kHz). This works as far as the software is concerned with 320 us for 10 bits, e.g. generating a 16 us high 16 us low signal,
up till the 50 ns resolution of the logical analyser.
You have to do other things, such as manipulating the boot up.
I run mprime on the background, and mprime run as if there 8 cores
available, trying to interfere with my midi. So it tried to
run an 8the mprime on the "isolated" core. Of course I killed mprime,
but this is a cludge.
Furthermore, in inspecting a 32 us square wave, it was obvious that
there are numerous interruptions with different time intervals.
midi is robust that it doesn't care to miss-present an event from time
to time, but there was no way I get a scale out of this.
I managed to control mechanical instruments up till mS precision
or better (in Forth) , the isolcpu/taskset is no good for what
we have in mind.
It is interesting to see whether actual examples exists for isolcpu
that accomplishes something useful. Then start from there.
Thanks for some hints!Groetjes Albert
Christof
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
none albert schrieb am Montag, 25. Juli 2022 um 11:05:32 UTC+2:
In article <aff8f55b-e72e-4cc5...@googlegroups.com>,
Christof Eberspaecher <chwe...@gmail.com> wrote:
Hi,
background: The goal is to control a small lathe with a Raspberry Pi >using GForth 0-7-9. The axis are moved by step motors. The idea is to >use a maximum step frequency, that always allows to stop within one full >step. So if there is a time lag, steps should not be lost. Linear motion >is done by a separate pthread.
I have reserved core 3 using isolcpus=3. I can start GForth with all >it's tasks on core 3 with "taskset". But this is not what I want to do, >as only the stepper-thread shall use this CPU for best performance. So I >try to use " 3 stick-to-core" but it does not seem to work. Is this >tested on a raspi?I had some bad experience with isolating CPU's. I have an 8 bit core AMD and I tried to isolate a CPU for midi bitbanging (midi is a asynchronous serial signal of 31.25 kHz). This works as far as the software is concerned
with 320 us for 10 bits, e.g. generating a 16 us high 16 us low signal,
up till the 50 ns resolution of the logical analyser.
You have to do other things, such as manipulating the boot up.
I run mprime on the background, and mprime run as if there 8 cores available, trying to interfere with my midi. So it tried to
run an 8the mprime on the "isolated" core. Of course I killed mprime,
but this is a cludge.
Furthermore, in inspecting a 32 us square wave, it was obvious that
there are numerous interruptions with different time intervals.
midi is robust that it doesn't care to miss-present an event from time
to time, but there was no way I get a scale out of this.
I managed to control mechanical instruments up till mS precisionHi Albert,
or better (in Forth) , the isolcpu/taskset is no good for what
we have in mind.
It is interesting to see whether actual examples exists for isolcpu
that accomplishes something useful. Then start from there.
Thanks for some hints!Groetjes Albert
Christof
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Perhaps some findings about latency with isolated core are interesting. This s ferquency distribution of latencies. "56" means, that a delay, which should be 100microsecs was actually 156microseconds.
44 0
50 0
56 22184148
63 2200279
70 72041
79 98707
89 13951
100 4009
112 1472
125 186
141 69
158 21
177 2
199 1
223 0
251 0
Maximum latency of this measurement was 214 microseconds.
Raspi4b @1.8GHz with one isolated core, which was exclusively used to run the testthread. To use GForth-fast has no significant effect.
So, yes, 32kbaud midi serial, which needs resultion better than 16us would clearly not be possible.
If I think, that a resolution of 250us should be possible then a step frequency of 2000Hz will be possible.
The motor winding inductance is relatively high with 7mH and my motor driver has only 24V. For full torque the motor is rated for 1.4A R=3.1Ohm.
So 20V/1.4A= 14Ohms inductive resistance. 14/(2*pi*0.007)= 100Hz full step frequency for max torque. I do not have the data of the motor to calculate counter-emf. So all-in-all 2000Hz seems not to be the show stopper.
It is also interesting, that in this environment of linux, using GForth seems not to be the speed limiting factor for this application. :-)
Christof
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 22:38:34 |
Calls: | 9,488 |
Calls today: | 7 |
Files: | 13,617 |
Messages: | 6,121,095 |