Spindle Pulses Lost in System

More
1 year 9 months ago #320120 by 10K
Replied by 10K on topic Spindle Pulses Lost in System
tommylight-
The spec sheet on the opto says it's rated for 5-24V input, with a 30V max, so it should be OK. The output is 0-5V, so that should also be OK. I'll take a look at all the signals again when I get back to the lathe.

PCW-
It's been a while since I wired up all of this, so forgive me if I don't remember it all.
The 7i92 was flashed with G540x2D.bit
Code:
 2      2   IOPort       StepGen          0        Step/Table1     (Out) 15      3   IOPort       None             3      4   IOPort       StepGen          0        Dir/Table2      (Out) 16      5   IOPort       StepGen          4        Step/Table1     (Out)  4      6   IOPort       StepGen          1        Step/Table1     (Out) 17      7   IOPort       None             5      8   IOPort       StepGen          1        Dir/Table2      (Out)  6      9   IOPort       StepGen          2        Step/Table1     (Out)  7     10   IOPort       StepGen          2        Dir/Table2      (Out)  8     11   IOPort       StepGen          3        Step/Table1     (Out)  9     12   IOPort       StepGen          3        Dir/Table2      (Out) 10     13   IOPort       QCount           0        Quad-A          (In) 11     14   IOPort       QCount           0        Quad-B          (In) 12     15   IOPort       QCount           0        Quad-IDX        (In) 13     16   IOPort       None            IO Connections for P1 Pin#  I/O   Pri. func    Sec. func       Chan      Pin func        Pin Dir  1     17   IOPort       None            14     18   IOPort       PWM              1        PWM             (Out)  2     19   IOPort       StepGen          5        Step/Table1     (Out) 15     20   IOPort       None             3     21   IOPort       StepGen          5        Dir/Table2      (Out) 16     22   IOPort       StepGen          9        Step/Table1     (Out)  4     23   IOPort       StepGen          6        Step/Table1     (Out) 17     24   IOPort       None             5     25   IOPort       StepGen          6        Dir/Table2      (Out)  6     26   IOPort       StepGen          7        Step/Table1     (Out)  7     27   IOPort       StepGen          7        Dir/Table2      (Out)  8     28   IOPort       StepGen          8        Step/Table1     (Out)  9     29   IOPort       StepGen          8        Dir/Table2      (Out) 10     30   IOPort       QCount           1        Quad-A          (In) 11     31   IOPort       QCount           1        Quad-B          (In) 12     32   IOPort       QCount           1        Quad-IDX        (In) 13     33   IOPort       None 
.
It appears that I mis-connected the "A" signal to the DB25 P13 / HAL 16 and the Index to DB25 P11 / HAL 14.
I'm going to move the wires around and connect them to DB25 P10 and P12 to see if that has an effect. Is that what you were referring to when you talked about Firmware?

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320121 by PCW
Replied by PCW on topic Spindle Pulses Lost in System
Yes, you need to both connect to the proper pins that connect
to the internal hardware encoder _AND_ modify your hal file so
it uses the hardware encoder rather than the encoder component.

 That is, you will no longer have anything in the hal file that
refers  to GPIO 13 or 15 nor loadrt's the encoder component
 

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320255 by 10K
Replied by 10K on topic Spindle Pulses Lost in System
I moved wires around on my BOB so that the encoders are connected to the proper inputs on the Mesa 7i92.. I made some changes to the .HAL file. I got several things working:

1) The spindle speed shows up on my display, and matches what I see on my separate DRO, even at 2,000 RPM.

2) Based on Tommylight's earlier question, I figured out why my HalScope was running at 250Hz (double click on samples button, and changed divisor from 4 to 1. That change made the missed pulses go away completely, and validated my cheap Chinese BOB was not glitching.This is the first time I've ever seen 180 pulses per revolution on the HalScope.

 

3) I used a stopwatch to time 10 seconds, and watched hm2_7i92.0.encoder.00.count. I had calculated I should get 1440 pulses in 10 seconds at 48 rpm, and that's almost exactly what the difference was in the pulse counts before and after. That means that all the pulses are all being seen! I figured out later that I also could just rotate the chuck by hand, and see 180 counts per revolution.

