Base thread/charge pump on a parallel port config

More
05 Nov 2013 22:29 #40553 by emcPT
We have nearlly built a machine where we are facing 2 issues, that are related:

1) On a machine using the parallel port we have a stable base period of 25000. Not sure if this value is ok since the latency test show quite a less value (less than 10000 even with a long test and several load on the CPU), but we cannot lower more the base period.

2) Attached to the PC we have a breakup board that have a charge pump that needs a frequency that is lower than the resulting frequency of the base period. Basically we can only use the charge pump if the base period is greater than 33000. Since we want the achieve the largest number of pulses per second to have the machine moving at the fastest speed possible we face the problem that the charge pump will NOT work at a fast base period. Can we associate the charge pump to another thread that would have a base period of about 100 000? It is possible?

Thank you

Please Log in or Create an account to join the conversation.

More
05 Nov 2013 23:25 - 05 Nov 2013 23:28 #40554 by ArcEye
Hi

You can create multiple threads, the restriction is that they have to be created in order from fastest to slowest.

www.linuxcnc.org/docs/devel/html/man/man9/threads.9.html

If you keep your hal and ini files as they are, you may have to play games by specifying the servo thread rate as the 100K you want and then create a third real_servo_thread and substitute this for all the original references to servo_thread.
This is because motmod has already created 2 threads at the start of the hal file and the names are hard coded, so you can't add to the EMCMOT line

ini file
BASE_PERIOD = 50000
# Servo task period, in nano-seconds
SERVO_PERIOD = 70000


hal file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt threads name3=real_servo_thread period3=1000000 fp3=1

results



This was done in a sim, so the only thread that actually gets created is the servo-thread, but you get the picture.

regards
Attachments:
Last edit: 05 Nov 2013 23:28 by ArcEye.
The following user(s) said Thank You: emcPT

Please Log in or Create an account to join the conversation.

More
06 Nov 2013 07:28 #40569 by andypugh

2) Attached to the PC we have a breakup board that have a charge pump that needs a frequency that is lower than the resulting frequency of the base period.


A 50% duty-cycle pwmgen ought to work as an alternative to charge_pump.

I think you can build a frequency divide-by-two out of HAL logic too.
You probably want the flip-flop function:
www.linuxcnc.org/docs/html/man/man9/flipflop.9.html
Wired up like the first stage of the digital divider here:
en.wikipedia.org/wiki/Frequency_divider
The HAL flip-flop doesn't have the /Q output, you will need to use a HAL "not" function to get that.
The following user(s) said Thank You: emcPT

Please Log in or Create an account to join the conversation.

More
06 Nov 2013 14:11 #40574 by emcPT
I really though about this possibility, but it seamed more difficult to implement.
I do not have an idea about the implication on the performance of the PC of both possibility's but I will probably try to add the thread first.
Thank you both.

Please Log in or Create an account to join the conversation.

More
06 Nov 2013 20:02 #40579 by emcPT
Using the charge pump running in a new thread as recommended it works, so we will keep this way.
Just for reference it was not noticed any change on the performance for having another thread running.

Thank you!

Please Log in or Create an account to join the conversation.

More
06 Nov 2013 22:12 #40588 by ArcEye

Using the charge pump running in a new thread as recommended it works, so we will keep this way.
Just for reference it was not noticed any change on the performance for having another thread running.

Thank you!


Glad it worked, I have created new threads previously, never for that particular purpose, but it seemed as though it should work

regards

Please Log in or Create an account to join the conversation.

More
12 Nov 2013 08:35 - 12 Nov 2013 08:36 #40762 by andypugh
Someone else asked about this on the mailing list, so I modified the charge_pump comp to have two extra pins running at f/2 and f/4.

If you want to use this, then you should be able to sudo comp --install the attached file in any version of LinuxCNC. Alternatively if you are running master, then it will be on the buildbot in a few hours.
Attachments:
Last edit: 12 Nov 2013 08:36 by andypugh.

Please Log in or Create an account to join the conversation.

More
12 Nov 2013 14:48 #40764 by emcPT
Thank you,
I did not tested as for now it is not needed.
Still, it is a good idea and may help in the future.

Please Log in or Create an account to join the conversation.

More
12 Nov 2013 19:32 #40768 by andypugh

I did not tested as for now it is not needed

It might be preferable to running an extra thread. I am not sure what the overhead is of running three threads.

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum