From EuSurplusWiki
Jump to: navigation, search

With the HAL and INI files we are able to configure the machine interface with the LinuxCNC motion controlled. The HAL files start up process modules and provide linkages between LinuxCNC signals and specific hardware pins. INI file overrides defaults that are compiled into the LinuxCNC code. It also provides sections that are read directly by the HAL.[1]


PncConf is made to help build configurations that utilize specific Mesa Anything I/O products.

It can configure closed loop servo systems or hardware stepper systems. It uses a similar wizard approach as Stepconf (used for software stepping, parallel port driven systems).[2]


Run PncConf from RunInPlace

As we chose run linuxcnc on a Run In Place installation , it's needed to start PncConf from the same installation. To do that open the terminal, and type:

$ cd linuxcnc-dev/scripts/

and after:

$ pncconf

And the program starts:

Pncconf start.png

Start a Configuration

We will use mesa 5i25 + 7i75 + 7i77 on this machine, so Pncconf will help us to create the basic configuration files. This files can also be changed after running PncConf (and will be).

The goal is use PncConf is just to create the minimum scheme for the HAL/INI files, so that can be changed and completed in the future.

40px-Note.png NOTE: This guide will explain step by step how to create a machine configuration.

After start PncConf, press Forward.

Pncconf 1.png

We will create a new configuration with a laucher on Descktop.

Pncconf 2.png

In this step the configuration name is placed, and the correct FPGA board is choose. The computer response time will keep the recommended value.

Pncconf 3.png

No external controls will be used by the PncConf wizzard. It can be add manually later on the HAL files.

Pncconf 4.png

On the GUI Configuration, it will be left without any option and with default values.

Pncconf 5.png

In Mesa I/O setup the firmware selected was "7i77x2 with one 7i77". The 5i25 was one 7i77 board connected in port P3 (5i25 have two daughter cards connectors, named P2 and P3. See 5i25 for more info).

Now press "Accept components Changes", the wizard will load the tabs with pins options. Navigating to tab "I/O Connector 3" we can see the 7i77 related options, with the 3 encoders previous selected.

Pncconf 7.png

In the "I/O Connector 3" tab, encoder 0 will be for X axis, encoder 1 to Y axis and encoder 2 to Z axis.

Pncconf 8.png

"Smart Serial 0" tab will show the inputs and outputs off Mesa 7i77. To generate the basic configuration only input0 will be configured, in this case to the Estop button, so the appropriate option is selected.

40px-Note.png NOTE: Further inputs and outputs will be added manually to perform specific tasks. This is done on the HAL file.

Pncconf 9.png

In last tab, "Smart Serial 1" we will choose the PWM generators for X and Y axis. Z axis will be controlled by a step-generator, so no PWM generator will be dedicated to Z axis.

Now press Forward.

Pncconf 10.png

In the "X axis motor/encoder configuration", the default values will be left. The encoder scale was set to "1" just just to left the wizard continue. The correct value will be calculated and changed after in the INI file, so it will be covered in the future.

Pncconf 11.png

The "X axis configuration" will appear now. Just leave the default values, it will be changed after on the INI file to.

Press Forward.

The Y and Z configuration tabs will appear. We use the same values of X axis. The reason off let the default values is because is more intuitive change/configure it on the INI file, and the probability of have to change it even if it was enter on the configuration wizard it's big, so these step is jumped and it will be configured in only one place.

At this point we reached "Advanced Options" tab.

Pncconf 12.png

No advanced options will be selected on this tab.

Pncconf 13.png

No HAL components will be added for now, it will be added manually on the hal files has we need to use them.

Pncconf 14.png

The wizard reaches the end, just press Apply and the configuration will be created.

Run Configuration

After finish the PncConf setup, we noticed that the configuration folder was created on the default installation folder (./linuxcnc/configs ) instead of run in place folder (./linuxcnc-dev/configs). If you are not planing create and compile custom HAL files, don't have the need to use a RunInPlace installation and so can run PncConf from standard installation. As we plan to do that, copy the configuration folder to the correct location and create a new shortcut

Open the terminal and place the following command:

$ cp ./linuxcnc/configs/machinebuild ./linuxcnc-dev/configs/ -R

Follow the steps for create the new shortcut with these command:

/home/machinebuild/linuxcnc-dev/scripts/linuxcnc /home/machinebuild/linuxcnc-dev/configs/machinebuild/machinebuild.ini

Now by pressing the recently created launcher, LinuxCNC does not start. The error is shown on the output window or on a terminal window. To launch LinuxCNC from the terminal and to debug the error output:

Run 1.png

The problem was found, the "probe_parport" module doesn't exist on the RunInPlace version, or isn't compiled yet. This was automatically added by pncconf and it is related with the parallel port (that we are not using on this project).

To fix this error we only need to remove the module from the machinebuild.ini, removing the corresponding line:

Run 1 hal.png

Sample Configuraion Files

Based on the PncConf generated files, a basic machine configuration for one axis (X axis) was created with the minimum connections that make it safety able to work (Emergency stop button and limit switches). It also had a homing configuration for this one axis. All of this steps will be explained in more detail.

To download this file, please visit the product page in eusurplus shop

INI Configuration

The INI Configuration overrides defaults that are compiled into the LinuxCNC code. It also provides sections that are read directly by the Hardware Abstraction Layer (HAL).

The INI File Sections are described here, but the most relevant will be explained.


Ini display.png

