Mesa card has a stepgen for spindle control. The frequency generated on pin 14 is converted by the BOB into a 0-10V VFD control signal. The stepgen frequency rate of 25 kHz generates 10V.
Mesa card has a stepgen for spindle control. The frequency generated on pin 14 is converted by the BOB into a 0-10V VFD control signal. The stepgen frequency rate of 25 kHz generates 10V.
Kirk - on my grizzly lathe I ran the spindle w/ CNC4PC hardware and used the stepgen to generate the signal for the VFD. Here is that hal for reference in case it helps you:
From the C11G manual, page 7...
6.0 VARIABLE SPEED CONTROL
This function lets you control your spindle with PWM signal. It converts the PWM signal
into an analog (0-10VDC).
This function can also be used on many DC motor controllers by replacing the
potentiometer that controls the speed.
Maybe there is another function to get this to work that I'm not seeing in the manual, but I dont see how a BoB that expects a fixed width square wave, with variable duty cycles will ever work predictably with a variable frequency square wave with fixed duty cycle signal.
Brian, if you recall this is EXACTLY the problem I had. Needed a firmware from PCW_MESA to generate a PWMGEN on the proper pin. Would be interesting to have Kirk look in Mach3 on the spindle section and see if its configed to output a PWM signal to control the spindle speed.
Scott...
Instructional Videos for CNC Guitar Building
http://www.rmgvideos.com
Perhaps Mesa will see this thread today and chime in. I can't get to the shop today to work on it until late this afternoon. It does seem that voltage is being generated since the spindle turns, but that the UI is not properly connected to control it. It also seems that while the axis stepgens are generating signals to the BOB, the charge pump isn't.
I appreciate the help from Brian and Scott.
BOb is C11GR8 - Label on bottom of board says C11G Rev. 8.7, My mill was shipped to me in 2010, and the BOB was replaced in 2014. It's likely that for the Torus John went with the newer version.
I believe the R8 boards use 25Khz, while the R9 boards use 300Hz PWM. In any case the manual I have for Rev 8.2 shows it wants the 25KHz signal.
Not having any new bright ideas I decided to work on calibrating axes. It takes a bit of time to measure travel, then edit the INI file to change the scale number, then restart and do it again. I discovered that the Home field in the INI is the distance the axis moves if there are no reference switches. In any case, using gauge blocks, I measured travel over 4" (longest block) and got it accurate to 1 thou in Z and less than a thou in X. Calibrating Y will wait for tomorrow, but I'll start with the same scale as X as the motors and ball screws are the same type.
I looked at Brian's lathe HAL but couldn't see anything that looked like it solved the problem. However, I think my stepgen values for the spindle are likely wrong as 25Kz means a 40,000 nanoseconds per cycle. The steplen in the HAL is only 10,000.
http://freeby.mesanet.com/c11g.zip
bitfile/pinfile for C11G
I also changed both the C11 and C11G to use a GPIO for the spindle direction so
its free for general use if the spindle doesn't need direction control
Peter - you should do a youtube video on how to use the Xilinx software so you don't have to keep tweaking the firmware all the time. It's just so cryptic to sit down and use, that it's overwhelming.
In trying to decypher the HAL code for the charge pump, I have wandered into linuxcnc manuals with various descriptions of the parameters for stepgens. Since most of this seems directed at those trying to control stepper motors, I rather got lost in the weeds as to position vs. scale.
It seems to me being a simple mined sort that if all we want is a 12.5KHz pulse rate going to the charge pump, then a stepgen with step_type 0 and steplen and stepspace together defining the frequency should be all that's needed. This means that both stepspace and steplen should be 40000 nanoseconds.
The spindle wants a 25KHZ rate for 10V control voltage, so its steplen and stepspace would thus be 20000 nanoseconds.
These might be worth trying tomorrow.
Umm, no the C11G spindle interface wants 0 to 100 % PWM at 300 HZ
(which is why you want to use the C11G firmware not the C11 firmware)
A vanilla C11 wants 0 to 25 KHZ step pulses for its spindle control
To generate a square wave with a stepgen, the easiest way is to set the stepmode to quadrature (mode 2) and control mode to 1
(velocity mode) set the step length and step space very small (say 100 ns like Brians example) set the step scale to the desired
frequency in Hz and then set the velocity command to 1
Peter, I have the older vanilla C11G (Rev 8). Manual is here: http://cnc4pc.com/Tech_Docs/C11GR8_2_USER_MANUAL.pdf
My board clearly matches the picture and the board layout in that manual.
Arghh so it looks like
C11 Rev8 = step frequency controlled analog
C11 Rev9 = PWM controlled analog
C11G = PWM controlled analog
For a frequency controlled analog spindle control, I would setup the stepgen like the chargepump (quadrature mode, velocity control)
and set the scaling to 25000 / Spindle_RPM@10V
I resolved the issue of the charge pump not activating. The line
net x-active => hm2_5i25.0.stepgen.05.enable
Never turned it on. So I needed an appropriate signal. I found tying it to the E-stop does work.
net machine-ok => hm2_5i25.0.stepgen.05.enable
Whether this is the best signal to use I can't tell. With Mach3, the charge pump is turned on via the Reset function.
I checked the Y-axis for accuracy using the same scale as for X, and it was dead on for a 4" movement.
I still have spindle speed issues, as it runs only at max RPM. I did find that issuing a M4 comment does start the spindle, hence seemingly the polarity on the output pin is wrong. However, once the spindle starts up the first time, both the FWD and REV buttons start the spindle although in the same direction.
A bit more progress with the spindle. The linuxcnc manual pages on 0-10V spindle control suggests that the scale parameter should be 10/max-rpm. 10/4000 = .025, so I set that value to the stepgen's position-scale parameter. When I start the spindle with 1000 as the requested speed, I got 985 in the VFD's LED, suggesting I'm on the right track. It's pretty close for 2000 rpm, but 3000 rpm gives 2800, and 4000 gives the same value. So still not correct.
The scaling I mentioned before works as expected, that is if you set the stepgen scale to 25000/4000 (6.25)
then a commanded spindle speed of 4000 rpm will result in a stepgen output frequency of 25 KHz
This scaling assumes that motions spindle speed command is directly connected to the stepgens velocity command
(no additional scaling for multi-speed spindles like Tormach etc)
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.dirsetup 100
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.dirhold 100
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.steplen 100
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.stepspace 100
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.position-scale 6.25
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.maxvel 4000
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.maxaccel 4000
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.step_type 2
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.control-type 1
I verified that this works as expected (0 to 25 KHz square wave output for a 0 to 4000 RPM stepgen velocity command
Note that the acceleration setting shown will result in a 4000 RPM/second ramp
I'll try the above tomorrow. The acceleration seems really high since the motor takes 12 seconds to reach 4000 rpm under Mach3.
In the meantime I lugged my 4th axis onto the table and attached its cable. When I attempted a small move via G0A1, I get the following cryptic error msg:
Linear move on line 0 would exceed the z axis's positive limit
Please reference the machine or check that the gcode doesn't travel outside of the machine's limits
Perhaps it's a function of the HOME=0.0, and PP is setting a soft limit at the current position that inhibits motion. In any case, the reference to the z axis is strange.
Peter's settings did not work. The result was that the spindle made a half turn before stopping , and the BOB LED for pin 16 blinked rapidly with a buzzing noise. :tired:
I got the A-axis issues resolved. The error message from post #57 was a result of a Z-axis setup issue. I had set the HOME value to 1, but that exceeded the value of MAX_LIMIT, which was only .001. When there is no limit swith, referencing an axis moves it the amount in HOME and sets a soft limit. But that exceeds MAX_LIMIT, hence an error. Mills with limit switches don't have this problem, and the defaults from the Tormach HAL already had values that don't cause issues.
I had gotten the A axis to reference by cutting down the velocity, but the Z error prevented moving the axis via an MDI command. With the Z issue fixed the A problem went away as well. Setting the SCALE to -500 gives a very accurate travel based on the degree scale around the rotab.