HAL Pins Reference

Complete list of all HAL pins exported by the stepgen-ninja LinuxCNC module.

Notation

In all pin names, j is the instance index (0–3) and i is the channel index (e.g. stepgen or encoder channel number). X is the GPIO pin number for digital I/O.

Type legend:

BIT FLOAT U32 S32    IN = HAL writes this pin   OUT = module writes this pin

Global Pins (per instance)

Pin nameTypeDirDescription
module_name.j.connectedBITOUTConnection status with hardware
module_name.j.periodU32INPeriod in nanoseconds
module_name.j.io-ready-inBITINInput ready signal
module_name.j.io-ready-outBITOUTOutput ready signal
module_name.j.stepgen.pulse-widthU32INStep pulse width in nanoseconds

Stepgen Pins (per channel)

Pin nameTypeDirDescription
module_name.j.stepgen.i.commandFLOATINCommand input (position or velocity)
module_name.j.stepgen.i.step-scaleFLOATINSteps per unit scaling
module_name.j.stepgen.i.feedbackFLOATOUTFeedback position / velocity
module_name.j.stepgen.i.modeBITIN0 = position mode, 1 = velocity mode
module_name.j.stepgen.i.enableBITINEnable this channel

Encoder Pins (per channel)

Pin nameTypeDirDescription
module_name.j.encoder.i.raw-countS32INRaw encoder counts
module_name.j.encoder.i.scaled-countS32OUTScaled encoder counts
module_name.j.encoder.i.scaleFLOATINEncoder scaling factor
module_name.j.encoder.i.positionFLOATOUTScaled position value
module_name.j.encoder.i.velocityFLOATOUTScaled velocity value
module_name.j.encoder.i.index-enableBITINEncoder index-enable

Digital Input Pins

Pin nameTypeDirDescription
module_name.j.input.gpXBITOUTDigital input state (X = GPIO pin number)

Digital Output Pins

Available when use_outputs=1:

Pin nameTypeDirDescription
module_name.j.output.gpXBITINDigital output control (X = GPIO pin number)

Spindle Pins

Pin nameTypeDirDescription
module_name.j.spindle.index-enabledBITOUTSpindle index pulse input

PWM Pins

Available when use_pwm=1:

Pin nameTypeDirDescription
module_name.j.pwm.enableBITINPWM enable
module_name.j.pwm.dutyU32INPWM duty cycle (min-limit to max-scale)
module_name.j.pwm.frequencyU32INPWM frequency (1907 – 1 000 000 Hz)
module_name.j.pwm.max-scaleU32INMaximum duty cycle scale
module_name.j.pwm.min-limitU32INMinimum duty cycle output

Debug Pins

Available when debug=1:

Pin nameTypeDirDescription
module_name.j.stepgen.max-freq-khzFLOATOUTMaximum step frequency (kHz)
module_name.j.stepgen.i.debug-stepsU32OUTStep counter for debugging

Functions (per instance)

Function nameDescription
module_name.j.watchdog-processWatchdog timer function — add to servo-thread
module_name.j.process-sendUDP transmission function — add to servo-thread
module_name.j.process-recvUDP reception function — add to servo-thread

Example HAL wiring for functions

loadrt stepper-ninja ip_address="192.168.0.177:8888"

addf stepgen-ninja.0.watchdog-process servo-thread
addf stepgen-ninja.0.process-send     servo-thread
addf stepgen-ninja.0.process-recv     servo-thread

Configuration Parameters

ParameterDescription
ip_addressArray of IP:port strings, e.g. "192.168.1.100:5000;192.168.1.101:5001"

Notes