Network Servo Interface Adapters for LinuxCNC
Installation
- Install Debian Wheezy using ISO image from the LinuxCNC web site
- Install updates
- Plug the card into a PCI slot, boot and verify it has been detected using 'lspci' untility
$ lspci -v | grep -A3 55c
05:09.0 Communication controller: Mitsubishi Electric Device 55c3 (rev 21)
Subsystem: Mitsubishi Electric Device 55c3
Flags: bus master, slow devsel, latency 32, IRQ 11
Memory at e0a00000 (32-bit, non-prefetchable) [size=4K]
- Download and install LinuxCNC 2.7.14ssc16 .deb packages. This build includes the card driver module and sample configurations
$ wget -r -nd -A '*.deb' http://yurtaev.com/files/linuxcnc_2.7.14ssc16
...
FINISHED --2019-03-16 01:10:08--
Total wall clock time: 29s
Downloaded: 10 files, 44M in 25s (1.74 MB/s)
$ sudo dpkg -i *.deb
Edit /usr/share/nyx/*.par parameter file for your servo drives: J2S, J3 or MDS. Compile param file with supplied script:
$ cd /usr/share/nyx
$ sudo perl param-compile.pl j2s.par
0:0:77
1:0:77
2:0:77
3:0:77
4:0:77
5:0:77
Power off, connect drives to the card, power on up
Start LinuxCNC and select sample config from the list under "nyx"
Connected amps should get initialized, lighting green ingicators in the LinuxCNC Axis window.
LinuxCNC driver v2
LinuxCNC HAL driver module name is nyx. During operation the
controller and SSCNET network are synchronized to servo thread of the
LinuxCNC. Servo thread period should be set to 888888 ns for YSSC1P, YSSC2P, YMDS3P and to 222222 ns for YSSC3P.
Module parameters:
- axis=N - limit number of axes the module creates pins for
- param_file=PATH - servo parameters file
- nodma=dir - disable DMA PCI transfers, 1=read, 2=write, 3=both. Newer motherboards with PCIE-to-PCI bridges may perform worse using PCI read bursts. If amplifiers sporadically switch ready-on/off - try nodma=1
The following HAL commands load the driver and add its callback function to the servo thread:
loadrt motmod servo_period_nsec=888888 ...
loadrt nyx axis=6 param_file=/usr/share/nyx/j2s.bin
addf nyx.0 servo-thread
servo parameter file
Servo parameters are transfered to drives during initialization after LinuxCNC startup.
Parameter names and values are written in a text file and converted to a binary format with a param-compile.pl script.
Sample files for MR-J2S-B, MR-J3-B and MDS are located in /usr/share/nyx. For MR-J2S-B, MR-J3-B, MR-J4-B parameter file is
optional - drives will use values from the drive EEPROM. For MDS drives parameter file is mandatory.
Consult servo drive manual for parameters description.
nyx
Controller status pins:
- nyx.0.ready (bit, out) - the controller is in sync with
LinuxCNC servo thread. Before it come true other pins are
inactive
- nyx.0.error-cnt (u32, out) - communication error count. Number
of clocks when servo thread sync was absent. If the value increases then
the jitter is probably too large. Jitter tolerance is about 50
microseconds
- nyx.0.phase (float, out) - offset of the servo thread call
relative to the timing slot of controller's cycle, in microseconds.
Should not exceed about +/-25us
servo
Depending on adapter the driver supports up to 16 servo amplifiers, AX number is 00 thru 15. Parameters:
- nyx.0.servo-AX.pos-scale (float, rw) - position scale factor, in length units per revolution. Default is 5, which is suitable for direct motor coupling to 5mm lead ball screw
- nyx.0.servo-AX.vel-scale (bit, rw) - velocity scale factor. Default is 10, so that vel-cmd is in rotation per minute with 0.1 rpm resolution. For J3/J4 should be set to 100.
- nyx.0.servo-AX.origin (signed, rw) - position offset
Pins:
- nyx.0.servo-AX.online (bit, out) - the controller has detected and initialized AX servo amplifier
- nyx.0.servo-AX.offline (bit, out) - inverted "online" pin output
- nyx.0.servo-AX.ready (bit, out) - READY-ON status (power relay is on)
- nyx.0.servo-AX.enabled (bit, out) - SERVO-ON status
- nyx.0.servo-AX.warning (bit, out) - servo amplifier warning
- nyx.0.servo-AX.alarm (bit, out) - servo amplifier alarm
- nyx.0.servo-AX.alarm-code (u32, out) - servo amplifier alarm code (hex)
- nyx.0.servo-AX.zero-speed (bit, out) - motor velocity is below zero speed threshold (param No.30)
- nyx.0.servo-AX.in-position (bit, out) - position complete (threshold set in param No.20)
- nyx.0.servo-AX.at-speed (bit, out) - motor at reached commanded speed (velocity control mode)
- nyx.0.servo-AX.in-NN (bit, out) - (J3/J4) amplifier digital input state, NN is 00 thru 02
- nyx.0.servo-AX.power (bit, in) - turn on amplifier power relay (READY-ON)
- nyx.0.servo-AX.enable (bit, in) - enable servo (SERVO-ON)
- nyx.0.servo-AX.reset-alarm (bit, in) - reset servo amp alarm when true
- nyx.0.servo-AX.pos-cmd (float, in) - position command input
- nyx.0.servo-AX.pos-fb (float, out) - motor feedback position
- nyx.0.servo-AX.velocity-mode (bit, rw) - (J2S/J3) velocity control mode. Change is possible at zero speed only
- nyx.0.servo-AX.vel-cmd (float, in) - (J2S/J3/MDS) commanded velocity
- nyx.0.servo-AX.vel-fb (float, out) - motor velocity feedback
- nyx.0.servo-AX.trq-fb (float, out) - motor torque feedback, percent of nominal motor torque
- nyx.0.servo-AX.error-cnt (s32, out) - controller-amplifier feedback transfer error count
- nyx.0.servo-AX.spindle-fwd (bit, in) - (MDS) start spindle in forward direction with vel-cmd speed. enable should be false
- nyx.0.servo-AX.spindle-rev (bit, in) - (MDS) start spindle in reverse direction with vel-cmd speed. enable should be false
- nyx.0.servo-AX.spindle-orient (bit, in) - (MDS) start spindle orientation. Has proirity over spindle-fwd, spindle-rev
- nyx.0.servo-AX.spindle-orienting (bit, out) - (MDS) spindle orientation in progress
- nyx.0.servo-AX.spindle-oriented (bit, out) - (MDS) spindle orientation complete
- nyx.0.servo-AX.counts (s32, out) - servo position feedback counts in native encoder resolution
- nyx.0.servo-AX.counts-cmd (s32, out) - servo position command counts in native encoder resolution
- nyx.0.servo-AX.droop (s32, out) - amplifier reported following error, in native encoder resolution
- nyx.0.servo-AX.forward-torque (float, in) - forward rotation torque limit, percents
- nyx.0.servo-AX.reverse-torque (float, in) - reverse rotation torque limit, percents
- nyx.0.servo-AX.limit-torque (bit, in) - turn on torque limiting
- nyx.0.servo-AX.torque-clamped (bit, out) - torque clamp indication
- nyx.0.servo-AX.absolute (bit, out) - absolute position feedback is valid (set by amp param)
- nyx.0.servo-AX.abs-lost (bit, out) - absolute position is not valid due to e.g. motor disconnection or discharged backup battery.
encoder
An encoder input channel converts quadrature signals on CN2 Phase A, Phase B, Index Z into 32-bit up/down counter values. The sampling requency is 45 MHz. NN is
encoder channel: 00 or 01. Parameter:
- nyx.0.encoder-NN.cpr (float, rw) - encoder resolution, counts per revolution. Sign defines rotation direction. Default is -10000
Pins:
- nyx.0.encoder-NN.index-enable (bit, io) - reset counter on next index mark Z
- nyx.0.encoder-NN.pos (float, out) - encoder counter divided by the cpr parameter value. Signed fractional number of revolutions.
- nyx.0.encoder-NN.counts (s32, io) - encoder counter.
- nyx.0.encoder-NN.velocity (float, out) - estimated velocity, RPM.
The interface is intended for use with motion.spindle-index-enable and motion.spindle-revs.
gpio
Digital input signals IN0..IN11 connected to CN1. Pins:
- nyx.0.in-NN (bit, out) - a value of digital input NN 00 thru 11
- nyx.0.in-NN-not (bit, out) - inverted
Digital output signals OUT0..OUT7 going to CN3:
- nyx.0.out-NN (bit, in) - set output number NN 00 thru 07
dac
2-channel 12-bit digital-to-analog converter on YEX1-A expansion board. Paramaters:
- nyx.0.dac-CH.scale (float, rw) - max input value (for 10V output voltage). Default is 1.0, CH is 00 or 01
Pins:
- nyx.0.dac-CH.value (float, in) - DAC output voltage, values 0..scale give 0..10V
yio
Connected YIO modules are detected, pins are created for each on nyx module load. ID is by DIP switches, 00 thru 15.
Pins:
- nyx.0.yio-ID.in-NN (bit, out) - a value of digital input NN 00 thru 15
- nyx.0.yio-ID.in-NN-not (bit, out) - a value of digital input NN 00 thru 15
- nyx.0.yio-ID.out-NN (bit, in) - set output. NN 00 thru 15
- nyx.0.yio-ID.error-cnt (s32, out) - transmission error counter
Absolute encoder support
All Mitsubishi J2 Super series motors feature absolute encoders. This
allows to skip LinuxCNC homing operation on each startup. Patched version
of LinuxCNC adds the folloing pins to halui module:
- halui.joint.n.set-homed (bit, in) - set axis "homed"
state to true for current offsets without actually performing a homing
operation
Upon startup a script is executed which inspects if servo amplifiers are
in absolute mode and position data is valid. In that case it sets
corresponding axes to "homed". Also the patch changes values saved into
position.txt file from current position pos_fb to motor_offset. TODO:
change to preserve compatibility.
Added INI file parameters MAX_JOG_VELOCITY, MAX_AJOG_VELOCITY to
differentiate maximum jogging velocity from absolute maximum velocity that
can be used in programs. AXIS UI sliders "Jog Speed" and "Max Velocity"
behave consistently.