Mesa modbus and pktUart
04 Sep 2023 15:16 #279838
by Donno
Replied by Donno on topic Mesa modbus and pktUart
Yes I have Pos - 620ohm - 120 ohm - 620 ohm -Neg
If i wire it any other way i get fault or if i remove 120ohm then i get a fault so i am pretty sure it is connecting. What are the default data and stop bit ?
Test.modHAL File
This is what i am expecting on address 0 to 8
If i wire it any other way i get fault or if i remove 120ohm then i get a fault so i am pretty sure it is connecting. What are the default data and stop bit ?
Test.mod
// Test Driver
#define MAX_MSG_LEN 16 // may be increased if necessary to max 251
#define DEBUG 3
static const hm2_modbus_chan_descriptor_t channels[] = {
/* {TYPE, FUNC, ADDR, COUNT, pin_name} */
{HAL_U32, 3, 0x0000, 1, "test0"},
{HAL_U32, 3, 0x0001, 1, "test1"},
{HAL_U32, 3, 0x0002, 1, "test2"},
{HAL_U32, 3, 0x0003, 1, "test3"},
{HAL_U32, 3, 0x0004, 1, "test4"},
{HAL_U32, 3, 0x0005, 1, "test5"},
{HAL_U32, 3, 0x0006, 1, "test6"},
{HAL_U32, 3, 0x0007, 1, "test7"},
{HAL_U32, 3, 0x0008, 1, "test8"},
};
# Generated by PNCconf at Mon Aug 28 20:19:10 2023
# Using LinuxCNC version: Master (2.9)
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="192.168.1.121" config="num_encoders=1 num_pwmgens=0 num_stepgens=2"
loadrt test ports=hm2_7i92.0.pktuart.0
setp hm2_7i92.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.z,pid.s
loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
loadrt scale names=scale.spindle
loadrt near
addf hm2_7i92.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller 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 scale.spindle servo-thread
addf abs.spindle servo-thread
addf lowpass.spindle servo-thread
addf near.0 servo-thread
addf hm2_7i92.0.write servo-thread
addf test.00 servo-thread
setp hm2_7i92.0.dpll.01.timer-us -50
setp hm2_7i92.0.stepgen.timer-number 1
setp test.00.address 1
setp test.00.baudrate 19200
setp test.00.parity 2
setp test.00.update-hz 0.1
# external output signals
# --- DOUT-00 ---
setp hm2_7i92.0.gpio.000.is_output true
net dout-00 => hm2_7i92.0.gpio.000.out
# --- SPINDLE-ENABLE ---
setp hm2_7i92.0.gpio.005.is_output true
net spindle-enable => hm2_7i92.0.gpio.005.out
# --- SPINDLE-CW ---
setp hm2_7i92.0.gpio.006.is_output true
net spindle-cw => hm2_7i92.0.gpio.006.out
# --- SPINDLE-CCW ---
setp hm2_7i92.0.gpio.007.is_output true
net spindle-ccw => hm2_7i92.0.gpio.007.out
# --- COOLANT-MIST ---
setp hm2_7i92.0.gpio.008.is_output true
net coolant-mist => hm2_7i92.0.gpio.008.out
# --- DOUT-01 ---
setp hm2_7i92.0.gpio.013.is_output true
net dout-01 => hm2_7i92.0.gpio.013.out
# --- DOUT-02 ---
setp hm2_7i92.0.gpio.015.is_output true
net dout-02 => hm2_7i92.0.gpio.015.out
# --- DOUT-03 ---
setp hm2_7i92.0.gpio.016.is_output true
net dout-03 => hm2_7i92.0.gpio.016.out
# --- ESTOP-OUT ---
setp hm2_7i92.0.gpio.030.is_output true
net estop-out => hm2_7i92.0.gpio.030.out
# --- MACHINE-IS-ENABLED ---
setp hm2_7i92.0.gpio.032.is_output true
net machine-is-enabled => hm2_7i92.0.gpio.032.out
# --- SPINDLE-ENABLE ---
setp hm2_7i92.0.gpio.033.is_output true
net spindle-enable => hm2_7i92.0.gpio.033.out
# external input signals
# --- HOME-X ---
net home-x <= hm2_7i92.0.gpio.012.in
# --- HOME-Z ---
net home-z <= hm2_7i92.0.gpio.014.in
# --- DIN-00 ---
net din-00 <= hm2_7i92.0.gpio.019.in
# --- DIN-01 ---
net din-01 <= hm2_7i92.0.gpio.020.in
# --- DIN-02 ---
net din-02 <= hm2_7i92.0.gpio.021.in
# --- DIN-03 ---
net din-03 <= hm2_7i92.0.gpio.022.in
# --- ESTOP-EXT ---
net estop-ext <= hm2_7i92.0.gpio.023.in
# --- PROBE-IN ---
net probe-in <= hm2_7i92.0.gpio.024.in
#*******************
# AXIS X JOINT 0
#*******************
setp pid.x.Pgain [JOINT_0]P
setp pid.x.Igain [JOINT_0]I
setp pid.x.Dgain [JOINT_0]D
setp pid.x.bias [JOINT_0]BIAS
setp pid.x.FF0 [JOINT_0]FF0
setp pid.x.FF1 [JOINT_0]FF1
setp pid.x.FF2 [JOINT_0]FF2
setp pid.x.deadband [JOINT_0]DEADBAND
setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.x.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.x.maxerror 0.012700
net x-index-enable => pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-pos-fb => pid.x.feedback
net x-output <= pid.x.output
# Step Gen signals/setup
setp hm2_7i92.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
setp hm2_7i92.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
setp hm2_7i92.0.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_7i92.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
setp hm2_7i92.0.stepgen.00.position-scale [JOINT_0]STEP_SCALE
setp hm2_7i92.0.stepgen.00.step_type 0
setp hm2_7i92.0.stepgen.00.control-type 1
setp hm2_7i92.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp hm2_7i92.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-output => hm2_7i92.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_7i92.0.stepgen.00.position-fb
net x-pos-fb => joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out
net x-enable => hm2_7i92.0.stepgen.00.enable
# ---setup home / limit switch signals---
net home-x => joint.0.home-sw-in
net x-neg-limit => joint.0.neg-lim-sw-in
net x-pos-limit => joint.0.pos-lim-sw-in
#*******************
# AXIS Z JOINT 1
#*******************
setp pid.z.Pgain [JOINT_1]P
setp pid.z.Igain [JOINT_1]I
setp pid.z.Dgain [JOINT_1]D
setp pid.z.bias [JOINT_1]BIAS
setp pid.z.FF0 [JOINT_1]FF0
setp pid.z.FF1 [JOINT_1]FF1
setp pid.z.FF2 [JOINT_1]FF2
setp pid.z.deadband [JOINT_1]DEADBAND
setp pid.z.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.z.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp pid.z.maxerror 0.012700
net z-index-enable => pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-pos-fb => pid.z.feedback
net z-output <= pid.z.output
# Step Gen signals/setup
setp hm2_7i92.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_7i92.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_7i92.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_7i92.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_7i92.0.stepgen.01.position-scale [JOINT_1]STEP_SCALE
setp hm2_7i92.0.stepgen.01.step_type 0
setp hm2_7i92.0.stepgen.01.control-type 1
setp hm2_7i92.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp hm2_7i92.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-pos-cmd <= joint.1.motor-pos-cmd
net z-vel-cmd <= joint.1.vel-cmd
net z-output => hm2_7i92.0.stepgen.01.velocity-cmd
net z-pos-fb <= hm2_7i92.0.stepgen.01.position-fb
net z-pos-fb => joint.1.motor-pos-fb
net z-enable <= joint.1.amp-enable-out
net z-enable => hm2_7i92.0.stepgen.01.enable
# ---setup home / limit switch signals---
net home-z => joint.1.home-sw-in
net z-neg-limit => joint.1.neg-lim-sw-in
net z-pos-limit => joint.1.pos-lim-sw-in
#*******************
# SPINDLE
#*******************
setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
setp pid.s.maxoutput [SPINDLE_0]MAX_OUTPUT
setp pid.s.error-previous-target true
net spindle-index-enable => pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm-abs => pid.s.command
net spindle-vel-fb-rpm-abs => pid.s.feedback
net spindle-output <= pid.s.output
# ---Encoder feedback signals/setup---
setp hm2_7i92.0.encoder.00.counter-mode 0
setp hm2_7i92.0.encoder.00.filter 1
setp hm2_7i92.0.encoder.00.index-invert 0
setp hm2_7i92.0.encoder.00.index-mask 0
setp hm2_7i92.0.encoder.00.index-mask-invert 0
setp hm2_7i92.0.encoder.00.scale [SPINDLE_0]ENCODER_SCALE
net spindle-revs <= hm2_7i92.0.encoder.00.position
net spindle-vel-fb-rps <= hm2_7i92.0.encoder.00.velocity
net spindle-vel-fb-rpm <= hm2_7i92.0.encoder.00.velocity-rpm
net spindle-index-enable <=> hm2_7i92.0.encoder.00.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
# ---Setup spindle at speed signals---
net spindle-vel-cmd-rps => near.0.in1
net spindle-vel-fb-rps => near.0.in2
net spindle-at-speed <= near.0.out
setp near.0.scale 1.000000
setp near.0.difference 0.166667
# Use ACTUAL spindle velocity from spindle encoder
# spindle-velocity bounces around so we filter it with lowpass
# spindle-velocity is signed so we use absolute component to remove sign
# ACTUAL velocity is in RPS not RPM so we scale it.
setp scale.spindle.gain 60
setp lowpass.spindle.gain 1.000000
net spindle-vel-fb-rps => scale.spindle.in
net spindle-fb-rpm scale.spindle.out => abs.spindle.in
net spindle-fb-rpm-abs abs.spindle.out => lowpass.spindle.in
net spindle-fb-rpm-abs-filtered lowpass.spindle.out
#******************************
# connect miscellaneous signals
#******************************
# ---HALUI signals---
net axis-select-x halui.axis.x.select
net jog-x-pos halui.axis.x.plus
net jog-x-neg halui.axis.x.minus
net jog-x-analog halui.axis.x.analog
net x-is-homed halui.joint.0.is-homed
net axis-select-z halui.axis.z.select
net jog-z-pos halui.axis.z.plus
net jog-z-neg halui.axis.z.minus
net jog-z-analog halui.axis.z.analog
net z-is-homed halui.joint.1.is-homed
net jog-selected-pos halui.axis.selected.plus
net jog-selected-neg halui.axis.selected.minus
net spindle-manual-cw halui.spindle.0.forward
net spindle-manual-ccw halui.spindle.0.reverse
net spindle-manual-stop halui.spindle.0.stop
net machine-is-on halui.machine.is-on
net jog-speed halui.axis.jog-speed
net MDI-mode halui.mode.is-mdi
# ---coolant signals---
net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
# ---probe signal---
net probe-in => motion.probe-input
# ---motion control signals---
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
# ---digital in / out signals---
net dout-00 <= motion.digital-out-00
net dout-01 <= motion.digital-out-01
net dout-02 <= motion.digital-out-02
net dout-03 <= motion.digital-out-03
net din-00 => motion.digital-in-00
net din-01 => motion.digital-in-01
net din-02 => motion.digital-in-02
net din-03 => motion.digital-in-03
# ---estop signals---
net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in
# ---manual tool change signals---
net tool-change-request <= iocontrol.0.tool-change
net tool-change-confirmed => iocontrol.0.tool-changed
net tool-number <= iocontrol.0.tool-prep-number
# ---Use external manual tool change dialog---
loadusr -W hal_manualtoolchange
net tool-change-request => hal_manualtoolchange.change
net tool-change-confirmed <= hal_manualtoolchange.changed
net tool-number => hal_manualtoolchange.number
# ---ignore tool prepare requests---
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
This is what i am expecting on address 0 to 8
[color=#ff5454]A5 Servo Driver | 16:59:43 [/color][color=#000000] [/color]
[color=#e74c3c]0 : 14130 | 1 : 0 | 2 : 0 | 3 : 0 | 4 : 0 | 5 : 0 | 6 : 0 | 7 : 0 | 8 : 14100 |[/color][color=#5454ff] [/color]
Attachments:
Please Log in or Create an account to join the conversation.
04 Sep 2023 16:02 #279843
by PCW
Replied by PCW on topic Mesa modbus and pktUart
If removing the 120 ohm termination cause a fault, that indicate a polarity or
perhaps drive enable issue
What interface chip are you using and how is it wired to the 7I92?
What configuration are you using on the 7I92 and especially, what TXEN polarity are you using?
perhaps drive enable issue
What interface chip are you using and how is it wired to the 7I92?
What configuration are you using on the 7I92 and especially, what TXEN polarity are you using?
Please Log in or Create an account to join the conversation.
04 Sep 2023 16:57 #279849
by Donno
Replied by Donno on topic Mesa modbus and pktUart
Attachments:
Please Log in or Create an account to join the conversation.
04 Sep 2023 18:26 - 04 Sep 2023 18:38 #279857
by PCW
Replied by PCW on topic Mesa modbus and pktUart
OK, that's not right
7I92 MAX/LTC485
TX --> MAX485 pin 4 ( DI )
RX --> MAX485 pin 2 ( RO )
TXEN --> MAX485 pin 3 ( DE )
GND --> MAX485 pin 1 ( /RE )
620 pullup to 5V --> MAX485 pin 6 ( A )
620 pulldown to GND --> MAX485 pin 7 ( B )
Also the default TXEN polarity is wrong for direct
connection to active high enables like the MAX485 uses,
so it either must be inverted in hal or the firmware
must be compiled with a pinout the uses the ntxen pin descriptor
7I92 MAX/LTC485
TX --> MAX485 pin 4 ( DI )
RX --> MAX485 pin 2 ( RO )
TXEN --> MAX485 pin 3 ( DE )
GND --> MAX485 pin 1 ( /RE )
620 pullup to 5V --> MAX485 pin 6 ( A )
620 pulldown to GND --> MAX485 pin 7 ( B )
Also the default TXEN polarity is wrong for direct
connection to active high enables like the MAX485 uses,
so it either must be inverted in hal or the firmware
must be compiled with a pinout the uses the ntxen pin descriptor
Last edit: 04 Sep 2023 18:38 by PCW.
Please Log in or Create an account to join the conversation.
05 Sep 2023 08:20 #279933
by Donno
Replied by Donno on topic Mesa modbus and pktUart
Can you give me an example please of ntxen in my use case ?
OPortTag & x"00" & PktUARTTTag & PktUTDrvEnPin,
OPortTag & x"00" & PktUARTTTag & PktUTDrvEnPin,
Please Log in or Create an account to join the conversation.
05 Sep 2023 13:10 #279967
by Donno
Replied by Donno on topic Mesa modbus and pktUart
I mixed up my TX/GND Pin in Photo ! I have added a 74HC04 to TXena pin and still nothing I found a tty to RS458 converter and tried that as well.
I re-installed LinuxCNC 2.9pre and setup everything again. I also set my pktuart on different pins just in case i might have damage one pin still no joy.
If i disconnect servo drive and probe A/B i can see signals on the probe:
I re-installed LinuxCNC 2.9pre and setup everything again. I also set my pktuart on different pins just in case i might have damage one pin still no joy.
If i disconnect servo drive and probe A/B i can see signals on the probe:
Attachments:
Please Log in or Create an account to join the conversation.
05 Sep 2023 13:52 #279973
by PCW
Replied by PCW on topic Mesa modbus and pktUart
The signals on A/B do not look right.
When undriven, A _must_ be higher than B
(or the VFD will receive garbage)
Can you scope TXEN and TXdata at the adapter pins?
When undriven, A _must_ be higher than B
(or the VFD will receive garbage)
Can you scope TXEN and TXdata at the adapter pins?
Please Log in or Create an account to join the conversation.
05 Sep 2023 14:56 #279984
by Donno
Replied by Donno on topic Mesa modbus and pktUart
Attachments:
Please Log in or Create an account to join the conversation.
05 Sep 2023 15:13 #279989
by PCW
Replied by PCW on topic Mesa modbus and pktUart
IOPortTag & x"00" & PktUARTTTag & PktUTNDrvEnPin,Can you give me an example please of ntxen in my use case ?
OPortTag & x"00" & PktUARTTTag & PktUTDrvEnPin,
Please Log in or Create an account to join the conversation.
05 Sep 2023 15:50 #279998
by PCW
Replied by PCW on topic Mesa modbus and pktUart
Is that TXEN at the adapter or direct from the 7I92
(the adapter needs active high TXEN)
(the adapter needs active high TXEN)
Please Log in or Create an account to join the conversation.
Time to create page: 0.224 seconds