/ docs / UPDATING
UPDATING
  1  This file describes needed steps to update configurations from 2.2.x to 2.3
  2  
  3  1. Classicladder changes
  4  Default input and output pins change from 50 to 15 each.
  5  s32 now uses %IW0 for in and %QW0 for out.
  6  
  7  2. RS274NGC_STARTUP_CODE should be in the [RS274NGC] section.
  8  
  9  
 10  This file describes needed steps to update configurations to 2.2.x
 11  =============================================================================
 12  
 13  
 14  -----------------------------------------------------------------------------
 15  I. Upgrading configurations from 2.1.x to 2.2.x
 16  -----------------------------------------------------------------------------
 17  
 18  1. m5i20 encoder changes
 19  The m5i20 "encoder" pins now match the HAL canonical encoder interface. 
 20  The -cnt-latch, -pos-latch, -idx-latch, and -latch-index pins have been 
 21  removed. The standard encoder pin -index-enable has been added. The behavior 
 22  of the -position and -count pins now match the HAL canonical interface.
 23  
 24  2. pluto_servo changes
 25  Most pins and parameters on pluto-servo were changed to use dots instead of 
 26  dashes, in accordance with the HAL canonical naming conventions. For example, 
 27  'pluto-servo.encoder-0-velocity' has been renamed to 
 28  'pluto-servo.encoder.0.velocity' and 'pluto-servo.dout-00-invert' has been 
 29  renamed to 'pluto-servo.dout.00-invert'.
 30  
 31  3. stepgen and freqgen changes
 32  The units for steplen, stepspace, dirsetup, and dirhold have been changed 
 33  from BASE_PERIOD units to nanosecond units. Internally, the values given are 
 34  rounded up to a multiple of BASE_PERIOD, and at runtime the parameters are 
 35  changed to display the rounded up value.
 36  
 37  Freqgen has been deprecated and replaced by stepgen, which now has an 
 38  additional command line argument 'ctrl_mode', which can be used to specify 
 39  position mode (the default) or velocity mode. Position mode is the default, 
 40  and works the same as before. Velocity mode accepts a velocity command, and 
 41  works like freqgen.
 42  
 43  In step modes 0 and 1, setting stepspace to 0 will allow "step" 
 44  (or "up/down") to be asserted on every invocation of make-pulses. Use a 
 45  stepspace value of 1 to signify "the smallest nonzero stepspace".
 46  
 47  4. double-linking of pins is now treated as an error
 48  halcmd and hal_link() now refuse to link an already-linked pin. This 
 49  immediately diagnoses configuration errors of the form
 50  
 51      net limit-switch parport.0.pin-26-in => axis.0.neg-lim-sw-in axis.0.pos-lim-sw-in
 52      net home-switch  parport.0.pin-26-in => axis.0.home-sw-in
 53  	
 54  which have the effect of leaving no pin driving the limit switch inputs. If 
 55  the "re-link" behavior is truly desired, add "unlinkp" commands before the new 
 56  link. It is still permitted for "unlinkp" to be used on an unconnected pin.
 57  	
 58  5. The 'counter' component is deprecated
 59  The 'counter' component is deprecated. For a one-phase, unidirectional counter,
 60  use the 'encoder' component with encoder.X.counter-mode=TRUE. The version in 
 61  'encoder' has superior velocity estimation.
 62  	
 63  6. Homing changes
 64  The homing algorithm has been changed to be "level sensitive" instead of 
 65  "edge sensitive". This eliminates some possible "miss the switch and go to 
 66  the end of travel" errors on machines with flakey switches. However, it will 
 67  cause homing to fail on some machines that might have worked before. This can 
 68  happen if the following conditions are true:
 69  	
 70  	1. The home switch does not remain on from the point that it trips till 
 71  	   the end of axis travel
 72  	2. Homing speed is high and/or decel rate is low, so that the machine 
 73  	   will overshoot the switch when it hits it during homing. 
 74  			  
 75  	If the machine ends up on the far side of the switch during homing, it 
 76  	will stop with an error message.
 77  			  
 78  	Machines that can wind up "on the far side" of the home switch are 
 79  	considered to have defective switches. If you ever attempt to home 
 80  	while on the wrong side of the switch, it will run to the end of the 
 81  	axis. There is NO possible software solution to that scenario - the 
 82  	proper solution is a home switch that remains on all the way to the end 
 83  	of the axis. With such a switch, EMC2's homing algorithm will always work.
 84  			  
 85  7. connect motion.spindle-speed-in for Feed Per Revolution (G95) mode
 86  The new pin motion.spindle-speed-in must be connected for Feed Per Revolution 
 87  (G95) to work. The value connected must be a revolutions per second value. 
 88  Depending on the machine, this can be a feedback velocity from the encoder or 
 89  a commanded velocity loopback. If using a loopback, the output value which is 
 90  in revolutions per minute must be multiplied by .0167 with a gain component to 
 91  convert to RPS.
 92  			  
 93  8. setp requires 2 arguments, 3 given
 94  Additional error checking is now done in halcmd, so that giving too many 
 95  arguments causes an error message to be printed. In 2.1 and earlier, these 
 96  extra arguments were ignored.
 97  			  
 98  Note that this is the number of arguments that are present after the expansion 
 99  of inifile references, such as
