OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
15 Apr 2023 22:38 #269165
by andypugh
Replied by andypugh on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
You should get faster settling to the commanded speed with a better linearity.
The following user(s) said Thank You: mor
Please Log in or Create an account to join the conversation.
16 Apr 2023 00:12 #269168
by blazini36
Replied by blazini36 on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
For whatever reason I thought you were using a Mesa card with an analog spindle output. I get those numbers confused.
If you're using one of those Chinese $8 BOBs with the DB25 then Andy is probably right about the Optocoupler output's rise/fall time but the in that case I'd lower the PWM frequency by alot. No idea what kind of Opto they're using on that thing but optos can be very slow. You should probably reduce the PWM frequency to 1khz or less, maybe even less than 100hz. Then try to get the output voltage correct by adjusting the hm2 PWM scale which has a range of -1.0 to 1.0, The scale is supposed to adjust the duty cycle to the input value. I would think that if the optocoupler was slow the duty cycle would have a better effect than the frequency.
If you're using one of those Chinese $8 BOBs with the DB25 then Andy is probably right about the Optocoupler output's rise/fall time but the in that case I'd lower the PWM frequency by alot. No idea what kind of Opto they're using on that thing but optos can be very slow. You should probably reduce the PWM frequency to 1khz or less, maybe even less than 100hz. Then try to get the output voltage correct by adjusting the hm2 PWM scale which has a range of -1.0 to 1.0, The scale is supposed to adjust the duty cycle to the input value. I would think that if the optocoupler was slow the duty cycle would have a better effect than the frequency.
The following user(s) said Thank You: mor
Please Log in or Create an account to join the conversation.
16 Apr 2023 00:18 #269169
by mor
Replied by mor on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
I’m using a Mesa 7i92 to cheap 5-axis BOB. Increasing PWM frequency is what helped me reach full 10V output but I’ll try lowering it and playing with scale to achieve the same thing and see if the linearity is better.
Please Log in or Create an account to join the conversation.
16 Apr 2023 00:31 #269171
by blazini36
Replied by blazini36 on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
That's because the frequency was so fast it was overcoming the Rise/fall of the optocoupler. You're scale has always been whacked out, I misunderstood what the ini OUTPUT_SCALE you mentioned at first was referencing. This Line:Means that OUTPUT_SCALE in your ini is setting the hm2 pwmgen scale parameter to
That parameter only has a range of -1.0 to 1.0 so it's being clipped to 1.0 as per the doc.
Is not referenced in your hal file so it has no effect. It could be used in your postgui.hal file for setting display spindle speed or something.
setp [HMOT](CARD0).pwmgen.00.scale [SPINDLE_0]OUTPUT_SCALE
OUTPUT_SCALE = 2800
That parameter only has a range of -1.0 to 1.0 so it's being clipped to 1.0 as per the doc.
OUTPUT_MAX_LIMIT
Is not referenced in your hal file so it has no effect. It could be used in your postgui.hal file for setting display spindle speed or something.
Please Log in or Create an account to join the conversation.
16 Apr 2023 00:58 #269176
by mor
Replied by mor on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
I just used PnCConf to set it up so not sure exactly where I entered it from but I’ll try playing with adjusting it between -1 and 1 and lower my PWM frequency to 1000Hz to observe. Thanks again for the support.
Please Log in or Create an account to join the conversation.
16 Apr 2023 07:28 #269195
by mor
Replied by mor on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
I went through all the documentation and couldn't find any reference to spindle OUTPUT_SCALE.
Most of the examples I've seen have OUTPUT_SCALE matching OUTPUT_MAX_LIMIT.
Interestingly, I changed my OUTPUT_SCALE from 2800 to 700 and now it's almost perfectly linear from 0V-10V. 1% gets me 0.3V and throughout the range the voltage is roughly 0.1V higher than the expected value at the respective %.
I would like to understand more about OUTPUT_SCALE and how it works. I'd also like to understand what PWM base frequency is ideal for me as it seemed to work at 1000Hz as well as 35000Hz except the top range would change.
I've attached my latest HAL and INI. I might leave it like this if there are no other suggestions or feedback as it seems to "work". Thanks everyone for the support.
Most of the examples I've seen have OUTPUT_SCALE matching OUTPUT_MAX_LIMIT.
Interestingly, I changed my OUTPUT_SCALE from 2800 to 700 and now it's almost perfectly linear from 0V-10V. 1% gets me 0.3V and throughout the range the voltage is roughly 0.1V higher than the expected value at the respective %.
I would like to understand more about OUTPUT_SCALE and how it works. I'd also like to understand what PWM base frequency is ideal for me as it seemed to work at 1000Hz as well as 35000Hz except the top range would change.
I've attached my latest HAL and INI. I might leave it like this if there are no other suggestions or feedback as it seems to "work". Thanks everyone for the support.
Please Log in or Create an account to join the conversation.
16 Apr 2023 17:57 #269223
by blazini36
Replied by blazini36 on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
OK, you're not really understanding how it works.
OUTPUT_SCALE in the ini doesn't mean anything. It could be called BUGGER_SCALE. As I said, this line in your hal file...
Means "Set pin/parameter for your mesa card pwmgen scale to what is in your ini SPINDLE0 section to the value of OUTPUT_SCALE". everytime you see brackets in a hal file it is telling that line to reference that variable in the ini file.
If your ini said this:
And your hal file had this line
it would still be setting the pwmgen scale to 700.
This is the doc for what you are trying to set
linuxcnc.org/docs/html/drivers/hostmot2.html#_pwmgen
according to this 700 makes absolutely no difference from 2800 because it's getting clipped. You don't have to guess about this, after you launch linuxCNC open halshow or run "halcmd showpin*" (can't remember exactly, look it up) and look at that hm2_7i92.0.pwmgen.00.scale value. Even though you are setting it to 700 it should still show that it is actually at 1.0
I looked a some configuration on a mach forum and they have the PWM base frequency for that thing at 35hz, which basically means it's garbage but you need to lower the frequency below 100hz and use the scale appropriately. Since 90% of the time nobody actually follows advice I changed your hal files for you.
I changed OUTPUT_SCALE to PWM_SCALE to illustrate the point that that can be named anything. I also Added PWM_FREQ to your ini and linked it in your hal file. If you run PNCconf again you will wipe these changes out. Looking at the date on your files it appears that's how you've been doing this but once you run PNCconf the first time you should stop using it and edit the files manually.
Now all you have to do is edit those to values in your ini and restart linuxCNC each time. Don't do anything else until you get the output you're looking for.
OUTPUT_SCALE in the ini doesn't mean anything. It could be called BUGGER_SCALE. As I said, this line in your hal file...
setp [HMOT](CARD0).pwmgen.00.scale [SPINDLE_0]OUTPUT_SCALE
Means "Set pin/parameter for your mesa card pwmgen scale to what is in your ini SPINDLE0 section to the value of OUTPUT_SCALE". everytime you see brackets in a hal file it is telling that line to reference that variable in the ini file.
If your ini said this:
[SPINDLE_0]
BUGGER_SCALE = 700
And your hal file had this line
setp [HMOT](CARD0).pwmgen.00.scale [SPINDLE_0]BUGGER_SCALE
it would still be setting the pwmgen scale to 700.
This is the doc for what you are trying to set
linuxcnc.org/docs/html/drivers/hostmot2.html#_pwmgen
according to this 700 makes absolutely no difference from 2800 because it's getting clipped. You don't have to guess about this, after you launch linuxCNC open halshow or run "halcmd showpin*" (can't remember exactly, look it up) and look at that hm2_7i92.0.pwmgen.00.scale value. Even though you are setting it to 700 it should still show that it is actually at 1.0
I looked a some configuration on a mach forum and they have the PWM base frequency for that thing at 35hz, which basically means it's garbage but you need to lower the frequency below 100hz and use the scale appropriately. Since 90% of the time nobody actually follows advice I changed your hal files for you.
I changed OUTPUT_SCALE to PWM_SCALE to illustrate the point that that can be named anything. I also Added PWM_FREQ to your ini and linked it in your hal file. If you run PNCconf again you will wipe these changes out. Looking at the date on your files it appears that's how you've been doing this but once you run PNCconf the first time you should stop using it and edit the files manually.
Now all you have to do is edit those to values in your ini and restart linuxCNC each time. Don't do anything else until you get the output you're looking for.
Attachments:
Please Log in or Create an account to join the conversation.
16 Apr 2023 23:00 - 16 Apr 2023 23:33 #269247
by mor
Replied by mor on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
I understand what you're saying so just to demonstrate that OUTPUT_SCALE isn't being automatically clipped to 1, I have done the following:
Thanks for your assistance as it's helped me reach this point of my debug.
- I've lowered the PWM base frequency to 35; any values below 1000Hz didn't really make much of a difference. 500Hz seems to be the sweet spot for me and gets me within 30mV in the middle of the range.
- setp [HMOT](CARD0).pwmgen.00.scale 1 (all values below are clipped to 1 anyways as you mentioned and the doc states)
- OUTPUT_SCALE or BUGGER_SCALE makes no difference anymore after hardcoding above to 1; as it's only referenced by that line.
So why would changing it to 700 from 2800 make a change when it's supposed to just be clipped to 1? The doc says that DC is clipped to -1 to 1 and not necessarily SCALE.
Also, I only use PNCConf once because I can't re-open my conf files after the first setup (I posted this on a separate thread), so I've made all edits manually after the initial setup.
- scale - (Float, RW) Scaling factor to convert value from arbitrary units to duty cycle: dc = value / scale. Duty cycle has an effective range of -1.0 to +1.0 inclusive, anything outside that range gets clipped.
Thanks for your assistance as it's helped me reach this point of my debug.
Last edit: 16 Apr 2023 23:33 by mor. Reason: Fixed mistake
Please Log in or Create an account to join the conversation.
17 Apr 2023 00:50 - 17 Apr 2023 15:16 #269251
by blazini36
Replied by blazini36 on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
I don't have any cards with a pwmgen enabled to verify but like I said there's no need to guess when you can just open a terminal and type:
I will say that now that I look at it the way that section of the doc is written is slightly confusing you're right, the -1.0 to 1.0 thing is the ratio not the pin range. That should have been worded in the doc.
halcmd show pin *pwmgen*
I will say that now that I look at it the way that section of the doc is written is slightly confusing you're right, the -1.0 to 1.0 thing is the ratio not the pin range. That should have been worded in the doc.
Last edit: 17 Apr 2023 15:16 by blazini36. Reason: avoid confusion
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19209
- Thank you received: 6438
17 Apr 2023 09:51 #269288
by tommylight
Replied by tommylight on topic OUTPUT_SCALE < OUTPUT_MAX_LIMIT?
The last paragraph on last post is a bit off, not frequency, scale, if scale is 35 or 1000.
-
PWM = pulse width modulation
PDM = pulse duration modulation
PWM cam theoretically have any frequency, and this has nothing to do with scaling, just the speed of the pulses.
Scaling changes how long should those pulses be, regardless of frequency,
-
PWM = pulse width modulation
PDM = pulse duration modulation
PWM cam theoretically have any frequency, and this has nothing to do with scaling, just the speed of the pulses.
Scaling changes how long should those pulses be, regardless of frequency,
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.103 seconds