Driving a charge pump with a Mesa 5i25 stepgen

More
03 Jul 2021 06:05 #213537 by PortlandGTS
I have a Mesa 5i25 with 2xG540 firmware, connected to a G540 and a 7i75 break out board. 

Following the thread mesa-7i96-and-gecko-g540 , I'm trying to get a HW stepgen to drive an external charge pump.  The following code isn't working:  (Charge pump connected to the IO02 terminal on the 7i75)

setp      [HMOT](CARD0).stepgen.05.control-type     1                # velocity mode
setp     [HMOT](CARD0).stepgen.05.velocity-cmd    10000         # 10kHz
setp     [HMOT](CARD0).stepgen.05.step_type    2                     # Quadrature for square wave
setp     [HMOT](CARD0).stepgen.05.steplen    100
setp     [HMOT](CARD0).stepgen.05.stepspace    100
setp     [HMOT](CARD0).stepgen.05.enable        1

Any suggestions on what I'm doing wrong?  I don't have a scope, so I can't see what kind of signal it's generating.

I'm able to drive the charge pump with a HW PWM generator, but I want to free up the PWM for spindle VFD.  Here's the code I have been using (Charge pump is on IO01 on the 7i75)

setp   [HMOT](CARD0).pwmgen.pwm_frequency 10000 
setp  [HMOT](CARD0).pwmgen.01.output-type 1
setp [HMOT](CARD0).pwmgen.01.value 0.5           #Square Wave
setp [HMOT](CARD0).pwmgen.01.enable 1

Thanks,
Tom

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

More
03 Jul 2021 08:58 #213542 by phillc54
This is what I have foa a G540 from a 7i96:
# ---Chargepump StepGen: 0.25 velocity = 10Khz square wave output---

setp   hm2_7i96.0.stepgen.04.dirsetup        100
setp   hm2_7i96.0.stepgen.04.dirhold         100
setp   hm2_7i96.0.stepgen.04.steplen         100
setp   hm2_7i96.0.stepgen.04.stepspace       100
setp   hm2_7i96.0.stepgen.04.position-scale  10000
setp   hm2_7i96.0.stepgen.04.step_type       2
setp   hm2_7i96.0.stepgen.04.control-type    1
setp   hm2_7i96.0.stepgen.04.maxaccel        0
setp   hm2_7i96.0.stepgen.04.maxvel          0
setp   hm2_7i96.0.stepgen.04.velocity-cmd    0.25

net x-enable                                 => hm2_7i96.0.stepgen.04.enable

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

More
05 Jul 2021 05:33 #213744 by PortlandGTS
Thanks - By looking at your code, I was able to get it to work.  

I tested each difference between your code and mine separately.  The only change that got my charge pump to work was setting maxaccel to zero.

Strange, because maxaccel is supposed to have no effect when set to zero,

Regards,
Tom

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

More
05 Jul 2021 15:04 - 05 Jul 2021 15:04 #213767 by PCW
If you set maxaccel to 0 there is no bound on the rate of change of velocity
(frequency), but if you don't set it, it is set to 1 machine unit per second^2
which will ramp the velocity (from 0) very slowly, so the charge pump
would _eventually_ work (in about 20 minutes at 1 Hz per second...)
Last edit: 05 Jul 2021 15:04 by PCW.

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

More
05 Jul 2021 18:04 #213771 by PortlandGTS
I thought something like that might be going on. Guess i just didn't wait long enough!

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

More
06 Feb 2022 16:10 #234118 by dbotos
I'm having a similar issue, so I figured I'd continue this thread rather than creating a new one.  I have a 5i25 directly to a G540 and the latter doesn't seem to be getting the charge pump signal (physical e-stop released, e-stop released in LinuxCNC, and machine power toggled on in LinuxCNC).  The red FAULT light on the G540 stays illuminated.

Attached are my INI and HAL files for 2.8.2.  I'm assuming something is missing / incorrect in the HAL file, since that's where the charge pump setup is.  5i25 is using the G540x2 firmware.

Thanks,
David
Attachments:

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

More
06 Feb 2022 17:28 #234128 by PCW
setp [HMOT](CARD0).stepgen.04.position-scale 10000
setp [HMOT](CARD0).stepgen.04.step_type 2
setp [HMOT](CARD0).stepgen.04.control-type 1
setp [HMOT](CARD0).stepgen.04.maxaccel 0
setp [HMOT](CARD0).stepgen.04.maxvel 0
setp [HMOT](CARD0).stepgen.04.velocity-cmd 0.25

This will generate a 2500 Hz square wave, not 10 KHz


For clarity, I would probable set


setp [HMOT](CARD0).stepgen.04.position-scale 1
setp [HMOT](CARD0).stepgen.04.velocity-cmd 10000

for a 10 KHz chargepump signal

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

More
06 Feb 2022 19:32 #234157 by dbotos
Peter,

Thanks.  I changed those two values and no luck.

Do I need to add a line that adds the charge pump to the base thread?  Section 14.10.2.9 of the 2.8.2 documentation says:

"The Charge Pump should be added to the base thread function."

 

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

More
06 Feb 2022 19:43 #234160 by PCW
No, the base thread is not needed for hardware stepgens

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

More
06 Feb 2022 21:12 #234174 by dbotos
Let me see if I understand this correctly:

position-scale = (distance) / (# of steps)

Divide the numerator and denominator of the right side by unit time:

position-scale = (distance / s) / (# steps / s)

If position-scale = 1, then:

(distance / s) = (# steps / s)

So a velocity command (distance / s) should generate a waveform of step pulses with a frequency (in Hz) equal to the value of the velocity commanded.

Is the charge pump expecting a 50% duty cycle wave?  Should the steplen and stepspace be bumped up to 50,000 ns each?

T = 50,000 ns + 50,000 ns = 100,000 ns

f = 1 / T = 1 / (0.000 100 000) = 10,000 Hz

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

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