100  
101  	setp example.scale [AXIS_0]INPUT_SCALE
102  			      
103  which might expand to to
104  			      
105  	setp example.scale 32000 0
106  				  
107  in this case, the fix is to modify the inifile to remove the second number "0" 
108  from the INPUT_SCALE. This second value is no longer used anywhere in emc2.
109  				  
110  9. .var file changes
111  The .var file has been extended to require coordinate system offsets for 
112  U, V and W axes. Copy a fresh .var file. An incorrect var file leads to emc 
113  printing 'emc/task/emctask.cc 312: interp_error: Coordinate system index 
114  parameter 5220 out of range' at startup.
115  
116  
117  -----------------------------------------------------------------------------
118  II. Upgrading configurations from 2.0.x to 2.1.x
119  -----------------------------------------------------------------------------
120  
121  Please review the following list if you plan to update a configuration from
122  emc2.0.x to 2.1.x. It is not needed if you start with a new 
123  configuration based on the sample configs supplied with this version of emc2.
124  
125  1. emc.nml
126  The emc.nml file has been heavily revised. Unless you made your own changes to 
127  emc.nml, simply make a fresh copy. If you made your own changes, then you'll 
128  have to apply them to emc.nml manually. 
129  
130  2. kinematics
131  Now a separate kinematics module must be loaded before MOTMOD, as shown below:
132      core_sim.hal:
133      + loadrt trivkins 
134  
135  3. spindle control
136  The HAL pins for spindle control have been renamed to reflect the fact that 
137  they are controlled by the realtime 'motion' component, and not by the 
138  userspace 'iocontrol' component.
139      change 'iocontrol.0.spindle-speed-out' with 'motion.spindle-speed-out'
140  
141  4. halcmd "loadusr -W" replaces wait-for-pin and sleep
142  In 2.0 there was no way to wait for a userspace component to create its pins. 
143  The "wait-for-pin" program (which took a pin name as an argument) was added 
144  and then removed during the 2.1 development cycle. 
145  Now, the correct way to wait for a userspace component is 
146      "loadusr -W ...". 
147  This requires that the component call hal_ready() after it has created all its 
148  pins and is ready for use. If the executable name and the component name 
149  differ, use "halcmd loadusr -W -n component-name". 
150  
151  5. inifile units
152  Instead of specifying [AXIS_*]UNITS as a decimal number, 
153  specify [TRAJ]LINEAR_UNITS and [TRAJ]ANGULAR_UNITS as unit names, 
154  including "inch", "mm", "degree", and "radian". 
155  The old [AXIS_*]UNITS syntax is still supported, however.
156  
157  6. "HAL: WARNING: blocks is deprecated, please use the subcomponents generated 
158      by 'comp' instead"
159  In emc 2.1, a new tool called "comp" makes it easy to create HAL components. 
160  All the items that are in the 'blocks' module have been broken into separate 
161  modules such as 'ddt', 'wcomp', and so on. 
162  No corrective action is needed at this time, because 'blocks' will still be 
163  present in the 2.1 series. However, it may be removed in the 2.2 series, 
164  and changes to HAL files will be required at that time. 
165  
166  If you wish to silence this warning, then change a line like 
167      loadrt blocks ddt=6 wcomp=6
168  to 
169      loadrt ddt count=6
170      loadrt wcomp count=6
171     
172  7. elimination of "period" from most HAL components
173  In version 2.0.x, many HAL components would accept a command line argument 
174  "period" (or "periodfp", or other variations on that theme). When "period" was 
175  specified, the component would create a realtime thread running at the 
176  specified period. This capability was _not_ used in normal EMC configurations; 
177  it was mostly used for testing. 
178  (In a normal EMC configuration, the servo and base periods are passed to motmod
179  and it creates the threads.) 
180  In version 2.1, the period argument has been removed from all HAL components. 
181  'motmod' still creates the threads for EMC, and none of the sample 
182  configurations should need to be changed. For other applications such as 
183  testing, etc., there is now a component called "threads" which can create up 
184  to three threads. 
185  To create a thread, use 
186      loadrt threads name1=<name-of-thread> period1=<period-in-ns> 
187  
188  To create more than one, use name2, period2, and name3, period3. By default, 
189  "threads" creates floating point capable threads. If you don't need floating 
190  point, you can specify "fp1=0" (or fp2=0 or fp3=0) to turn off floating point 
191  support for one or more threads. Disabling floating point support might save a 
192  microsecond or so, and is commonly done for the "fast" thread for software 
193  encoder counting and step pulse or PWM generation. 
194     
195  8. elimination of s8, u8, s16, u16 HAL types
196  The number of HAL types has been reduced. "newsig" commands which formerly used 
197  one of those types should be converted to the corresponding 32-bit type, s32 or 
198  u32. 
199     
200  9. hal_ppmc uses ns units for setup-time, pulse-width, and pulse-space; pins 
201     renamed
202  Instead of being specified in units of 100ns, these values (now named 
203  setup-time-ns, etc) are in units of 1ns.
204     
205  10. the pin axis.N.index-pulse-in has been renamed to axis.N.index-enable
206  The name of the pin used for indexing (homing to index pulse) has been changed 
207  to be more descriptive and to match the canonical encoder interface.
208     
209  11. the meaning of the 'comp.N.hyst' parameter has changed
210  In emc 2.0.x, the output of the comparator would not change until the difference
211  between the inputs exceeded the hysteresis parameter, giving an effective 
212  hysteresis of double the parameter. Now, the output will change when the 
213  difference exceeds hyst/2. This more closely matches the [usual definition of 
214  hysteresis]. Existing users of the 'comp' block must change (double) the value 
215  of the 'comp.N.hyst' parameter.
216  
217  12. the connection to the lathe's spindle encoder has changed
218  In the preliminary lathe threading support in 2.0 versions, a "not" block was 
219  needed to connect the motion controller to the spindle encoder's index-enable 
220  pin. This is no longer necessary (and will not work).