Search Results (Searched for: estop_latch)
- tommylight

14 Feb 2025 19:37
Replied by tommylight on topic Remora - ethernet NVEM / EC300 / EC500 cnc board
Remora - ethernet NVEM / EC300 / EC500 cnc board
Category: Computers and Hardware
- rodw

16 Jan 2025 07:56 - 16 Jan 2025 07:57
Replied by rodw on topic First Start Up - E Stops
First Start Up - E Stops
Category: General LinuxCNC Questions
Well, looks like you have
so you should remove or comment out this line
net remote-estop estop-latch.0.fault-in <= hm2_[HOSTMOT2](7i96S).0.gpio.04.in_not
and replace it with this
# --- ESTOP-EXT ---
net estop-ext <= hm2_7i96s.0.inm.00.input-03so you should remove or comment out this line
net remote-estop estop-latch.0.fault-in <= hm2_[HOSTMOT2](7i96S).0.gpio.04.in_not
and replace it with this
net estop-ext => estop-latch.0.fault-in- notJamesLee
- notJamesLee
16 Jan 2025 04:06
Replied by notJamesLee on topic First Start Up - E Stops
First Start Up - E Stops
Category: General LinuxCNC Questions
okay so i went to that linked tutorial I commented out the existing estop loop and ended up actually testing code from the last entry on the first page (copied and pasted below) but modified with my pin for the estop.
Code i am using:
Now i am getting a similar error where it it thinks pins are double assigned. Should I have commented out other pin assignments? Or could i not be assinging the pin corectly?
error message:
Code i am using:
loadrt estop_latch addf estop-latch.0 servo-thread net estop-loopout iocontrol.0.emc-enable-in <= estop-latch.0.ok-out net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in net estop-reset iocontrol.0.user-request-enable => estop-latch.0.reset net remote-estop estop-latch.0.fault-in <= hm2_[HOSTMOT2](7i96s).0.gpio.040.in_notNow i am getting a similar error where it it thinks pins are double assigned. Should I have commented out other pin assignments? Or could i not be assinging the pin corectly?
error message:
.hal:258: Signal 'a-pos-fb' can not add OUT pin 'hm2_7i96s.0.encoder.00.position'. It already has OUT pin ' hm2_7i96s.0.stepgen.03.position-fb' 2034- notJamesLee
- notJamesLee
15 Jan 2025 06:10 - 15 Jan 2025 16:50
Replied by notJamesLee on topic First Start Up - E Stops
First Start Up - E Stops
Category: General LinuxCNC Questions
Thanks for the reply.
I added the code in the linked tutorial, does that bind it to a specific pin? It looks like the last line (below) assigns it to pin10? should I change this to the pin i have mine currently wired to?The video so far is very informative and ill use it as a reference when im out working on it tomorrow but no info on how to daisy chain them. I assume since they're NC i can just wire them in series to one input pin? or is that a no-no?
I added the code in the linked tutorial, does that bind it to a specific pin? It looks like the last line (below) assigns it to pin10? should I change this to the pin i have mine currently wired to?
net remote-estop estop-latch.0.fault-in <= parport.0.pin-in10-not- rodw

15 Jan 2025 03:00
Replied by rodw on topic First Start Up - E Stops
First Start Up - E Stops
Category: General LinuxCNC Questions
The better way is to use estop_latch. There is a tutorial here
forum.linuxcnc.org/47-hal-examples/25861-external-e-stop
it is possible to daisy chain multiple estop_latch components together but its not documented anywhere
I found drawing a diagram of the connections helps to work it out.
Here is video which may be useful
forum.linuxcnc.org/47-hal-examples/25861-external-e-stop
it is possible to daisy chain multiple estop_latch components together but its not documented anywhere
I found drawing a diagram of the connections helps to work it out.
Here is video which may be useful
- Benb

