Mesa 7i96 + 7i85s PWM VFD Control

More
02 Nov 2023 22:35 - 03 Nov 2023 11:24 #284385 by Redneck92
Hey guys,

My harddrive in my controller PC shat the pants a few days ago.
I didn´t had made any backup of my LinuxCNC setup... Shame on me for that.

Anyway, since I first setup the machine a few years gone by and I seem to have forgotten most of the stuff.

I got her back up and running, setup all the axes and encoders and so on but the spindle setup is giving me a headache.

I have a A2 Series VFD which is controlled by 0 - 10V input.

The good guy Mister PCW from this forum here made me a specific bitfile which turned one stepgen on the 7i85s into a pwmgen.

The pwm signal is convertet into a 0-10V signal by a small converterpcb.

But for the sake of it, I can´t figure the hal pinout in relation to my wires on the 7i85s out anymore.

7i85s Wires are: TB1, Diffout 6,7, Pin 9 and 12

In my hal I had setup the spindle as follows:

loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=4 num_pwmgens=1 num_stepgens=4 sserial_port_0=0xxxxx"
setp    hm2_7i96.0.pwmgen.pwm_frequency 20000
setp    hm2_7i96.0.pwmgen.pdm_frequency 6000000
loadrt pid names=pid.x,pid.y,pid.z,pid.s

#*******************
#  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

# ---PWM Generator signals/setup---

setp   hm2_7i96.0.pwmgen.00.output-type 1
setp   hm2_7i96.0.pwmgen.00.scale  [SPINDLE_0]OUTPUT_SCALE


net spindle-vel-cmd-rpm     => hm2_7i96.0.pwmgen.00.value
net spindle-enable      => hm2_7i96.0.pwmgen.00.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 => hm2_7i96.0.ssr.00.out-01
net spindle-enable => hm2_7i96.0.pwmgen.00.enable
net spindle-cw <= spindle.0.forward
net spindle-cw => hm2_7i96.0.ssr.00.out-02
net spindle-ccw <= spindle.0.reverse
net spindle-ccw => hm2_7i96.0.ssr.00.out-03
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

Spindle Setup in ini: [SPINDLE_0]
P = 0.0
I = 0.0
D = 0.0
FF0 = 1.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 6000.0
OUTPUT_SCALE = 6000
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 6000



But the spindle will not start.
Linuxcnc starts with no errors.
I can´t seem to find the correct pins with the multimeter either.

Could someone help me or point me in the right direction?

Greetings, Mike

 
Attachments:
Last edit: 03 Nov 2023 11:24 by Redneck92.

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

More
03 Nov 2023 00:05 #284402 by PCW
The PWM pins would be 7I85S TB1.11 and TB1.12

It might be helpful to start LinuxCNC, enable the spindle
and set the spindle speed to to say 1/2 of full speed, then
run this command from a terminal window:

halcmd show all | grep pwm

and post the results here

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

More
03 Nov 2023 10:55 - 03 Nov 2023 11:27 #284432 by Redneck92
Good Morning and a big thank you ahead Mister PCW,

I did as you  told me.
I Start up Linuxcnc and programmed the spindle to M3 S3000  ( Max Rpm is set to 6000 in my ini )

Halcmd Show command prints out:
 26  bit   IN          FALSE  hm2_7i96.0.pwmgen.00.enable <== spindle-enable
    26  float IN           3000  hm2_7i96.0.pwmgen.00.value <== spindle-vel-cmd-rpm
                         ==> hm2_7i96.0.pwmgen.00.enable
                         ==> hm2_7i96.0.pwmgen.00.value
    26  bit   RW          FALSE  hm2_7i96.0.pwmgen.00.offset-mode
    26  bit   RW          FALSE  hm2_7i96.0.pwmgen.00.out0.invert_output
    26  bit   RW          FALSE  hm2_7i96.0.pwmgen.00.out0.is_opendrain
    26  s32   RW              1  hm2_7i96.0.pwmgen.00.output-type
    26  float RW           6000  hm2_7i96.0.pwmgen.00.scale
    26  u32   RW     0x005B8D80  hm2_7i96.0.pwmgen.pdm_frequency
    26  u32   RW     0x00004E20  hm2_7i96.0.pwmgen.pwm_frequency
 hm2_7i96.0.pwmgen.00.out0.invert_output          hm2_7i96.0.gpio.036.invert_output
 hm2_7i96.0.pwmgen.00.out0.is_opendrain           hm2_7i96.0.gpio.036.is_opendrain

