7i80-DB + 7I76 - PWM Spindle ?

More
20 Jul 2019 12:38 #139960 by mjoconr
So what is the best way of getting a PWM output ?

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

More
20 Jul 2019 12:47 - 20 Jul 2019 13:24 #139961 by PCW
Replied by PCW on topic 7i80-DB + 7I76 - PWM Spindle ?
If slow PWM is OK (say 20 Hz), you could us software PWM, as pl7i92 suggested
and direct it to a field output or a unused stepgen output.

If you need faster (hardware ) PWM you would need a new 7I80DB-16 bitfile that
includes a PWMgen, probably on the last 7I76 step/dir pin set

I did find a manual for the BD1100 but its in Chinese and
doesnt seem to have much in the way of interface details
(if google translate did a decent job)
Last edit: 20 Jul 2019 13:24 by PCW.

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

More
20 Jul 2019 13:37 - 20 Jul 2019 13:42 #139965 by PCW
Replied by PCW on topic 7i80-DB + 7I76 - PWM Spindle ?
freeby.mesanet.com/7i80db_16_7i76x3D3p.bit

Bitfile for 7I80DB-16 with up to 3 7I76's
Each 7I76 has the last stepgen replaced with a pwmgen
Last edit: 20 Jul 2019 13:42 by PCW.

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

More
20 Jul 2019 13:55 #139966 by mjoconr
That's cool, does this need the hal line configured as per my message from before ?

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

More
20 Jul 2019 16:00 #139975 by PCW
Replied by PCW on topic 7i80-DB + 7I76 - PWM Spindle ?
Yes, you would need to enable at least one pwmgen in the driver command line

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

More
21 Jul 2019 04:20 #140042 by mjoconr
So how would I change the following config to configure and connect the PWM to this.
Note I had to comment out and bypass the spindle gain as config as it caused a load error
loadrt [KINS]KINEMATICS
#autoconverted  trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=1 num_pwmgens=1 num_stepgens=4 sserial_port_0=00xxxx"
setp   hm2_7i80.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.s

addf hm2_7i80.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.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
addf pid.s.do-pid-calcs       servo-thread
addf hm2_7i80.0.write         servo-thread

setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true
setp   pid.s.maxerror .0005

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

# ---digital potentionmeter output signals/setup---

setp   hm2_7i80.0.7i76.0.0.spinout-minlim    [SPINDLE_9]OUTPUT_MIN_LIMIT
setp   hm2_7i80.0.7i76.0.0.spinout-maxlim    [SPINDLE_9]OUTPUT_MAX_LIMIT
setp   hm2_7i80.0.7i76.0.0.spinout-scalemax  [SPINDLE_9]OUTPUT_SCALE

#net spindle-vel-cmd-abs     => hm2_7i80.0.7i76.0.0.spinout
net spindle-vel-cmd-rpm-abs     => hm2_7i80.0.7i76.0.0.spinout
net machine-is-enabled      => hm2_7i80.0.7i76.0.0.spinena
net spindle-ccw         => hm2_7i80.0.7i76.0.0.spindir

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

setp    hm2_7i80.0.encoder.00.counter-mode 1
setp    hm2_7i80.0.encoder.00.filter 1
setp    hm2_7i80.0.encoder.00.index-invert 0
setp    hm2_7i80.0.encoder.00.index-mask 0
setp    hm2_7i80.0.encoder.00.index-mask-invert 0
setp    hm2_7i80.0.encoder.00.scale  [SPINDLE_9]ENCODER_SCALE

net spindle-revs             <=   hm2_7i80.0.encoder.00.position
net spindle-vel-fb-rps       <=   hm2_7i80.0.encoder.00.velocity
net spindle-index-enable     <=>  hm2_7i80.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---

sets spindle-at-speed true

#  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

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

More
25 Jul 2019 22:58 #140582 by andypugh
Probably change
net spindle-vel-cmd-rpm-abs     => hm2_7i80.0.7i76.0.0.spinout
to
net spindle-vel-cmd-rpm-abs     => hm2_7i80.0.7i76.0.0.pwmgen.00.value
linuxcnc.org/docs/2.7/html/man/man9/hostmot2.9.html#pwmgen
You will also need to enable the pwmgen and set the scale using the appropriate pins.

Have you flashed the new firmware?

You can get a list of the actual pin names by typing this at the command line. (You might recognise some of it)
halrun
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=1 num_pwmgens=1 num_stepgens=4 sserial_port_0=00xxxx"
show pin
show param
show funct
exit
Copy and paste the output to a text file for reference

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

More
26 Jul 2019 01:04 #140601 by mjoconr
Thanks Andy

Yes I've flashed the firmware and updated the hal with the correct loadrt.

I do recognise the commands, but did not know I could do this by hand. Very useful.

Thanks for the reference page for the pwmgen.

Will take a little testing to work out what the frequency should be.

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

More
15 Nov 2019 07:23 #150406 by mjoconr
Hi All
Just wanted to update on this issue. The firmware provided by PCW worked a treat.
There is an issue with the direction ie I can only go M3 not M4, I'm assuming I got the wiring messed up but did not have time to check with a multimeter.
Did find out the drive sends out rotation pulse so I'm going to see if I can get LinuxCNC to estimate the RPM and feed this back in to a control loop. (might need help in another topic with this)

Thanks

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

More
15 Nov 2019 13:21 #150421 by PCW
Replied by PCW on topic 7i80-DB + 7I76 - PWM Spindle ?
The 7i80db_16_7i76x3D3p.bit firmware leaves the PWMs direction pins unconnected
I did this because if you don't need the direction pin, its free for general purpose use
and if you do need it, you can generate a direction signal in hal and drive the proper GPIO bit

7i80db_16_7i76x3D3p.bits PWM direction pins (wired to DIR4 on all 7I76s) are
on GPIOs 08, 25,42 for the first,second and third 7I76

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

Time to create page: 0.114 seconds
Powered by Kunena Forum