29 Dec 2024 04:18
Replied by Benb on topic Physical safety relay and software estop latch working together?
Physical safety relay and software estop latch working together?
Category: HAL
Hi Thomas,
For the block diagram conversion to Hal netlisting I use Eagle2hal its documentated in lthe inuxcnc wiki (old but works for me). However if I had to start again I would learn Ed Nisley's Kicad to HAL the source code is in Python also the Kicad people are planning to release a schematic API in their next release this would make it easy to make run time changes to the schematic capture and animate the schematic with realtime values.
gist.github.com/ednisley/cd69ad5a899226067d7a4a92c2114568
For the block diagram conversion to Hal netlisting I use Eagle2hal its documentated in lthe inuxcnc wiki (old but works for me). However if I had to start again I would learn Ed Nisley's Kicad to HAL the source code is in Python also the Kicad people are planning to release a schematic API in their next release this would make it easy to make run time changes to the schematic capture and animate the schematic with realtime values.
gist.github.com/ednisley/cd69ad5a899226067d7a4a92c2114568
- thomaseg
- thomaseg
28 Dec 2024 09:19
I'm not 100% sure the above diagram will work exactly like this with my setup, however your input sparked an idea to solve my "circular dependency" problem between the software and hardware latches: I need to use a "oneshot"-component to connect the two latches instead of connecting them directly(and thereby creating the problematic circular dependency). Sounds obvious now, not sure why i didn't see that option the other day. So thanks for the input, i think i have a viable way to solve this now!
Thanks!
Replied by thomaseg on topic Physical safety relay and software estop latch working together?
Physical safety relay and software estop latch working together?
Category: HAL
I like your diagrams, what do you use to make them?The hardwired diagram shows two normally open contacts in series KM1 AND KM2 indicating that the Estop is active. The rest of the circuit is similar to what you had in mind. Please do not add a screen (UI) estop or reset buttons; make it a habit to only use the external hardwired estop and reset push buttons otherwise you defeat the use of a safety system. The hal block diagram I use it to generate the hal file but it might help you understand what the hal net file does.
I'm not 100% sure the above diagram will work exactly like this with my setup, however your input sparked an idea to solve my "circular dependency" problem between the software and hardware latches: I need to use a "oneshot"-component to connect the two latches instead of connecting them directly(and thereby creating the problematic circular dependency). Sounds obvious now, not sure why i didn't see that option the other day. So thanks for the input, i think i have a viable way to solve this now!
Thanks! I couldn't wrap my head around this at first, but i think i got the gist of it now. I'll try to implement this short pulse and post the solution here for future reference.rodw post=317388 userid=20660
iocontrol.0.user-request-enable can be used as an estop reset signal (eg in place of S6). A short pulse is sent on this output for this purpose. I chose to just stick with the external reset button and connect to iocontrol.0.emc-enable-in, I used a relay on your S6 circuit to do this
Thanks!
- Benb

27 Dec 2024 01:10
Replied by Benb on topic Physical safety relay and software estop latch working together?
Physical safety relay and software estop latch working together?
Category: HAL
The hardwired diagram shows two normally open contacts in series KM1 AND KM2 indicating that the Estop is active. The rest of the circuit is similar to what you had in mind. Please do not add a screen (UI) estop or reset buttons; make it a habit to only use the external hardwired estop and reset push buttons otherwise you defeat the use of a safety system. The hal block diagram I use it to generate the hal file but it might help you understand what the hal net file does.
#
# Load realtime Components and their counts
loadrt and2 count= 1
loadrt edge count= 1
loadrt or2 count= 1
#
# Add functions to threads
addf and2.0 servo-thread
addf or2.0 servo-thread
addf edge.0 servo-thread
#
# Set parameters
setp edge.0.in-edge 0
setp edge.0.out-width-ns 20000
#
# Connect Pins with Wires
net external-ereset and2.0.in0
net external-estop or2.0.in0
net n.1 or2.0.out edge.0.in
net n.2 edge.0.out halui.estop.activate
net n.5 halui.estop.reset and2.0.out
net soft-estop-active halui.estop.is-activated and2.0.in1
net software-estop or2.0.in1
#
# Load realtime Components and their counts
loadrt and2 count= 1
loadrt edge count= 1
loadrt or2 count= 1
#
# Add functions to threads
addf and2.0 servo-thread
addf or2.0 servo-thread
addf edge.0 servo-thread
#
# Set parameters
setp edge.0.in-edge 0
setp edge.0.out-width-ns 20000
#
# Connect Pins with Wires
net external-ereset and2.0.in0
net external-estop or2.0.in0
net n.1 or2.0.out edge.0.in
net n.2 edge.0.out halui.estop.activate
net n.5 halui.estop.reset and2.0.out
net soft-estop-active halui.estop.is-activated and2.0.in1
net software-estop or2.0.in1
- rodw