If I measure the TB1 Pins 11 and 12 on the 7i85 I get constant 4.90 volts. If I stop the spindle I still have 4,90 volts.

If I understand correctly from the Halcmd show it means that the pwm gen does not enable because there is no spindle enable signal?! am I right? But why are there 4.90 volts then.

Then I played with the spindle override slider to see if the spindle would change rpm. It doesn´t. As soon as I pull the slider to 0% the spindle stops. When I put it to 1% the spindle goes to maximum rpm.  But I think what Is happening here is that the slider turns off the spindle enable pin when at 0% if I´m correct.
Last edit: 03 Nov 2023 11:27 by Redneck92.

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

More
03 Nov 2023 14:57 #284461 by PCW
I think you need to invert the PWM output:

setp hm2_7i96.0.pwmgen.00.out0.invert_output true

 

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

More
04 Nov 2023 09:00 #284512 by Redneck92
Good morning Mister PCW.

I inverted the output in my hal file. The voltage is still staying at 4.90 volts. Spindle ramps up to max rpm no matter if I adjust the spindle override slider or if I change the rpm in the MDI.

Halcmd show states as follows now:

 26  bit   IN          FALSE  hm2_7i96.0.pwmgen.00.enable <== spindle-enable
 26  float IN           3000  hm2_7i96.0.pwmgen.00.value <== spindle-vel-cmd-rpm
                         ==> hm2_7i96.0.pwmgen.00.enable
                         ==> hm2_7i96.0.pwmgen.00.value
    26  bit   RW          FALSE  hm2_7i96.0.pwmgen.00.offset-mode
    26  bit   RW           TRUE  hm2_7i96.0.pwmgen.00.out0.invert_output
    26  bit   RW          FALSE  hm2_7i96.0.pwmgen.00.out0.is_opendrain
    26  s32   RW              1  hm2_7i96.0.pwmgen.00.output-type
    26  float RW           6000  hm2_7i96.0.pwmgen.00.scale
    26  u32   RW     0x005B8D80  hm2_7i96.0.pwmgen.pdm_frequency
    26  u32   RW     0x00004E20  hm2_7i96.0.pwmgen.pwm_frequency
 hm2_7i96.0.pwmgen.00.out0.invert_output          hm2_7i96.0.gpio.036.invert_output
 hm2_7i96.0.pwmgen.00.out0.is_opendrain           hm2_7i96.0.gpio.036.is_opendrain

I even tried lowering the pwm frequency but that didn´t had any effect either.
I noticed that the pins also don´t change the voltage if I press the spindle stop button and the spindle stands still.
Could it be that the pwm generator is defective?
How could this happen. It functioned before my harddrive died just fine.
 

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

More
04 Nov 2023 15:51 - 04 Nov 2023 15:58 #284540 by PCW
If inverting the output pin does not change the polarity,
that suggests a wiring error.

The PWM output should come from TB1 pin 11
This pin should be low when LinuxCNC is not running
 
 
Last edit: 04 Nov 2023 15:58 by PCW.

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

More
12 Nov 2023 10:48 #285156 by Redneck92
Hello,
I just came back from a business trip yesterday and I made a little wiring scetch to show how everything is wired. 

I only seem to get 5v to the pwm output. I can´t think of any error.
 
Attachments:

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

More
12 Nov 2023 11:36 #285158 by PCW
PWM-  should go to GND (7I85S TB1 pin 10)
PWM+ should go to 7I85S pin 11

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

More
12 Nov 2023 17:04 #285181 by Redneck92
Okay I will try that tomorrow. Thank you in advance

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

More
15 Nov 2023 14:58 #285515 by Redneck92
Good Day, Sir!

I just gave your tip a try and It didn´t work. 

Spindle starts but I can not alter the RPM. It still runs on max rpm. On the pwm port there are still 4.95V.

Is there a way I can program somwhere  else a pwm port on the 7i96 or so?
I don´t realy need quick response pwm thing since I don´t index the spindle or something like that.

Greetings and thank you.

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

Time to create page: 0.186 seconds
Powered by Kunena Forum