Today I tried to run BLDC motor with MESA 5i23 and 7i39HV. I used 12V
PSU instead of 48V to be safe.
Motor has hall sensors and I mounted CUI encoder with quadrature A, B
and index on it, set to 8192 counts per revolution.
I managed to spin the motor. This is what I am happy about. The motor is
spinning nice in one direction - it runs quiet and smooth, I can't stop
it's shaft by hand, but it runs with noise and vibration in opposite
direction. I get joint following error often when vibrations grow up.
And I can see over current LED blinking, PWM waveforms are interrupted
periodically (motor phase on scope) when running in that direction..
I tried different modes: q, qi, qh, but asymmetry is almost the same.
Except that sometimes I get joint following error right after power on
or bldc init procedure gets bad result.
How to solve this problem, what should I look for?
And how this bldc init is made? Shouldn't it measure angles, going in
both directions a bit and calculating average position?
What I would like to achieve is qi mode actually. But I can't make it
work good even in qh mode.
I will be able to give my hal and ini files tomorrow. Attached file is
the one which I used as a reference.
# #######################################
#
# HAL file for HostMot2 with 3 servos
#
# Derived from Ted Hyde's original hm2-servo config
#
# Based up work and discussion with Seb & Peter & Jeff
# GNU license references - insert here. www.linuxcnc.org
#
#
# ########################################
# Firmware files are in /lib/firmware/hm2/7i43/
# Must symlink the hostmot2 firmware directory of sanbox to
# /lib/firmware before running EMC2...
# sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware
/lib/firmware/hm2
#
# See also:
#
<http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
# and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
#
# #####################################################################
# ###################################
# Core EMC/HAL Loads
# ###################################
# kinematics
# loadrt trivkins
loadrt plasmakins
# kinematics
# loadrt gantrykins
# Settings for gantrykins
# setp gantrykins.joint-0 0
# setp gantrykins.joint-1 1
# setp gantrykins.joint-2 2
# setp gantrykins.joint-3 0
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD
num_joints=[TRAJ]AXES
# standard components
loadrt pid num_chan=4
# hostmot2 driver
# if you have any firmware trouble, enable the debug flags here and see what's
going on in the syslog
#loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1
debug_pin_descriptors=1 debug_modules=1
loadrt hostmot2
# load low-level driver
loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
# load BLDC module
loadrt bldc cfg=qh,qh,qh,qh
# load Plasma THC module
loadrt plasma
loadrt mux2bit count=3
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.frequency 45000
setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000
setp hm2_[HOSTMOT2](BOARD).0.write_address 13312 # (0x3400)
setp hm2_[HOSTMOT2](BOARD).0.write_data 8 (divide/10)
setp hm2_[HOSTMOT2](BOARD).0.write_strobe TRUE
# ################################################
# 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 pid.3.do-pid-calcs servo-thread
addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
addf bldc.0 servo-thread
addf bldc.1 servo-thread
addf bldc.2 servo-thread
addf bldc.3 servo-thread
addf plasma servo-thread
addf mux2bit.0 servo-thread
addf mux2bit.1 servo-thread
addf mux2bit.2 servo-thread
# ######################################################
# Axis-of-motion Specific Configs (not the GUI)
# ######################################################
# ################
# X1 [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.3pwmgen.00.enable
net emcmot.00.enable => pid.0.enable
# net emcmot.00.enable => bldc.0.init
# net bldc.0-ok bldc.0.init-done pid.0.enable
# setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.00.fault-invert 1
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.00.deadtime 0
# 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 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_0]INPUT_SCALE
# net index-0 bldc.0.index-enable
hm2_[HOSTMOT2](BOARD).0.encoder.00.index-enable
# BLDC module settings
setp bldc.0.scale -4000
setp bldc.0.poles 8
setp bldc.0.pattern 25
# Hall sensor feedback into BLDC module
net motor.0.hall-1 hm2_[HOSTMOT2](BOARD).0.gpio.003.in => bldc.0.hall1
net motor.0.hall-2 hm2_[HOSTMOT2](BOARD).0.gpio.004.in => bldc.0.hall2
net motor.0.hall-3 hm2_[HOSTMOT2](BOARD).0.gpio.005.in => bldc.0.hall3
# position feedback signals
net motor.00.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.position =>
pid.0.feedback axis.0.motor-pos-fb
net motor.00.vel-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.velocity =>
pid.0.feedback-deriv
net enc.0.raw hm2_[HOSTMOT2](BOARD).0.encoder.00.rawcounts =>
bldc.0.rawcounts
# set PID loop gains from inifile
setp pid.0.Pgain [AXIS_0]P
setp pid.0.Igain [AXIS_0]I
setp pid.0.Dgain [AXIS_0]D
setp pid.0.bias [AXIS_0]BIAS
setp pid.0.FF0 [AXIS_0]FF0
setp pid.0.FF1 [AXIS_0]FF1
setp pid.0.FF2 [AXIS_0]FF2
setp pid.0.deadband [AXIS_0]DEADBAND
setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
# position command signals
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.00.scale [AXIS_0]OUTPUT_SCALE
net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
net motor.00.command pid.0.output => bldc.0.value
# setp bldc.0.value 0.15
net pwm.00-a bldc.0.A-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.00.A-value
net pwm.00-b bldc.0.B-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.00.B-value
net pwm.00-c bldc.0.C-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.00.C-value
# ################
# Y [1] Axis
# ################
# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable FALSE
net emcmot.01.enable <= axis.1.amp-enable-out
net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.3pwmgen.01.enable
net emcmot.01.enable => pid.1.enable
# net emcmot.01.enable => bldc.1.init
# net bldc.1-ok bldc.1.init-done pid.1.enable
# setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.01.fault-invert 1
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.01.deadtime 0
# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.01.scale [AXIS_1]INPUT_SCALE
# net index-1 bldc.1.index-enable
hm2_[HOSTMOT2](BOARD).0.encoder.01.index-enable
# BLDC module settings
setp bldc.1.scale -4000
setp bldc.1.poles 8
setp bldc.1.pattern 17
# Hall sensor feedback into BLDC module
net motor.1.hall-1 hm2_[HOSTMOT2](BOARD).0.gpio.015.in => bldc.1.hall1
net motor.1.hall-2 hm2_[HOSTMOT2](BOARD).0.gpio.016.in => bldc.1.hall2
net motor.1.hall-3 hm2_[HOSTMOT2](BOARD).0.gpio.017.in => bldc.1.hall3
# position feedback signals
net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.01.position =>
pid.1.feedback axis.1.motor-pos-fb
net motor.01.vel-fb hm2_[HOSTMOT2](BOARD).0.encoder.01.velocity =>
pid.1.feedback-deriv
net enc.1.raw hm2_[HOSTMOT2](BOARD).0.encoder.01.rawcounts =>
bldc.1.rawcounts
# 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.3pwmgen.01.scale [AXIS_1]OUTPUT_SCALE
net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
net motor.01.command pid.1.output => bldc.1.value
# setp bldc.1.value 0.25
net pwm.01-a bldc.1.A-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.01.A-value
net pwm.01-b bldc.1.B-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.01.B-value
net pwm.01-c bldc.1.C-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.01.C-value
# ################
# Z [2] Axis
# ################
# axis enable chain
newsig emcmot.02.enable bit
sets emcmot.02.enable FALSE
net emcmot.02.enable <= axis.2.amp-enable-out
net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.enable
net emcmot.02.enable => pid.2.enable
# net emcmot.02.enable => bldc.2.init
# net bldc.2-ok bldc.2.init-done pid.2.enable
# setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.fault-invert 1
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.deadtime 0
# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.index-mask-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.02.scale [AXIS_2]INPUT_SCALE
# net index-2 bldc.2.index-enable
hm2_[HOSTMOT2](BOARD).0.encoder.02.index-enable
setp bldc.2.scale -4000
setp bldc.2.poles 8
setp bldc.2.pattern 4
# Hall sensor feedback into BLDC module
net motor.2.hall-1 hm2_[HOSTMOT2](BOARD).0.gpio.027.in => bldc.2.hall1
net motor.2.hall-2 hm2_[HOSTMOT2](BOARD).0.gpio.028.in => bldc.2.hall2
net motor.2.hall-3 hm2_[HOSTMOT2](BOARD).0.gpio.029.in => bldc.2.hall3
# position feedback signals
net motor.02.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.02.position =>
pid.2.feedback axis.2.motor-pos-fb
net motor.02.vel-fb hm2_[HOSTMOT2](BOARD).0.encoder.02.velocity =>
pid.2.feedback-deriv
net enc.2.raw hm2_[HOSTMOT2](BOARD).0.encoder.02.rawcounts =>
bldc.2.rawcounts
# set PID loop gains from inifile
setp pid.2.Pgain [AXIS_2]P
setp pid.2.Igain [AXIS_2]I
setp pid.2.Dgain [AXIS_2]D
setp pid.2.bias [AXIS_2]BIAS
setp pid.2.FF0 [AXIS_2]FF0
setp pid.2.FF1 [AXIS_2]FF1
setp pid.2.FF2 [AXIS_2]FF2
setp pid.2.deadband [AXIS_2]DEADBAND
setp pid.2.maxoutput [AXIS_2]MAX_OUTPUT
# position command signals
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.scale [AXIS_2]OUTPUT_SCALE
net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command
net motor.02.command pid.2.output => bldc.2.value
# setp bldc.2.value 0.15
net pwm.02-a bldc.2.A-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.A-value
net pwm.02-b bldc.2.B-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.B-value
net pwm.02-c bldc.2.C-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.02.C-value
# ################
# X2 [3] Axis
# ################
# axis enable chain
newsig emcmot.03.enable bit
sets emcmot.03.enable FALSE
net emcmot.03.enable <= axis.3.amp-enable-out
net emcmot.03.enable => hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.enable
net emcmot.03.enable => pid.3.enable
# net emcmot.03.enable => bldc.3.init
# net bldc.3-ok bldc.3.init-done pid.3.enable
# setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.fault-invert 1
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.deadtime 0
# encoder feedback
setp hm2_[HOSTMOT2](BOARD).0.encoder.03.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.03.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.03.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.03.index-mask 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.03.index-mask-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.03.scale [AXIS_3]INPUT_SCALE
# net index-3 bldc.3.index-enable
hm2_[HOSTMOT2](BOARD).0.encoder.03.index-enable
# BLDC module settings
setp bldc.3.scale -4000
setp bldc.3.poles 8
setp bldc.3.pattern 17
# Hall sensor feedback into BLDC module
net motor.3.hall-1 hm2_[HOSTMOT2](BOARD).0.gpio.039.in => bldc.3.hall1
net motor.3.hall-2 hm2_[HOSTMOT2](BOARD).0.gpio.040.in => bldc.3.hall2
net motor.3.hall-3 hm2_[HOSTMOT2](BOARD).0.gpio.041.in => bldc.3.hall3
# position feedback signals
net motor.03.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.03.position =>
pid.3.feedback axis.3.motor-pos-fb
net motor.03.vel-fb hm2_[HOSTMOT2](BOARD).0.encoder.03.velocity =>
pid.3.feedback-deriv
net enc.3.raw hm2_[HOSTMOT2](BOARD).0.encoder.03.rawcounts =>
bldc.3.rawcounts
# set PID loop gains from inifile
setp pid.3.Pgain [AXIS_3]P
setp pid.3.Igain [AXIS_3]I
setp pid.3.Dgain [AXIS_3]D
setp pid.3.bias [AXIS_3]BIAS
setp pid.3.FF0 [AXIS_3]FF0
setp pid.3.FF1 [AXIS_3]FF1
setp pid.3.FF2 [AXIS_3]FF2
setp pid.3.deadband [AXIS_3]DEADBAND
setp pid.3.maxoutput [AXIS_3]MAX_OUTPUT
# position command signals
setp hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.scale [AXIS_3]OUTPUT_SCALE
net emcmot.03.pos-cmd axis.3.motor-pos-cmd => pid.3.command
net motor.03.command pid.3.output => bldc.3.value
# setp bldc.3.value 0.25
net pwm.03-a bldc.3.A-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.A-value
net pwm.03-b bldc.3.B-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.B-value
net pwm.03-c bldc.3.C-value => hm2_[HOSTMOT2](BOARD).0.3pwmgen.03.C-value
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users