26 Dec 2024 05:22
Replied by rodw on topic Physical safety relay and software estop latch working together?
Physical safety relay and software estop latch working together?
Category: HAL
iocontrol.0.user-request-enable can be used as an estop reset signal (eg in place of S6). A short pulse is sent on this output for this purpose. I chose to just stick with the external reset button and connect to iocontrol.0.emc-enable-in, I used a relay on your S6 circuit to do this
If you want an internal estop and an external estop, multiple instances of estop-latch component should let you do this.
If you want an internal estop and an external estop, multiple instances of estop-latch component should let you do this.
- thomaseg
- thomaseg
25 Dec 2024 21:44 - 25 Dec 2024 21:48
Physical safety relay and software estop latch working together? was created by thomaseg
Physical safety relay and software estop latch working together?
Category: HAL
Hi,
I've been spending the last couple of days trying to figure out how to make the "software estop" work together with my safety relay. But i'm going in circles and i need a kick from someone, maybe you?
First off, i have this physical circuit to handle the emergency stop logic in hardware:
...the idea is that estop should work without any software involvement. And everything should be as redundant as could be. I have dual (safety) contactors(KM1 + KM2) that cuts power to all drives and at the same time prevents resetting the estop-circuit in cause of failure. I have a proper estop-button(it's redundant contacts, but only shown as one here in S5). On top of that i have added an inline relay, K13, which can be triggered by software, aswell as the wire "1" which goes to an input in LinuxCNC in order to tell it the state of the safety relay. There is a short delay(~0,5sec) between the two sets of relays in the safety relay, so ideally the signal to LinuxCNC should be able to tell the servos to emergency stop just before the power is killed.
So far, so good. Everything works just like i want it. The latching works excellent and the signals to and from LinuxCNC also works as expected....
However, i'm totally going in circles when i try to add an estop latch inside LinuxCNC to work in conjunction with the hardware safety relay. I took inspiration from a thread from the user Unlogic who seem to have it working. But i end up having a latch #1 that depends on latch #2 that depends on latch #1 again....ehh... so currently i'm just having the inputs tied into LinuxCNC like this:
..this "sorta works" and prevents anything powering on before LinuxCNC has booted properly. However the UI experience is kinda bad as i have to press a button extra and there is not really any feedback to the user 
SO, the question: Has anyone got a combination of a physical safetyrelay and an estop latch to work "like it should"? I'd be very interested in seeing how others have solved this issue...
/Thomas
I've been spending the last couple of days trying to figure out how to make the "software estop" work together with my safety relay. But i'm going in circles and i need a kick from someone, maybe you?
First off, i have this physical circuit to handle the emergency stop logic in hardware:
...the idea is that estop should work without any software involvement. And everything should be as redundant as could be. I have dual (safety) contactors(KM1 + KM2) that cuts power to all drives and at the same time prevents resetting the estop-circuit in cause of failure. I have a proper estop-button(it's redundant contacts, but only shown as one here in S5). On top of that i have added an inline relay, K13, which can be triggered by software, aswell as the wire "1" which goes to an input in LinuxCNC in order to tell it the state of the safety relay. There is a short delay(~0,5sec) between the two sets of relays in the safety relay, so ideally the signal to LinuxCNC should be able to tell the servos to emergency stop just before the power is killed.
So far, so good. Everything works just like i want it. The latching works excellent and the signals to and from LinuxCNC also works as expected....
However, i'm totally going in circles when i try to add an estop latch inside LinuxCNC to work in conjunction with the hardware safety relay. I took inspiration from a thread from the user Unlogic who seem to have it working. But i end up having a latch #1 that depends on latch #2 that depends on latch #1 again....ehh... so currently i'm just having the inputs tied into LinuxCNC like this:
net estop-loopout iocontrol.0.emc-enable-in <= lcec.0.DI1.din-0 # This is the signal from wire "1"
net estop-relay iocontrol.0.user-enable-out => lcec.0.DO1.dout-3 # This is relay K13SO, the question: Has anyone got a combination of a physical safetyrelay and an estop latch to work "like it should"? I'd be very interested in seeing how others have solved this issue...
/Thomas
- Sternfox
- Sternfox
24 Dec 2024 18:25
Replied by Sternfox on topic Timed delay
Timed delay
Category: Advanced Configuration
Thanks for the code, im getting this error on startup ./main.hal:239: Pin 'xor.0.in0' does not exist
here is my hal file
# This file was created with the Mesa Configuration Tool on Nov 26 2024 15:50:59
# If you make changes to this file DO NOT run the configuration tool again!
# This file will be replaced with a new file if you do!
# kinematics
loadrt [KINS](KINEMATICS)
# motion controller
loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS]JOINTS num_dio=30 num_aio=30
# hostmot2 driver
loadrt hostmot2
loadrt [HM2](DRIVER) board_ip=[HM2](ADDRESS) config="sserial_port_0=00000000"
loadrt oneshot count=1
setp hm2_[MESA](BOARD).0.watchdog.timeout_ns 10000000
loadrt timedelay count=1
loadrt xor2
loadrt pid names=pid.x,pid.y,pid.z,pid.s
# PID Information for Stepper Boards
# Mesa hardware step generators at every servo thread invocation, the step
# generator hardware is given a new velocity. Without feedback from the PID
# controller the hardware position would slowly drift because of clock speed and
# timing differences between LinuxCNC and the step generator hardware.
# The PID controller gets feedback from the actual (fractional) step position and
# corrects for these small differences.
# THREADS
addf hm2_[MESA](BOARD).0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.y.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf hm2_[MESA](BOARD).0.write servo-thread
addf timedelay.0 servo-thread
addf xor2.0 servo-thread
# DPLL TIMER
setp hm2_[MESA](BOARD).0.dpll.01.timer-us -50
setp hm2_[MESA](BOARD).0.stepgen.timer-number 1
# amp enable
#net motion-enable <= motion.motion-enabled => hm2_7i95.0.ssr.00.out-02
# Spindle Air Oil solenoid
# Board: 7i95
# Axis: X Joint: 0 Output: 0
# PID Setup
setp pid.x.Pgain [JOINT_0](P)
setp pid.x.Igain [JOINT_0](I)
setp pid.x.Dgain [JOINT_0](D)
setp pid.x.bias [JOINT_0](BIAS)
setp pid.x.FF0 [JOINT_0](FF0)
setp pid.x.FF1 [JOINT_0](FF1)
setp pid.x.FF2 [JOINT_0](FF2)
setp pid.x.deadband [JOINT_0](DEADBAND)
setp pid.x.maxoutput [JOINT_0](MAX_OUTPUT)
setp pid.x.error-previous-target True
# limit stepgen velocity corrections caused by position feedback jitter
setp pid.x.maxerror [JOINT_0](MAX_ERROR)
# joint-0 enable chain
net joint-0-index-enable <=> pid.x.index-enable
net joint-0-index-enable <=> joint.0.index-enable
net joint-0-enable <= joint.0.amp-enable-out
net joint-0-enable => pid.x.enable
net joint-0-enable => hm2_[MESA](BOARD).0.stepgen.00.enable
# Joint 0 Step Generator Settings
setp hm2_[MESA](BOARD).0.stepgen.00.dirsetup [JOINT_0](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.00.dirhold [JOINT_0](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.00.steplen [JOINT_0](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.00.stepspace [JOINT_0](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.00.position-scale [JOINT_0](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.00.maxvel [JOINT_0](STEPGEN_MAX_VEL)
setp hm2_[MESA](BOARD).0.stepgen.00.maxaccel [JOINT_0](STEPGEN_MAX_ACC)
setp hm2_[MESA](BOARD).0.stepgen.00.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.00.control-type 1
# position command and feedback
net joint-0-pos-cmd <= joint.0.motor-pos-cmd
net joint-0-pos-cmd => pid.x.command
net joint-0-pos-fb <= hm2_[MESA](BOARD).0.stepgen.00.position-fb
net joint-0-pos-fb => joint.0.motor-pos-fb
net joint-0-pos-fb => pid.x.feedback
# PID Output
net joint.0.output <= pid.x.output
net joint.0.output => hm2_[MESA](BOARD).0.stepgen.00.velocity-cmd
# Axis: Y Joint: 1 Output: 1
# PID Setup
setp pid.y.Pgain [JOINT_1](P)
setp pid.y.Igain [JOINT_1](I)
setp pid.y.Dgain [JOINT_1](D)
setp pid.y.bias [JOINT_1](BIAS)
setp pid.y.FF0 [JOINT_1](FF0)
setp pid.y.FF1 [JOINT_1](FF1)
setp pid.y.FF2 [JOINT_1](FF2)
setp pid.y.deadband [JOINT_1](DEADBAND)
setp pid.y.maxoutput [JOINT_1](MAX_OUTPUT)
setp pid.y.error-previous-target True
# limit stepgen velocity corrections caused by position feedback jitter
setp pid.y.maxerror [JOINT_1](MAX_ERROR)
# joint-1 enable chain
net joint-1-index-enable <=> pid.y.index-enable
net joint-1-index-enable <=> joint.1.index-enable
net joint-1-enable <= joint.1.amp-enable-out
net joint-1-enable => pid.y.enable
net joint-1-enable => hm2_[MESA](BOARD).0.stepgen.01.enable
# Joint 1 Step Generator Settings
setp hm2_[MESA](BOARD).0.stepgen.01.dirsetup [JOINT_1](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.01.dirhold [JOINT_1](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.01.steplen [JOINT_1](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.01.stepspace [JOINT_1](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.01.position-scale [JOINT_1](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.01.maxvel [JOINT_1](STEPGEN_MAX_VEL)
setp hm2_[MESA](BOARD).0.stepgen.01.maxaccel [JOINT_1](STEPGEN_MAX_ACC)
setp hm2_[MESA](BOARD).0.stepgen.01.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.01.control-type 1
# position command and feedback
net joint-1-pos-cmd <= joint.1.motor-pos-cmd
net joint-1-pos-cmd => pid.y.command
net joint-1-pos-fb <= hm2_[MESA](BOARD).0.stepgen.01.position-fb
net joint-1-pos-fb => joint.1.motor-pos-fb
net joint-1-pos-fb => pid.y.feedback
# PID Output
net joint.1.output <= pid.y.output
net joint.1.output => hm2_[MESA](BOARD).0.stepgen.01.velocity-cmd
# Axis: Z Joint: 2 Output: 2
# PID Setup
setp pid.z.Pgain [JOINT_2](P)
setp pid.z.Igain [JOINT_2](I)
setp pid.z.Dgain [JOINT_2](D)
setp pid.z.bias [JOINT_2](BIAS)
setp pid.z.FF0 [JOINT_2](FF0)
setp pid.z.FF1 [JOINT_2](FF1)
setp pid.z.FF2 [JOINT_2](FF2)
setp pid.z.deadband [JOINT_2](DEADBAND)
setp pid.z.maxoutput [JOINT_2](MAX_OUTPUT)
setp pid.z.error-previous-target True
# limit stepgen velocity corrections caused by position feedback jitter
setp pid.z.maxerror [JOINT_2](MAX_ERROR)
# joint-2 enable chain
net joint-2-index-enable <=> pid.z.index-enable
net joint-2-index-enable <=> joint.2.index-enable
net joint-2-enable <= joint.2.amp-enable-out
net joint-2-enable => pid.z.enable
net joint-2-enable => hm2_[MESA](BOARD).0.stepgen.02.enable
# Joint 2 Step Generator Settings
setp hm2_[MESA](BOARD).0.stepgen.02.dirsetup [JOINT_2](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.02.dirhold [JOINT_2](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.02.steplen [JOINT_2](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.02.stepspace [JOINT_2](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.02.position-scale [JOINT_2](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.02.maxvel [JOINT_2](STEPGEN_MAX_VEL)
setp hm2_[MESA](BOARD).0.stepgen.02.maxaccel [JOINT_2](STEPGEN_MAX_ACC)
setp hm2_[MESA](BOARD).0.stepgen.02.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.02.control-type 1
# position command and feedback
net joint-2-pos-cmd <= joint.2.motor-pos-cmd
net joint-2-pos-cmd => pid.z.command
net joint-2-pos-fb <= hm2_[MESA](BOARD).0.stepgen.02.position-fb
net joint-2-pos-fb => joint.2.motor-pos-fb
net joint-2-pos-fb => pid.z.feedback
# PID Output
net joint.2.output <= pid.z.output
net joint.2.output => hm2_[MESA](BOARD).0.stepgen.02.velocity-cmd
# Manual Tool Change Dialog
loadusr -W hal_manualtoolchange
net tool-change-request => hal_manualtoolchange.change
net tool-change-confirmed <= hal_manualtoolchange.changed
net tool-number => hal_manualtoolchange.number
# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
# # Load Classicladder without GUI
loadrt classicladder_rt
addf classicladder.0.refresh servo-thread 1
# E-Stop Chain
loadrt estop_latch count=1
addf estop-latch.0 servo-thread
# E-Stop Loop
net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in
net estop-loopout estop-latch.0.ok-out => iocontrol.0.emc-enable-in
# E-Stop Reset
net estop-reset iocontrol.0.user-request-enable
net estop-reset => estop-latch.0.reset
net remote-estop0 estop-latch.0.fault-in <= hm2_7i95.0.inmux.00.input-01-not
# Input and output configuration
net button-press <= hm2_7i95.0.inmux.00.input-05 # Connect input pin 5 to signal button-press
net relay-1-control => hm2_7i95.0.ssr.00.out-01 # Connect signal relay-1-control to relay output 1
net relay-2-control => hm2_7i95.0.ssr.00.out-03 # Connect signal relay-2-control to relay output 3
setp timedelay.0.on-delay 1.0 # 1-second delay
setp timedelay.0.off-delay 0.0 # No off delay
# Timedelay connections
net button-press => timedelay.0.in xor.0.in0 # Link button-press to timedelay and logic
net relay-1-control <= timedelay.0.out xor.0.in1 # Link timedelay output to relay-1-control and logic
net relay-2-control <= xor.0.out # Link xor out to relay-2-control
#*******************
# SPINDLE
#*******************
setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
setp pid.s.maxoutput [SPINDLE_0]MAX_OUTPUT
setp pid.s.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.s.maxerror 0.012700
net spindle-index-enable => pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm => pid.s.command
net spindle-vel-fb-rpm => pid.s.feedback
net spindle-output <= pid.s.output
# Step Gen signals/setup
setp hm2_[MESA](BOARD).0.stepgen.03.dirsetup [SPINDLE_0]DIRSETUP
setp hm2_[MESA](BOARD).0.stepgen.03.dirhold [SPINDLE_0]DIRHOLD
setp hm2_[MESA](BOARD).0.stepgen.03.steplen [SPINDLE_0]STEPLEN
setp hm2_[MESA](BOARD).0.stepgen.03.stepspace [SPINDLE_0]STEPSPACE
setp hm2_[MESA](BOARD).0.stepgen.03.position-scale [SPINDLE_0]SCALE
setp hm2_[MESA](BOARD).0.stepgen.03.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.03.control-type 1
setp hm2_[MESA](BOARD).0.stepgen.03.maxaccel [SPINDLE_0]STEPGEN_MAX_ACC
setp hm2_[MESA](BOARD).0.stepgen.03.maxvel [SPINDLE_0]STEPGEN_MAX_VEL
net machine-is-on => hm2_[MESA](BOARD).0.stepgen.03.enable
net spindle-vel-cmd-rps => hm2_[MESA](BOARD).0.stepgen.03.velocity-cmd
net spindle-vel-fb-rps <= hm2_[MESA](BOARD).0.stepgen.03.velocity-fb
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
# ---Setup spindle at speed signals---
sets spindle-at-speed true
net spindle-manual-cw halui.spindle.0.forward
net spindle-manual-ccw halui.spindle.0.reverse
net spindle-manual-stop halui.spindle.0.stop
here is my hal file
# This file was created with the Mesa Configuration Tool on Nov 26 2024 15:50:59
# If you make changes to this file DO NOT run the configuration tool again!
# This file will be replaced with a new file if you do!
# kinematics
loadrt [KINS](KINEMATICS)
# motion controller
loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS]JOINTS num_dio=30 num_aio=30
# hostmot2 driver
loadrt hostmot2
loadrt [HM2](DRIVER) board_ip=[HM2](ADDRESS) config="sserial_port_0=00000000"
loadrt oneshot count=1
setp hm2_[MESA](BOARD).0.watchdog.timeout_ns 10000000
loadrt timedelay count=1
loadrt xor2
loadrt pid names=pid.x,pid.y,pid.z,pid.s
# PID Information for Stepper Boards
# Mesa hardware step generators at every servo thread invocation, the step
# generator hardware is given a new velocity. Without feedback from the PID
# controller the hardware position would slowly drift because of clock speed and
# timing differences between LinuxCNC and the step generator hardware.
# The PID controller gets feedback from the actual (fractional) step position and
# corrects for these small differences.
# THREADS
addf hm2_[MESA](BOARD).0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.y.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf hm2_[MESA](BOARD).0.write servo-thread
addf timedelay.0 servo-thread
addf xor2.0 servo-thread
# DPLL TIMER
setp hm2_[MESA](BOARD).0.dpll.01.timer-us -50
setp hm2_[MESA](BOARD).0.stepgen.timer-number 1
# amp enable
#net motion-enable <= motion.motion-enabled => hm2_7i95.0.ssr.00.out-02
# Spindle Air Oil solenoid
# Board: 7i95
# Axis: X Joint: 0 Output: 0
# PID Setup
setp pid.x.Pgain [JOINT_0](P)
setp pid.x.Igain [JOINT_0](I)
setp pid.x.Dgain [JOINT_0](D)
setp pid.x.bias [JOINT_0](BIAS)
setp pid.x.FF0 [JOINT_0](FF0)
setp pid.x.FF1 [JOINT_0](FF1)
setp pid.x.FF2 [JOINT_0](FF2)
setp pid.x.deadband [JOINT_0](DEADBAND)
setp pid.x.maxoutput [JOINT_0](MAX_OUTPUT)
setp pid.x.error-previous-target True
# limit stepgen velocity corrections caused by position feedback jitter
setp pid.x.maxerror [JOINT_0](MAX_ERROR)
# joint-0 enable chain
net joint-0-index-enable <=> pid.x.index-enable
net joint-0-index-enable <=> joint.0.index-enable
net joint-0-enable <= joint.0.amp-enable-out
net joint-0-enable => pid.x.enable
net joint-0-enable => hm2_[MESA](BOARD).0.stepgen.00.enable
# Joint 0 Step Generator Settings
setp hm2_[MESA](BOARD).0.stepgen.00.dirsetup [JOINT_0](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.00.dirhold [JOINT_0](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.00.steplen [JOINT_0](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.00.stepspace [JOINT_0](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.00.position-scale [JOINT_0](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.00.maxvel [JOINT_0](STEPGEN_MAX_VEL)
setp hm2_[MESA](BOARD).0.stepgen.00.maxaccel [JOINT_0](STEPGEN_MAX_ACC)
setp hm2_[MESA](BOARD).0.stepgen.00.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.00.control-type 1
# position command and feedback
net joint-0-pos-cmd <= joint.0.motor-pos-cmd
net joint-0-pos-cmd => pid.x.command
net joint-0-pos-fb <= hm2_[MESA](BOARD).0.stepgen.00.position-fb
net joint-0-pos-fb => joint.0.motor-pos-fb
net joint-0-pos-fb => pid.x.feedback
# PID Output
net joint.0.output <= pid.x.output
net joint.0.output => hm2_[MESA](BOARD).0.stepgen.00.velocity-cmd
# Axis: Y Joint: 1 Output: 1
# PID Setup
setp pid.y.Pgain [JOINT_1](P)
setp pid.y.Igain [JOINT_1](I)
setp pid.y.Dgain [JOINT_1](D)
setp pid.y.bias [JOINT_1](BIAS)
setp pid.y.FF0 [JOINT_1](FF0)
setp pid.y.FF1 [JOINT_1](FF1)
setp pid.y.FF2 [JOINT_1](FF2)
setp pid.y.deadband [JOINT_1](DEADBAND)
setp pid.y.maxoutput [JOINT_1](MAX_OUTPUT)
setp pid.y.error-previous-target True
# limit stepgen velocity corrections caused by position feedback jitter
setp pid.y.maxerror [JOINT_1](MAX_ERROR)
# joint-1 enable chain
net joint-1-index-enable <=> pid.y.index-enable
net joint-1-index-enable <=> joint.1.index-enable
net joint-1-enable <= joint.1.amp-enable-out
net joint-1-enable => pid.y.enable
net joint-1-enable => hm2_[MESA](BOARD).0.stepgen.01.enable
# Joint 1 Step Generator Settings
setp hm2_[MESA](BOARD).0.stepgen.01.dirsetup [JOINT_1](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.01.dirhold [JOINT_1](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.01.steplen [JOINT_1](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.01.stepspace [JOINT_1](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.01.position-scale [JOINT_1](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.01.maxvel [JOINT_1](STEPGEN_MAX_VEL)
setp hm2_[MESA](BOARD).0.stepgen.01.maxaccel [JOINT_1](STEPGEN_MAX_ACC)
setp hm2_[MESA](BOARD).0.stepgen.01.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.01.control-type 1
# position command and feedback
net joint-1-pos-cmd <= joint.1.motor-pos-cmd
net joint-1-pos-cmd => pid.y.command
net joint-1-pos-fb <= hm2_[MESA](BOARD).0.stepgen.01.position-fb
net joint-1-pos-fb => joint.1.motor-pos-fb
net joint-1-pos-fb => pid.y.feedback
# PID Output
net joint.1.output <= pid.y.output
net joint.1.output => hm2_[MESA](BOARD).0.stepgen.01.velocity-cmd
# Axis: Z Joint: 2 Output: 2
# PID Setup
setp pid.z.Pgain [JOINT_2](P)
setp pid.z.Igain [JOINT_2](I)
setp pid.z.Dgain [JOINT_2](D)
setp pid.z.bias [JOINT_2](BIAS)
setp pid.z.FF0 [JOINT_2](FF0)
setp pid.z.FF1 [JOINT_2](FF1)
setp pid.z.FF2 [JOINT_2](FF2)
setp pid.z.deadband [JOINT_2](DEADBAND)
setp pid.z.maxoutput [JOINT_2](MAX_OUTPUT)
setp pid.z.error-previous-target True
# limit stepgen velocity corrections caused by position feedback jitter
setp pid.z.maxerror [JOINT_2](MAX_ERROR)
# joint-2 enable chain
net joint-2-index-enable <=> pid.z.index-enable
net joint-2-index-enable <=> joint.2.index-enable
net joint-2-enable <= joint.2.amp-enable-out
net joint-2-enable => pid.z.enable
net joint-2-enable => hm2_[MESA](BOARD).0.stepgen.02.enable
# Joint 2 Step Generator Settings
setp hm2_[MESA](BOARD).0.stepgen.02.dirsetup [JOINT_2](DIRSETUP)
setp hm2_[MESA](BOARD).0.stepgen.02.dirhold [JOINT_2](DIRHOLD)
setp hm2_[MESA](BOARD).0.stepgen.02.steplen [JOINT_2](STEPLEN)
setp hm2_[MESA](BOARD).0.stepgen.02.stepspace [JOINT_2](STEPSPACE)
setp hm2_[MESA](BOARD).0.stepgen.02.position-scale [JOINT_2](SCALE)
setp hm2_[MESA](BOARD).0.stepgen.02.maxvel [JOINT_2](STEPGEN_MAX_VEL)
setp hm2_[MESA](BOARD).0.stepgen.02.maxaccel [JOINT_2](STEPGEN_MAX_ACC)
setp hm2_[MESA](BOARD).0.stepgen.02.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.02.control-type 1
# position command and feedback
net joint-2-pos-cmd <= joint.2.motor-pos-cmd
net joint-2-pos-cmd => pid.z.command
net joint-2-pos-fb <= hm2_[MESA](BOARD).0.stepgen.02.position-fb
net joint-2-pos-fb => joint.2.motor-pos-fb
net joint-2-pos-fb => pid.z.feedback
# PID Output
net joint.2.output <= pid.z.output
net joint.2.output => hm2_[MESA](BOARD).0.stepgen.02.velocity-cmd
# Manual Tool Change Dialog
loadusr -W hal_manualtoolchange
net tool-change-request => hal_manualtoolchange.change
net tool-change-confirmed <= hal_manualtoolchange.changed
net tool-number => hal_manualtoolchange.number
# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
# # Load Classicladder without GUI
loadrt classicladder_rt
addf classicladder.0.refresh servo-thread 1
# E-Stop Chain
loadrt estop_latch count=1
addf estop-latch.0 servo-thread
# E-Stop Loop
net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in
net estop-loopout estop-latch.0.ok-out => iocontrol.0.emc-enable-in
# E-Stop Reset
net estop-reset iocontrol.0.user-request-enable
net estop-reset => estop-latch.0.reset
net remote-estop0 estop-latch.0.fault-in <= hm2_7i95.0.inmux.00.input-01-not
# Input and output configuration
net button-press <= hm2_7i95.0.inmux.00.input-05 # Connect input pin 5 to signal button-press
net relay-1-control => hm2_7i95.0.ssr.00.out-01 # Connect signal relay-1-control to relay output 1
net relay-2-control => hm2_7i95.0.ssr.00.out-03 # Connect signal relay-2-control to relay output 3
setp timedelay.0.on-delay 1.0 # 1-second delay
setp timedelay.0.off-delay 0.0 # No off delay
# Timedelay connections
net button-press => timedelay.0.in xor.0.in0 # Link button-press to timedelay and logic
net relay-1-control <= timedelay.0.out xor.0.in1 # Link timedelay output to relay-1-control and logic
net relay-2-control <= xor.0.out # Link xor out to relay-2-control
#*******************
# SPINDLE
#*******************
setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
setp pid.s.maxoutput [SPINDLE_0]MAX_OUTPUT
setp pid.s.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.s.maxerror 0.012700
net spindle-index-enable => pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm => pid.s.command
net spindle-vel-fb-rpm => pid.s.feedback
net spindle-output <= pid.s.output
# Step Gen signals/setup
setp hm2_[MESA](BOARD).0.stepgen.03.dirsetup [SPINDLE_0]DIRSETUP
setp hm2_[MESA](BOARD).0.stepgen.03.dirhold [SPINDLE_0]DIRHOLD
setp hm2_[MESA](BOARD).0.stepgen.03.steplen [SPINDLE_0]STEPLEN
setp hm2_[MESA](BOARD).0.stepgen.03.stepspace [SPINDLE_0]STEPSPACE
setp hm2_[MESA](BOARD).0.stepgen.03.position-scale [SPINDLE_0]SCALE
setp hm2_[MESA](BOARD).0.stepgen.03.step_type 0
setp hm2_[MESA](BOARD).0.stepgen.03.control-type 1
setp hm2_[MESA](BOARD).0.stepgen.03.maxaccel [SPINDLE_0]STEPGEN_MAX_ACC
setp hm2_[MESA](BOARD).0.stepgen.03.maxvel [SPINDLE_0]STEPGEN_MAX_VEL
net machine-is-on => hm2_[MESA](BOARD).0.stepgen.03.enable
net spindle-vel-cmd-rps => hm2_[MESA](BOARD).0.stepgen.03.velocity-cmd
net spindle-vel-fb-rps <= hm2_[MESA](BOARD).0.stepgen.03.velocity-fb
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
# ---Setup spindle at speed signals---
sets spindle-at-speed true
net spindle-manual-cw halui.spindle.0.forward
net spindle-manual-ccw halui.spindle.0.reverse
net spindle-manual-stop halui.spindle.0.stop
Time to create page: 1.424 seconds