>   Is the real time component of Linux CNC running all the tasks that are
> > started with the loadrt with a 24uS period?    In other words all loaded
> > "loadrt tasks" have to finish within 24uS or the system will start to have
> > jitter or miss events.
> >
> 
> No, only the functions that are addf-ed to the base-thread run at that
> rate. Everything else (addf-ed to the servo-thread) runs at the
> servo-thread rate.
> This typically includes motion and the management section of many
> components. So, for example, the stepgen has a servo-thread part that
> calculates the step rate, and a base-thread portion that _only_ makes
> steps.
> Generally nothing in the base-thread does any floating-point calculations.
> (base-thread FP used to be disallowed, in fact, but can now be turned on
> via a switch)
> 
> 
> In general yes, but the parallel port is a special case. It has a "reset"
> function that can be configured to switch pins back to their default state
> in the same thread cycle as the parport-write.
> (The parport reset will actually busy-wait if the time has not yet elapsed,
> so it is more efficient to put some other base-thread tasks between
> parport-write and parport-reset in the base thread to avoid waiting, except
> in cases where you need the parport pulses to be as short as possible
> (which I can't think of a use-case for)

Thanks Andy,
A small lightbulb just went on.  The 

loadrt loadrt hal_parport cfg="0 out" 

just tells the OS that there is a function rtapi_app_main() that must be called 
to setup the list of functions that can be addf'd.

It's then the addf function names that must be exported in the rtapi_app_main() 
function.

The  
"addf functions _time_-thread"          
then add the functions to the real time OS task list running at BASE_PERIOD and 
they are added in the order they are in the HAL file. 

So below here:
======================
# ESTOP and Charge Pump Support for safety
loadrt estop_latch
loadrt charge_pump

# Control of PWM for Spindle
addf pwmgen.make-pulses base-thread

# Monitor Parallel port inputs
addf parport.0.read base-thread

#Control of Parallel port step/dir/output signals
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread

# make parallel port step pulses shorter than one base period
addf parport.0.reset base-thread
=======================

Having the parport-reset right after the parport-write means it sits in that 
while loop wasting time until the system clock in nano-seconds passes the set 
point of system clock + 5000 nanoseconds.

But if I move things around so there are more addf functions before the addf 
parport-reset I may find it doesn't spend any time in that do wait for timeout 
loop.
 
======================
# Monitor Parallel port inputs
addf parport.0.read base-thread

#Control of Parallel port step/dir signals
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread

# ESTOP and Charge Pump Support for safety
loadrt estop_latch
loadrt charge_pump

# Control of PWM for Spindle
addf pwmgen.make-pulses base-thread

# make parallel port step pulses shorter than one base period
addf parport.0.reset base-thread
=======================

John Dammeyer




_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to