On Wed, 12 Oct 2016, Marius Alksnys wrote:

> Date: Wed, 12 Oct 2016 12:13:16 +0300
> From: Marius Alksnys <mar...@robotise.lt>
> Reply-To: "Enhanced Machine Controller (EMC)"
>     <emc-users@lists.sourceforge.net>
> To: emc-users@lists.sourceforge.net
> Subject: [Emc-users] Homing to index ends at different positions
> 
> LinuxCNC 2.7.7, hostmot2, Mesa 5i25 + 7i77, resolver to quadrature
> converter integrated into servo drive, 8192 counts per revolution.
>
> I finished integration and one day operator said that Z position was
> lost after last machine restart.
>
> I checked Z homing process and got different final Z positions at
> different tries, especially after PC and 7i77 5V re-powering.
>
> Then I observed that looking for an index sometimes does not actually
> stop at the index, but at the next one - after one full turn. Would it
> be noise or inverted signal problem it would interpret noises as index
> pulse and would stop faster, not further, but this does not happen.
>
> I played a lot with HOME_LATCH_VEL, making it much smaller, changing its
> direction, but could not get reliable results. I checked position of
> home switch in relation to index position and moved the flag of home
> switch, got around 1200 counts difference between them, but nothing helped.
>
> And now, as I can recall, homing to index with Mesa boards gave me
> problems here and there often. Final workaround was to disable this
> feature and rely on imprecise home switches only :(
>
> in INI file:
> =====================
> [HM2]
> DRIVER = hm2_pci
> FPGA = hm2_5i25.0.
> ENC = hm2_5i25.0.encoder.
> PWM = hm2_5i25.0.pwmgen.0
> DI = hm2_5i25.0.7i77.0.0.input-
> DO = hm2_5i25.0.7i77.0.0.output-
> AO = hm2_5i25.0.7i77.0.1.
> AI = hm2_5i25.0.7i77.0.0.analogin
> CONFIG=" num_encoders=6 sserial_port_0=2XXX "
>
> # Axis Z
> [AXIS_2]
> TYPE = LINEAR
> FERROR = 1
> MIN_FERROR = 0.2
> MAX_VELOCITY = 325
> MAX_ACCELERATION = 1800
> ... (PID values)
> BIAS = 0
> DEADBAND = 0.0004
> MAX_OUTPUT = 10
> INPUT_SCALE = -1259.84251969
> OUTPUT_SCALE = -10
> OUTPUT_MIN_LIMIT = -10
> OUTPUT_MAX_LIMIT = 10
> MIN_LIMIT = -512
> MAX_LIMIT = 0
> HOME = -1 # The position that the joint will go to upon completion of
> the homing sequence
> HOME_OFFSET = -8 # The axis position of the home switch or index pulse,
> in machine units.
> HOME_SEARCH_VEL = 60
> HOME_LATCH_VEL = -10
> HOME_FINAL_VEL = 100
> HOME_USE_INDEX = YES
> HOME_IGNORE_LIMITS = NO
> HOME_SEQUENCE = 0
>
> in main HAL file:
> =====================
> loadrt trivkins
> loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD
> num_joints=[TRAJ](AXES) num_dio=7
> loadrt threads name1=slow-thread period1=[EMCMOT]SLOW_PERIOD
> loadrt pid names=pid-x,pid-y,pid-z,pid-spin,pid-orient
> ...
> loadrt debounce cfg=10
> ...
> loadrt hostmot2
> loadrt [HM2](DRIVER) config=[HM2](CONFIG)
> setp [HM2](FPGA)watchdog.timeout_ns 5000000
> ...
> # --- Z encoder setup ---
> setp [HM2](ENC)02.filter 1
> setp [HM2](ENC)02.scale [AXIS_2]INPUT_SCALE
> net z-pos-fb [HM2](ENC)02.position => pid-z.feedback axis.2.motor-pos-fb
> net z-vel-fb [HM2](ENC)02.velocity => pid-z.feedback-deriv
> net z-index-enable axis.2.index-enable <=> [HM2](ENC)02.index-enable
> ...
> net z-index-enable => pid-z.index-enable
> ...
> # Home and limit switches
> ...
> net z-home-noisy [HM2](DI)09 => debounce.0.2.in
> net z-home debounce.0.2.out => axis.2.home-sw-in
> ...
> net z-limit-noisy [HM2](DI)10-not => debounce.0.5.in
> ...
> # THREADS
> addf [HM2](FPGA)read servo-thread
> addf debounce.0 servo-thread
> ...
>
> addf motion-command-handler servo-thread
> addf motion-controller servo-thread
> ...
> addf pid-z.do-pid-calcs servo-thread
> ...
> addf [HM2](FPGA)write servo-thread
> ...
> addf scale-s-vel slow-thread
> ...
>
> in postgui.hal:
> =====================
> ...
> net enc-quad-error-en [HM2](ENC)00.quad-error-enable
> [HM2](ENC)01.quad-error-enable [HM2](ENC)02.quad-error-enable
> [HM2](ENC)05.quad-error-enable
> ...
> # I put this line at the very end, because I noticed more occasional
> quadrature errors otherwise:
> sets enc-quad-error-en 1
> lock
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>



I would hand check index detection by "setsing" the appropriate index-enable 
signal and turning the axis by hand and watching for the same index-enable 
signal to be cleared. If this does not work reliably it suggests you have a 
encoder index signal interface problem of some sort (wrong interface mode, 
too short index signal, missing index from resolver-digital converter, 5V 
problem on 7I77, cable issues etc)

The encoder errors also suggest some kind of generic interface issue

Another diagnostic would be to halscope the index pulse itself assuming you
can move slowly enough to detect it in the servo thread, index pulses are 
often 1 encoder pitch wide (1/2048 in your case) so you would have to move 
more slowly than 2s seconds per turn to reliably detect it at a 1 KHz servo 
thread



Peter Wallace
Mesa Electronics


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to