7I85S with TTL encoders

More
23 May 2013 02:08 #34562 by casetero
7I85S with TTL encoders was created by casetero
Hello,

Im trying to link a TTL encoder to the mesa daughter card 7i85s. Reading the manual of this card i have read this:

In TTL mode the input circuit on the encoder QA, QB, and IDX
inputs drive one input of the RS-422 differential receiver, and the other receiver input is
terminated to a 1.6V (TTL threshold) reference voltage.

I don´t know esactly what it means, i have linked the encoder like this:

Phase A -> QA0
Phase B -> QB0
Ground -> GND (pin 3)
5 V -> 5 V (pin 6)

My I/O card is 5i25 and its correctly jumpered to give 5 V to the 7i85s . I know this because the stepgen works nice.

If i open a Hal Scope window with the hm2_5i25.0.gpio.011.in and ....012.in i can see that only reads pulses of one phase sometimes, and sometimes one phase is always sending pulses without moving the axis. It is no electric noise, it send a very high rate of pulses. I think i some kind of trouble of elecltric feed, i have tested feedind directly with the P1, external electric feed (correctly jumpered both cards) and it does the same.

Anyone knows if i am doing something bad??

Before i had the same encoder linked with the paralell port and it worked nice.

Thank you and regards!

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

More
23 May 2013 03:05 #34565 by PCW
Replied by PCW on topic 7I85S with TTL encoders
This is normal

The 7I85S uses muxed encoders which means that each 5I25 encoder input pin
shares the signals from 2 encoders. This means the GPIO pins are not useful for
reading the encoder input states (and will in fact toggle at about 4 MHz if the even/odd encoder states are different)

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

More
23 May 2013 14:40 #34577 by casetero
Replied by casetero on topic 7I85S with TTL encoders
Thanks for answer,

So each 5i25 encoder input shares 12 signals?


I don´t know if i have fully understand you. Then i cant read encoder input states with the hal scope and hm2_5i25.0.gpio.011.in, can i?

So if i can´t read pulses from the encoders with this pin, which one do i have to read with the hal scope??

The fact is my 7i85s-5i25 isnt counting pulses from scales, because the hm2_5i25.0.encoder.00.position remains in zero while moving.

Am i wiring correctly the encoder with the 7i85s??

Thank you and regards!

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

More
23 May 2013 15:14 - 23 May 2013 15:22 #34578 by cncbasher
Replied by cncbasher on topic 7I85S with TTL encoders
please post your hal file
I presume you have the jumpers set in ttl mode for the encoder
Last edit: 23 May 2013 15:22 by cncbasher.

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

More
23 May 2013 15:45 - 23 May 2013 15:50 #34579 by casetero
Replied by casetero on topic 7I85S with TTL encoders
Hello,

Yes i have them jumpered in TTL mode.

This is my Hal file:

# kinematics
loadrt trivkins

# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES

# only the 7i43 needs this, but it doesnt hurt the others
loadrt probe_parport

# hostmot2 driver
loadrt hostmot2

loadrt pid num_chan=2

# load low-level driver
loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)



setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000


# ################################################
# THREADS
# ################################################

addf hm2_[HOSTMOT2](BOARD).0.read servo-thread

addf motion-command-handler servo-thread
addf motion-controller servo-thread

# addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
# addf pid.2.do-pid-calcs servo-thread

addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread


# Eje y con FPGA

# ################
# X [0] Axis
# ################

# axis enable chain
newsig emcmot.00.enable bit
sets emcmot.00.enable FALSE

net emcmot.00.enable <= axis.0.amp-enable-out
net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable


# position command and feedback
net emcmot.00.pos-cmd <= axis.0.motor-pos-cmd
net emcmot.00.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-cmd

net motor.00.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb
net motor.00.pos-fb => axis.0.motor-pos-fb


# timing parameters
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirsetup 20000
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirhold 20000

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.steplen 5000
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.stepspace 5000

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-scale 1400

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxvel [AXIS_0]MAX_VELOCITY
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxaccel [AXIS_0]MAX_ACCELERATION

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0

setp iocontrol.0.emc-enable-in TRUE



# ################
# Y [1] Axis
# ################

# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable FALSE
net emcmot.01.enable => pid.1.enable
net emcmot.01.enable <= axis.1.amp-enable-out

net emcmot.01.enable <= axis.1.amp-enable-out
net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.01.enable



# timing parameters
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirsetup 20000
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirhold 20000

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.steplen 5000
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.stepspace 5000

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-scale 1400

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxvel [AXIS_1]MAX_VELOCITY
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxaccel [AXIS_1]MAX_ACCELERATION

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.control-type 1





# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0

setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_1]INPUT_SCALE
net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.position => pid.1.feedback
net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI

