Configure LinuxCNC with Pncconf

For Leadshine Drivers and Mesa 7i76e

LinuxCNC Logo and and Mesa 7i76e Board

This guide documents how to configure LinuxCNC 2.8 for the Torsion CNC Router when using a Mesa 7i76e FPGA board and Leadshine stepper motor drivers.

Pncconf Wizard is used for the initial setup. A few options are not built into the wizard, so there will be manual updates made after the initial configuration is generated by the wizard.

Note: Pncconf (Point and click configuration) Wizard is used when Mesa boards are used. For other stepper based systems, use Stepconf (Stepper Configuration) Wizard.

Pncconf Wizard

  1. Run Pncconf wizard, found under “CNC” in the desktop’s main menu.
  2. Choose options to Create a New Configuration, desktop shortcut, and desktop launcher.
    If you need to re-run the wizard to adjust any settings later, select “Modify a configuration already created with this program”.
  3. Click “Forward”.
    1. Enter a machine name
    2. Include spindle
    3. XYZ
    4. mm
    5. Actual Servo period 1000000
    6. Choose Mesa0 PCI/Etho/Parport Card
    7. None for parport
    8. Require homing before MDI running
    9. Move spindle up before tool change
    10. Popup Manual Toolchange Prompt
  4. Click “Forward” and keep all defaults on the next screen with exception of:
    1. Default linear velocity to 1500 mm/min (or whatever you prefer). This sets the default value for the Jog slider in the GUI.
    2. Max linear velocity to 20000 mm/min
    3. Force Axis to Maximize. Optional. This opens the GUI as a maximized window.
  5. Click “Forward” then select:
    1. Include custom PyVCP GUI panel
    2. + to Expand Pyvcp Details
    3. Spindle Speed Display
    4. Include connections to HAL
  6. Click “Forward” then select:
    1. Board name: “7i76e-Internal Data”
    2. Card Address: 10.10.10.10
    3. Set Num of encoders: 0
    4. Num step generators: 4
    5. Num of Serial Ports: 1
    6. Num of Channels: 1
    7. Click “Accept components Changes” then 4 new tabs will show at top of screen.
  7. Click “I/O Connector 1” tab then use the dropdown lists to select:
    1. Num 0: Axis → Main Axis → X Axis StepGen
    2. Num 1: Axis → Main Axis → Y Axis StepGen
    3. Num 2 : Axis → Tandem Axis → Y2 Tandem StepGen
    4. Num 3: Axis → Main Axis → Z Axis StepGen
  8. Click “7I76 I/O” tab and on the TB6 sub-tab, select:
    1. Num 08 → Limits/Home Shared → Main Axis → X Minimum Limit + Home
    2. Check the “Inv” checkbox for Num 08. This is to read 0 vdc as switch activated and 24 vdc as normal operation.
    3. Num 09 → Limits/Home Shared → Main Axis → Y Minimum Limit + Home
    4. Check the “Inv” checkbox for Num 09.
    5. Num 10 → Limits/Home Shared → Tandem Axis → Y2 Minimum Limit + Home
      Note: If not using two Y home switches (one for the Y1 stepper drive system and one for Y2, leave this set as “Unused Input”.
    6. Check the “Inv” checkbox for Num 10 (if using two Y switches).
    7. Num 11 → Limits/Home Shared → Main Axis → Z Maximum Limit + Home
    8. Check the “Inv” checkbox for Num 11.
    9. Right hand column, Num 01 (GPIO Output) → Coolant → Coolant Mist
      Note: This output is used to control a compressed air solenoid for laser assist, chip clearing, and coolant mist.
    10. Right hand column, Num 02 (GPIO Output) → Digital → Digital Out 0
  9. Click the “TB5” sub-tab and select:
    1. Num 24 → External Control → ESTOP In
    2. Num 25 → External Control → Probe In
  10. Perform this step only if using Analog Spindle Control from the 7i76e. If using RS-485 spindle control, skip this step.
    1. Click the “TB4” sub-tab
    2. Num 0 → Spindle Output
  11. Click “Forward” then enter X Motor details:
    1. Step On-Time 2500
    2. Step Space 2500
    3. Direction Hold 10000
    4. Direction Setup 5000
    5. Stepper Scale 160.000
    6. Maximum Velocity 19000 mm/min
    7. Maximum Acceleration 1750 mm/sec/sec
    8. Checkbox for Invert Motor Direction if needed (depends on how the stepper wires were connected).
  12. Click “Forward” then select X Axis details:
    1. Positive Travel Distance: 620
    2. Negative Travel Distance: 0
    3. Home Position Location: 2
    4. Home Switch Location: -2
    5. Home Search Velocity: 1500 mm/min
    6. Towards Negative Limit
    7. Home Latch Velocity: 60 mm/min
    8. Home Latch Direction Same
    9. Home Final Velocity: 120 mm/min
    10. Home Search Sequence: 1
  13. Click “Forward” then enter Y Motor details:
    1. Step On-Time 2500
    2. Step Space 2500
    3. Direction Hold 10000
    4. Direction Setup 5000
    5. Stepper Scale 160.000
    6. Maximum Velocity 19000 mm/min
    7. Maximum Acceleration 1750 mm/sec/sec
    8. Checkbox for Invert Motor Direction if needed (depends on how the stepper wires were connected).
  14. Click “Forward” then select Y Axis details:
    1. Positive Travel Distance: 950
    2. Negative Travel Distance: 0
    3. Home Position Location: 2
    4. Home Switch Location: -2
    5. Home Search Velocity: 1500 mm/min
    6. Towards Negative Limit
    7. Home Latch Velocity: 60 mm/min
    8. Home Latch Direction Same
    9. Home Final Velocity: 120 mm/min
    10. Home Search Sequence: 1
  15. Click “Forward” then enter Z Motor details:
    1. Step On-Time 2500
    2. Step Space 2500
    3. Direction Hold 10000
    4. Direction Setup 5000
    5. Stepper Scale 400.000
    6. Maximum Velocity 7000 mm/min
    7. Maximum Acceleration 1300 mm/sec/sec
    8. Checkbox for Invert Motor Direction if needed (depends on how the stepper wires were connected).
  16. Click “Forward” then select Z Axis details:
    1. Positive Travel Distance: 0
    2. Negative Travel Distance: -150
    3. Home Position Location: -2
    4. Home Switch Location: 2
    5. Home Search Velocity: 1500 mm/min
    6. Towards Negative Limit
    7. Home Latch Velocity: 60 mm/min
    8. Home Latch Direction Same
    9. Home Final Velocity: 120 mm/min
    10. Home Search Sequence: 0
  17. Click “Forward”.
  18. If using Analog Spindle Control, select Spindle Motor options. Otherwise skip this step.
    1. Uncheck “Use +- voltage for direction”
    2. Range 1 Max RPM: 24000
  19. Click “Done”.
  20. Close the wizard.

Editing HAL Files

The Pncconf wizard created a folder on the desktop with the machine name. Open this folder and find the file named custom.hal. Open this file with a text editor to make changes.

Note that there is also a file named [machine_name].hal that is created by the Pncconf Wizard. Anytime you re-run the wizard, this file will be regenerated and any changes you made to it manually will be lost. That is why there is a custom.hal file, to allow you to customize the hal code without it being overwritten.

If using a water cooled spindle add the following two lines to custom.hal:

# --- Spindle Coolant Pump On/Off ---
net spindle-enable => hm2_7i76e.0.7i76.0.0.output-03

If using RS-485 to control the VFD/spindle, add the following to custom.hal:

# RS-485 Spindle Control
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 19200

net spindle-vel-cmd-rpm-abs     vfd.speed-command
net spindle-enable              vfd.spindle-on
net spindle-cw                  vfd.spindle-forward
net spindle-ccw                 vfd.spindle-reverse
net spindle-at-speed            vfd.spindle-at-speed

setp vfd.enable 1

If using Analog Spindle Control via the Mesa 7i76e, there are additional changes you can make to custom.hal for tuning the spindle speed for better accuracy. A link will be added here soon.

For slaved (tandem) Y axis homing when there is only a home switch on one side of the axis:

It is recommended to have a limit/home switch on both the Y1 and Y2 drive systems, but in the case of having only a single switch, follow these instructions to get it working.

Add the following lines to the custom.hal file:

# Need to comment out the following three lines from the regular [machin_name].hal file
#
# net y2-home-sw            =>  joint.2.home-sw-in
# net y2-neg-limit          =>  joint.2.neg-lim-sw-in
# net y2-pos-limit          =>  joint.2.pos-lim-sw-in

net min-home-y              =>  joint.2.home-sw-in
net min-home-y              =>  joint.2.neg-lim-sw-in
net y-pos-limit             =>  joint.2.pos-lim-sw-in

Then comment out these lines in the [machine_name].hal file, by adding the “#” at the beginning of each line.

# net y2-home-sw            =>  joint.2.home-sw-in
# net y2-neg-limit          =>  joint.2.neg-lim-sw-in
# net y2-pos-limit          =>  joint.2.pos-lim-sw-in

Each time Pncconf is re-run, any changes made manually in [machine_name].hal will be overwritten and these three lines will need to be commented out again. That is why a comment was added about this in the custom.hal file as a reminder of what needs to be done when the changes get wiped out.