In the DISPLAY section GEOMETRY = x as we have only one axis and PYVCP = axispanel.xml that is corresponding the [Python Virtual Control Panel] where drive error and drive ready status will be displayed. This panel is a extra added to our configuration that is useful to the user. It is not needed for a basic configuration.


Ini hal.png

POSTGUI_HALFILE = postgui_call_list.hal is executed after the GUI has created its HAL pins. This file contains source axispanel.hal that is the hal file where we will connect hal pins to the PYVCP. Like before this is not mandatory, and it is only added to provide more functionality.


Ini traj.png

AXES = 1 correspond to one more than the number of the highest joint number in the system. the joint for X axis is "0" so AXES = 1. COORDINATES = X names the axe to be controlled. NO_FORCE_HOMING = 1 lets the linuxcnc execute MDI commands without homing the machine first.


Ini axis.png

The [AXIS_0] section contain general parameters for the individual components in the axis control module. The axis section names begin numbering at 0, and run through the number of axes specified in the [TRAJ] AXES entry minus 1. Typical AXIS_0 = X.

FERROR and MIN_FERROR corresponds to the maximum deviation allowed on the movement off rapids, and working speeds (for example, G1 G2 G3 codes). Those settings are normally keep high for a basic configuration and after a correct tuning with the system stable, they should carry the correct values. Please see section motor tuning section for axis tuning.

MAX_VELOCITY and MAX_ACCELERATION corresponds to the maximum allowed velocity and acceleration for that given axis. this values is in machine units per second.

The P,I,D,FF0,FF1,FF2,BIAS and DEADBAND parameters in conjunction to MAX_VELOCITY and MAX_ACCELERATION determines the behavior of the servo motor. For a better understanding of this parameters, see the motor tuning section .

MAX_OUTPUT is the maximum value for the output of the PID.

ENCODER_SCALE corresponds the encoder counts per mm. This value translates the quantity of motor movement to archive the desired position. An accurate encoder scale is imperative to get the desired dimensions during the machine job.

OUTPUT_SCALE, OUTPUT_MIN_LIMIT, OUTPUT_MAX_LIMIT are connected to mesa 7i77 analogue output and defines the maximum, minimum and the scale of the output. For this given example, the 450mm/s of the scale in conjunction to max a min values of 450mm/s and -450mm/s makes the analog voltage output to be 10v at maximum speed (450mm/s). A very important observation is the signal of the OUTPUT_SCALE. This value can be multiplied for -1, and that inverts the motor orientation of rotation. In conjunction to ENCODER_SCALE witch cam be also multiplied to -1 (inverts movement orientation on the LinuxCNC motion controler) we got 4 possible configurations. Two of them makes motor run out (saturates the output due a positive positive feedback loop) and 2 stable configurations (negative feedback loop, so the motor doesn't run out), one with movement direction symmetrical on motion controller/machine and another with the desired movement orientation.

The MIN_LIMIT and MAX_LIMIT corresponds to the machine working coordinates / soft limits for axis motion, in machine units. When this limit is exceeded, the controller aborts axis motion so that the limit is not exceeded.

HOME_SEARCH_VEL, HOME_LATCH_VEL, HOME and HOME_OFFSET controls how the homing process is made, the values of HOME_SEARCH_VEL and HOME_LATCH_VEL can be multiplied for -1 to invert the orientation of homing search. For a more detailed explanation of how homing is done, please see the homing configuration page. In this machine, negative limit switch is used to as homing switch, so HOME_IGNORE_LIMITS is used.

HAL Configuration

HAL The HAL configuration start up process modules and provide linkages between LinuxCNC signals and specific hardware pins.

The relevant parts of hal configuration file that is added to the previously Pncconf generated configuration are the following:


Hal inputs.png

The emergency stop button is a normally closed contact (NC) is connected to input 0. As it is NC, the inverted input on Mesa 7i77 was used. The DriveReadyX and DriveFault was connected to the inputs 16 and 17. This drive status bits will be showed on the custom panel.

Limits / Home

Hal limits home.png

The input 8 and 9 of mesa 7i77 board was connected to a normally open (NO) contact on the limits switches. When activated this contact closes and let the 24vdc signal pass trough it to the mesa inputs. The negative limit as also used as home switch, so the signal name that as connected to input 8 (LimXn) was also connected to the correspondent joint home switch pin.


Hal outputs.png

Output 8 is intended to the clear faults input on the Argon drive. Output 7 enables the drive, this is connected to ENA pin on the SimpleMotion V2 break out board

The process of clear faults and enable the drive is made when the motion controller is enabled, this corresponds on axis gui press the power button. This button is associated to the signal machine-is-enabled.

Emergency stop

Hal estop.png

In this configuration, the estop latch component was used.

To be able to use this component it's also need to load it:

Hal estop load.png

Custom PYVCP

Additionally, a custom panel with 2 led indicators for the servo drive error and ready status:

Axis sampleconf.png

The left panel is done with 2 files, axispanel.hal and axispanel.xml. For a detailed information who a custom PYVCP works, please see the PYVCP tutorial

in the XML file, the structure of the panel is defined.

Axispanel xml.png

2 labels and 2 leds are used, defined in horizontal and vertical boxes.

For the hal file, it connects the panel pins defined on axispanel.xml to the other pins/signals on main hal configuration.

Axispanel hal.png

This simply connects the 2 drive signals on the main configuration to the led pins on the PYVCP panel.

This category currently contains no pages or media.