# set PID loop gains from inifile
setp pid.1.Pgain [AXIS_1]P
setp pid.1.Igain [AXIS_1]I
setp pid.1.Dgain [AXIS_1]D
setp pid.1.bias [AXIS_1]BIAS
setp pid.1.FF0 [AXIS_1]FF0
setp pid.1.FF1 [AXIS_1]FF1
setp pid.1.FF2 [AXIS_1]FF2
setp pid.1.deadband [AXIS_1]DEADBAND
setp pid.1.maxoutput [AXIS_1]MAX_OUTPUT

# position command signals

# setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout1-scalemax [AXIS_1]OUTPUT_SCALE

net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
net motor.01.command pid.1.output => hm2_[HOSTMOT2](BOARD).0.stepgen.01.velocity-cmd



It´s a little messy because it is a modified hal file from example.

Do you see any errors??

Mi version of linuxcnc is 2.5.0. I dont know if this is important.

Thank you and regards!
Last edit: 23 May 2013 15:50 by casetero. Reason: Add information

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

More
23 May 2013 19:49 #34582 by cncbasher
Replied by cncbasher on topic 7I85S with TTL encoders
try

# ---Encoder feedback signals/setup---

setp hm2_5i25.0.encoder.01.counter-mode 0
setp hm2_5i25.0.encoder.01.filter 1
setp hm2_5i25.0.encoder.01.index-invert 0
setp hm2_5i25.0.encoder.01.index-mask 0
setp hm2_5i25.0.encoder.01.index-mask-invert 0
setp hm2_5i25.0.encoder.01.scale [AXIS_0]INPUT_SCALE

net x-pos-fb <= hm2_5i25.0.encoder.01.position
net x-pos-fb => pid.x.feedback
net x-pos-fb => axis.0.motor-pos-fb
net x-index-enable axis.0.index-enable <=> hm2_5i25.0.encoder.01.index-enable

setp pid.x.Pgain [AXIS_0]P
setp pid.x.Igain [AXIS_0]I
setp pid.x.Dgain [AXIS_0]D
setp pid.x.bias [AXIS_0]BIAS
setp pid.x.FF0 [AXIS_0]FF0
setp pid.x.FF1 [AXIS_0]FF1
setp pid.x.FF2 [AXIS_0]FF2
setp pid.x.deadband [AXIS_0]DEADBAND
setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT

net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-output => pid.x.output
net x-pos-cmd => pid.x.command
net x-vel-fb => pid.x.command-deriv
net x-pos-fb => pid.x.feedback

loadrt pid names=pid.x,pid.y,pid.z

addf pid.x.do-pid-calcs servo-thread
addf pid.y.do-pid-calcs servo-thread

etc

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

More
23 May 2013 22:33 #34591 by casetero
Replied by casetero on topic 7I85S with TTL encoders
Thank you for your help!

But still doing the same, i think the problem is the wiring of the cables. Because the pin hm2_5i25.0.encoder.00.index-enable never moves, only if i put it in

setp hm2_5i25.0.encoder.01.counter-mode 1 and it is because one phase is sending pulses everytime.

Do you normally feed the daughter board with external electric feed or with the FPGA card??

Thank you!

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

More
23 May 2013 22:58 #34592 by casetero
Replied by casetero on topic 7I85S with TTL encoders
If i feed the 7i85s with external power, the two pins get estable and dont send pulses everytime, it appears now electrical noise, which i quit by conecting the "maya" to the GND connector of the 7i85s. I dont know how to say "maya" in english, its the metalic tube that envolves the little cables of the wire, and its function is to reduce the electric noise.

The fact of reducing the electric noise make me think that im in the correct way, but still no reading pulses from scale when moving. Doing the same with the paralell port reads pulses nice.

Thank you!

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

More
23 May 2013 23:06 #34593 by PCW
Replied by PCW on topic 7I85S with TTL encoders
If the encoder counts in mode 1, this suggests a wiring error (no QB)
or a input mode (TTL/differential) error.
Can you check the QA and QB signals at the 7I85 terminals
with a voltmeter to make sure they can each be set to both states
by moving your encoder?

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

More
23 May 2013 23:44 #34596 by casetero
Replied by casetero on topic 7I85S with TTL encoders
Now the encoder counts doesnt move in mode 1 because the two signals are stable and dont send pulses everytime, i´ve reached this by adding an external power of 5 V to the 7i85s instead of geting the power from the 5i25. I have changed the jumpers to do this.

What do i have to do to with the voltimeter, right now i have 1.68 V betwen QA0 and GND, and 5.13 V between QB0 and GND. It is supossed to change if i move the encoder??

Thank you very much.

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

Moderators: PCWjmelson
Time to create page: 0.205 seconds
Powered by Kunena Forum