The only remaining problem I have is that something is mis-configured in my .HAL. When I try to thread, the cutter moves in to position, and is either not receiving the index pulse to start or the 180 pulses per revolution or both, and is not starting to thread.
Code:
loadrt [KINS]KINEMATICS #autoconverted  trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS loadrt pid names=pid.x,pid.z,pid.s loadrt hostmot2 loadrt [HOSTMOT2]DRIVER config=[HOSTMOT2]CONFIG #setp   hm2_7i92.0.watchdog.timeout_ns 25000000 setp   hm2_7i92.0.watchdog.timeout_ns 10000000 #loadrt encoder num_chan=1 loadrt abs count=1 #0-invert is used in pendant hal file loadrt scale names=scale.0,0-invert loadrt lowpass count=1 addf hm2_7i92.0.read              servo-thread addf motion-command-handler       servo-thread addf motion-controller            servo-thread #addf encoder.update-counters     servo-thread addf pid.x.do-pid-calcs           servo-thread addf pid.z.do-pid-calcs           servo-thread addf pid.s.do-pid-calcs           servo-thread addf hm2_7i92.0.write             servo-thread #addf encoder.capture-position     servo-thread addf abs.0             servo-thread addf scale.0             servo-thread addf lowpass.0             servo-thread # latch all stepgen position counts 50 usec before nominal read time (add per PCW): setp hm2_7i92.0.dpll.01.timer-us -50 setp hm2_7i92.0.stepgen.timer-number 1 # increase tolerance to read errors # setp hm2_7i92.0.packet-read-timeout 30 --removed per pcw 12/25/24 setp hm2_7i92.0.packet-error-limit 100 # ---setup spindle--- # set the HAL encoder to 180 pulses per revolution. setp hm2_7i92.0.encoder.00.scale 180 # set the encoder to non-quadrature simple counting using A only. setp hm2_7i92.0.encoder.00.counter-mode true # connect the HAL encoder outputs to LinuxCNC net spindle-position hm2_7i92.0.encoder.00.position => spindle.0.revs net spindle-at-speed => spindle.0.at-speed net spindle-velocity-feedback-rps hm2_7i92.0.encoder.00.velocity => spindle.0.speed-in net spindle-index-enable hm2_7i92.0.encoder.00.index-enable <=> spindle.0.index-enable net spindle-phase-a hm2_7i92.0.encoder.00.input-a #net spindle-phase-b hm2_7i92.0.encoder.00.input-b net spindle-index hm2_7i92.0.encoder.00.input-index #  ---probe signal--- net probe motion.probe-input <= hm2_7i92.0.gpio.020.in # --- ESTOP-EXT --- net estop-ext     <=  hm2_7i92.0.gpio.014.in_not # --- BOTH-HOME --- net both-home-x     <=  hm2_7i92.0.gpio.016.in net both-home-z     <=  hm2_7i92.0.gpio.003.in_not

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320258 by PCW
Replied by PCW on topic Spindle Pulses Lost in System
Check that the counts are going up (the count direction depends on the state of the 'B' encoder input)

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320259 by 10K
Replied by 10K on topic Spindle Pulses Lost in System
The counts are all negative, that is they get more negative when the spindle is turning. Same for the RPM. I have an entry in my postgui that flips it:
Code:
setp scale.0.gain 60 setp lowpass.0.gain 0.010000 net spindle-velocity-feedback-rps               => lowpass.0.in net spindle-fb-filtered-rps      lowpass.0.out  => abs.0.in net spindle-fb-filtered-abs-rps  abs.0.out      => scale.0.in net spindle-fb-filtered-abs-rpm  scale.0.out    => gmoccapy.spindle_feedback_bar

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320266 by PCW
Replied by PCW on topic Spindle Pulses Lost in System
That fixes the display, but doesn't allow spindle synchronized motion.

The way to fix this is to set the encoder scale to -180

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds
Powered by Kunena Forum