Base thread/charge pump on a parallel port config
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.
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
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
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.
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.
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.
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.
Please Log in or Create an account to join the conversation.
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.
It might be preferable to running an extra thread. I am not sure what the overhead is of running three threads.I did not tested as for now it is not needed
Please Log in or Create an account to join the conversation.