From b3d7d3a5ed13cf22e7ee0733adb87623cec86daf Mon Sep 17 00:00:00 2001 From: bartool Date: Sun, 7 Jun 2026 07:30:07 +0200 Subject: [PATCH] skopiowana konfiguracja z expertia --- mayo-mill-remora.hal | 169 ++++++++++++++++++++++------------ mayo-mill-remora.ini | 30 ++++--- remora_pico_config.json | 194 ++++++++++++++++++++++++++-------------- remora_pico_config.txt | 127 ++++++++++++++++++++++++++ 4 files changed, 383 insertions(+), 137 deletions(-) create mode 100644 remora_pico_config.txt diff --git a/mayo-mill-remora.hal b/mayo-mill-remora.hal index 9344845..6ef3b31 100644 --- a/mayo-mill-remora.hal +++ b/mayo-mill-remora.hal @@ -1,69 +1,128 @@ -# Generated by stepconf, adapted for Remora Ethernet on RP2040 -# Using W5500-EVB-Pico or RP2040 with W5500 module +# Basic HAL config file for NVEM controller board running Remora firmware +# Configured for 3 joints (A, Y, Z axes) with home and limit switches loadrt [KINS]KINEMATICS -loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_dio=6 num_aio=3 -loadrt remora-eth-3.0 +loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS -# Add Remora read/update/write functions to the servo thread -addf remora.read servo-thread -addf motion-command-handler servo-thread -addf motion-controller servo-thread -addf remora.update servo-thread -addf remora.write servo-thread +# load the Remora real-time component -# --- ESTOP --- -net estop-out <= iocontrol.0.user-enable-out + loadrt remora-eth PRU_base_freq=75000 + + loadrt estop_latch names=estop_latch + loadrt and2 names=run_and,step_and + loadrt toggle names=hold_button_toggle + loadrt toggle2nist names=hold_toggle,paused_toggle -# E-stop input from Remora input 3 (GP28) -# If your hardware E-stop switch is active-low (Normally Closed to GND, open on press) -# and you need to invert it in HAL, you can load a 'not' component. -# Otherwise, we connect it directly here: -net estop-ext <= remora.input.3 => iocontrol.0.emc-enable-in +# add the remora and motion functions to threads -# --- PROBE --- -# Probe input from Remora input 4 (GP27) -net probe-in <= remora.input.4 => motion.probe-input + addf remora.read servo-thread + addf motion-command-handler servo-thread + addf motion-controller servo-thread + addf remora.update-freq servo-thread + addf remora.write servo-thread + addf estop_latch servo-thread + addf run_and servo-thread + addf step_and servo-thread + addf hold_toggle servo-thread + addf hold_button_toggle servo-thread -# --- SPINDLE --- -# Spindle signal is driven in custom.hal, we connect it here to the Remora output 0 (GP8) -net spindle-on => remora.output.0 +#toggle2nist states & mux selectors +# net program-is-paused hold_toggle.is-on <= halui.program.is-paused -# --- JOINT 0 (X AXIS) --- -setp remora.joint.0.scale [JOINT_0]SCALE -setp remora.joint.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL -setp remora.joint.0.pgain [JOINT_0]P_GAIN -setp remora.joint.0.deadband [JOINT_0]DEADBAND +# vfdmod - uncomment the below if using vfdmod (default). There are also a couple items to edit in spindle_load.hal +# loadusr -W vfdmod vfdmod.ini +# net spindle-speed-cmd vfdmod.spindle.rpm-in <= spindle.0.speed-out +# net spindle-speed-fb vfdmod.spindle.rpm-out <= spindle.0.speed-in +# net spindle-at-speed vfdmod.spindle.at-speed <= spindle.0.at-speed +# net spindle-forward vfdmod.control.run-forward <= spindle.0.forward +# net spindle-reverse vfdmod.control.run-reverse <= spindle.0.reverse + +# estop and SPI comms enable and feedback -net xpos-cmd joint.0.motor-pos-cmd => remora.joint.0.pos-cmd -net xpos-fb remora.joint.0.pos-fb => joint.0.motor-pos-fb -net xenable joint.0.amp-enable-out => remora.joint.0.enable -net home-x <= remora.input.0 => joint.0.home-sw-in + net user-enable-out <= iocontrol.0.user-enable-out => remora.enable + net user-request-enable <= iocontrol.0.user-request-enable => remora.reset estop_latch.reset + #Halt is shared with motor alarms and is in the estop loop. + #estop_latch returns 'ok' when fault-in is false, ok-in is true, and reset changes from false to true. + net estop-fault_in remora.input.07 => estop_latch.fault-in + net remora-status remora.status => estop_latch.ok-in + net estop-status estop_latch.ok-out => iocontrol.0.emc-enable-in -# --- JOINT 1 (Y AXIS) --- -setp remora.joint.1.scale [JOINT_1]SCALE -setp remora.joint.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL -setp remora.joint.1.pgain [JOINT_1]P_GAIN -setp remora.joint.1.deadband [JOINT_1]DEADBAND -net ypos-cmd joint.1.motor-pos-cmd => remora.joint.1.pos-cmd -net ypos-fb remora.joint.1.pos-fb => joint.1.motor-pos-fb -net yenable joint.1.amp-enable-out => remora.joint.1.enable -net home-y <= remora.input.1 => joint.1.home-sw-in +# joint 0 setup (X axis) -# --- JOINT 2 (Z AXIS) --- -setp remora.joint.2.scale [JOINT_2]SCALE -setp remora.joint.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL -setp remora.joint.2.pgain [JOINT_2]P_GAIN -setp remora.joint.2.deadband [JOINT_2]DEADBAND + setp remora.joint.0.scale [JOINT_0]SCALE + setp remora.joint.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL + setp remora.joint.0.pgain [JOINT_0]P_GAIN + setp remora.joint.0.ff1gain [JOINT_0]FF1_GAIN + setp remora.joint.0.deadband [JOINT_0]DEADBAND -net zpos-cmd joint.2.motor-pos-cmd => remora.joint.2.pos-cmd -net zpos-fb remora.joint.2.pos-fb => joint.2.motor-pos-fb -net zenable joint.2.amp-enable-out => remora.joint.2.enable -net home-z <= remora.input.2 => joint.2.home-sw-in + net j0pos-cmd joint.0.motor-pos-cmd => remora.joint.0.pos-cmd + net j0pos-fb remora.joint.0.pos-fb => joint.0.motor-pos-fb + net j0enable joint.0.amp-enable-out => remora.joint.0.enable + + net x-home joint.0.home-sw-in => remora.input.00 -# --- TOOL CHANGE --- -net tool-change-request <= iocontrol.0.tool-change -net tool-change-confirmed => iocontrol.0.tool-changed -net tool-number <= iocontrol.0.tool-prep-number -net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +# joint 1 setup (Y axis) + + setp remora.joint.1.scale [JOINT_1]SCALE + setp remora.joint.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL + setp remora.joint.1.pgain [JOINT_1]P_GAIN + setp remora.joint.1.ff1gain [JOINT_1]FF1_GAIN + setp remora.joint.1.deadband [JOINT_1]DEADBAND + + net j1pos-cmd joint.1.motor-pos-cmd => remora.joint.1.pos-cmd + net j1pos-fb remora.joint.1.pos-fb => joint.1.motor-pos-fb + net j1enable joint.1.amp-enable-out => remora.joint.1.enable + + net y-home joint.1.home-sw-in => remora.input.01 + +# joint 2 setup (Z axis) + + setp remora.joint.2.scale [JOINT_2]SCALE + setp remora.joint.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL + setp remora.joint.2.pgain [JOINT_2]P_GAIN + setp remora.joint.2.ff1gain [JOINT_2]FF1_GAIN + setp remora.joint.2.deadband [JOINT_2]DEADBAND + + net j2pos-cmd joint.2.motor-pos-cmd => remora.joint.2.pos-cmd + net j2pos-fb remora.joint.2.pos-fb => joint.2.motor-pos-fb + net j2enable joint.2.amp-enable-out => remora.joint.2.enable + + net z-home joint.2.home-sw-in => remora.input.02 + +# Motor enables + + net j0enable => remora.output.00 + net j1enable => remora.output.01 + net j2enable => remora.output.02 + +# Flood and mist outputs +# net flood remora.output.02 <= iocontrol.0.coolant-flood +# net mist remora.output.03 <= iocontrol.0.coolant-mist + +# User buttons + #Halt is shared with motor alarms and is up in the estop loop. + + #Hold logic +# net hold_button remora.input.05 => hold_button_toggle.in +# net hold_toggle_latch hold_button_toggle.out => hold_toggle.in +# net hold_on halui.program.pause <= hold_toggle.on +# net hold_off halui.program.resume <= hold_toggle.off + + #Cycle start logic. When not running, start the program. When in feed hold, single step through the program. +# net run-step_button remora.input.06 => run_and.in0 step_and.in0 +# net program-is-idle halui.program.is-idle => run_and.in1 #if not running AND button pressed +# net program-run run_and.out => halui.program.run #run program +# net program-is-paused => step_and.in1 #if paused AND button pressed +# net single-step step_and.out => halui.program.step #single step + + +# Probe + net probe-in motion.probe-input <= remora.input.08 + +# Manual toolchange + + net tool-change-request <= iocontrol.0.tool-change + net tool-change-confirmed => iocontrol.0.tool-changed + net tool-number <= iocontrol.0.tool-prep-number + net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared \ No newline at end of file diff --git a/mayo-mill-remora.ini b/mayo-mill-remora.ini index b575e71..93cd27b 100644 --- a/mayo-mill-remora.ini +++ b/mayo-mill-remora.ini @@ -83,8 +83,7 @@ TWOPASS = one [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 -# BASE_PERIOD is not required for Remora hardware step generation -# BASE_PERIOD = 100000 +BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [EMCIO] @@ -125,14 +124,15 @@ MAX_VELOCITY = 50.0 MAX_ACCELERATION = 500.0 STEPGEN_MAXACCEL = 625.0 SCALE = 80.0 -FERROR = 1 -MIN_FERROR = .25 +FERROR = 2.0 +MIN_FERROR = 2 +FF1_GAIN = 1 +P_GAIN = 1.0 +DEADBAND = 0.005 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = -20.000000 HOME_LATCH_VEL = -6.250000 HOME_SEQUENCE = 2 -P_GAIN = 1000.0 -DEADBAND = 0.001 #****************************************** #*** AXIS_Y ******************************* @@ -151,14 +151,15 @@ MAX_VELOCITY = 50.0 MAX_ACCELERATION = 500.0 STEPGEN_MAXACCEL = 625.0 SCALE = 80.0 -FERROR = 1 -MIN_FERROR = .25 +FERROR = 2.0 +MIN_FERROR = 2 +FF1_GAIN = 1 +P_GAIN = 1.0 +DEADBAND = 0.005 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = -20.000000 HOME_LATCH_VEL = -6.250000 HOME_SEQUENCE = 1 -P_GAIN = 1000.0 -DEADBAND = 0.001 #****************************************** #*** AXIS_Z ******************************* @@ -177,12 +178,13 @@ MAX_VELOCITY = 25.0 MAX_ACCELERATION = 500.0 STEPGEN_MAXACCEL = 625.0 SCALE = 80.0 -FERROR = 1 -MIN_FERROR = .25 +FERROR = 2 +MIN_FERROR = 2 +FF1_GAIN = 1 +P_GAIN = 1.0 +DEADBAND = 0.005 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = 10.000000 HOME_LATCH_VEL = 6.250000 HOME_SEQUENCE = 0 -P_GAIN = 1000.0 -DEADBAND = 0.001 #****************************************** diff --git a/remora_pico_config.json b/remora_pico_config.json index 534bd5a..0117a6a 100644 --- a/remora_pico_config.json +++ b/remora_pico_config.json @@ -1,69 +1,127 @@ { - "Version": "1.0", - "Communication": { - "Type": "Ethernet", - "IP": "10.10.10.10", - "Port": 27182 - }, - "Hardware": { - "Modules": [ - { - "Type": "Stepgen", - "Joint": 0, - "Step Pin": "GP2", - "Direction Pin": "GP3", - "Enable Pin": "GP9" - }, - { - "Type": "Stepgen", - "Joint": 1, - "Step Pin": "GP4", - "Direction Pin": "GP5", - "Enable Pin": "GP10" - }, - { - "Type": "Stepgen", - "Joint": 2, - "Step Pin": "GP6", - "Direction Pin": "GP7", - "Enable Pin": "GP11" - }, - { - "Type": "Digital Input", - "Pin": "GP13", - "Mode": "PullUp", - "Data Bit": 0 - }, - { - "Type": "Digital Input", - "Pin": "GP14", - "Mode": "PullUp", - "Data Bit": 1 - }, - { - "Type": "Digital Input", - "Pin": "GP15", - "Mode": "PullUp", - "Data Bit": 2 - }, - { - "Type": "Digital Input", - "Pin": "GP28", - "Mode": "PullUp", - "Data Bit": 3 - }, - { - "Type": "Digital Input", - "Pin": "GP27", - "Mode": "PullUp", - "Data Bit": 4 - }, - { - "Type": "Digital Output", - "Pin": "GP8", - "Invert": true, - "Data Bit": 0 - } - ] - } -} + "Board": "W5500-EVB-Pico", + "Threads": [ + { + "Thread": "Base", + "Frequency": 40000 + }, + { + "Thread": "Servo", + "Frequency": 1000 + } + ], + "Modules": [ + { + "Thread": "Servo", + "Type": "Blink", + "Comment": "Blinky status LED", + "Pin": "GP25", + "Frequency": 2 + }, + { + "Thread": "Base", + "Type": "Stepgen", + "Comment": "X - Joint 0 step generator", + "Joint Number": 0, + "Step Pin": "GP2", + "Direction Pin": "GP3" + }, + { + "Thread": "Base", + "Type": "Stepgen", + "Comment": "Y - Joint 1 step generator", + "Joint Number": 1, + "Step Pin": "GP4", + "Direction Pin": "GP5" + }, + { + "Thread": "Base", + "Type": "Stepgen", + "Comment": "Z - Joint 2 step generator", + "Joint Number": 2, + "Step Pin": "GP6", + "Direction Pin": "GP7" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "X axis limit/home switch", + "Pin": "GP13", + "Mode": "Input", + "Data Bit": 0, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Y axis limit/home switch", + "Pin": "GP14", + "Mode": "Input", + "Data Bit": 1, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Z axis limit/home switch", + "Pin": "GP15", + "Mode": "Input", + "Data Bit": 2, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Emergency Stop switch", + "Pin": "GP28", + "Mode": "Input", + "Data Bit": 3, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Versaprobe tool probe input", + "Pin": "GP27", + "Mode": "Input", + "Data Bit": 4, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "X axis driver enable pin", + "Pin": "GP9", + "Mode": "Output", + "Data Bit": 0, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Y axis driver enable pin", + "Pin": "GP10", + "Mode": "Output", + "Data Bit": 1, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Z axis driver enable pin", + "Pin": "GP11", + "Mode": "Output", + "Data Bit": 2, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Spindle On command relay", + "Pin": "GP8", + "Mode": "Output", + "Data Bit": 3, + "Invert": "True" + } + ] +} \ No newline at end of file diff --git a/remora_pico_config.txt b/remora_pico_config.txt new file mode 100644 index 0000000..0117a6a --- /dev/null +++ b/remora_pico_config.txt @@ -0,0 +1,127 @@ +{ + "Board": "W5500-EVB-Pico", + "Threads": [ + { + "Thread": "Base", + "Frequency": 40000 + }, + { + "Thread": "Servo", + "Frequency": 1000 + } + ], + "Modules": [ + { + "Thread": "Servo", + "Type": "Blink", + "Comment": "Blinky status LED", + "Pin": "GP25", + "Frequency": 2 + }, + { + "Thread": "Base", + "Type": "Stepgen", + "Comment": "X - Joint 0 step generator", + "Joint Number": 0, + "Step Pin": "GP2", + "Direction Pin": "GP3" + }, + { + "Thread": "Base", + "Type": "Stepgen", + "Comment": "Y - Joint 1 step generator", + "Joint Number": 1, + "Step Pin": "GP4", + "Direction Pin": "GP5" + }, + { + "Thread": "Base", + "Type": "Stepgen", + "Comment": "Z - Joint 2 step generator", + "Joint Number": 2, + "Step Pin": "GP6", + "Direction Pin": "GP7" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "X axis limit/home switch", + "Pin": "GP13", + "Mode": "Input", + "Data Bit": 0, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Y axis limit/home switch", + "Pin": "GP14", + "Mode": "Input", + "Data Bit": 1, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Z axis limit/home switch", + "Pin": "GP15", + "Mode": "Input", + "Data Bit": 2, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Emergency Stop switch", + "Pin": "GP28", + "Mode": "Input", + "Data Bit": 3, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Versaprobe tool probe input", + "Pin": "GP27", + "Mode": "Input", + "Data Bit": 4, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "X axis driver enable pin", + "Pin": "GP9", + "Mode": "Output", + "Data Bit": 0, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Y axis driver enable pin", + "Pin": "GP10", + "Mode": "Output", + "Data Bit": 1, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Z axis driver enable pin", + "Pin": "GP11", + "Mode": "Output", + "Data Bit": 2, + "Invert": "False" + }, + { + "Thread": "Servo", + "Type": "Digital Pin", + "Comment": "Spindle On command relay", + "Pin": "GP8", + "Mode": "Output", + "Data Bit": 3, + "Invert": "True" + } + ] +} \ No newline at end of file