pwmgen.0.pwm-freq; Frequency changing with spindle speed;

More
19 Aug 2021 19:47 #218173 by C_M_H
I'm have a problem with implementing a simple PWM laser control on my gantry style router.

Everything is working as expected except the pwm output frequency.

I'm using spindle speed as the source of the pwmgen.0.value and have set the pwmgen.0.pwm-freq  to 15000 hz.
If the spindle speed is set to 0.5 I get a 50% duty cycle @ 8 kHz. If the spindle speed is set to 0.75 I get a 75% duty-cycle but the frequency drops to 4 kHz. 0.25 also gives 4 kHz.  0.05 and 0.95 both drop it down to 800 Hz.

I expected the duty-cycle to change but not the frequency. Any ideas about what I'm doing wrong?It's been awhile since I've worked with linuxCNC and so I'm a little rusty. 

Thanks in advance.

A screenshot of the relevant section of the HAL file;
 

The g-code I'm using to test;
 

The HAL file;
 

File Attachment:

File Name: 4th_Axis.hal
File Size:7 KB

 
Attachments:

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

More
19 Aug 2021 20:00 - 19 Aug 2021 20:00 #218174 by PCW
You will get a variable frequency if you enabled dither.
(you actually get PDM rather than PWM in this case)
Last edit: 19 Aug 2021 20:00 by PCW.

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

More
19 Aug 2021 21:32 #218180 by C_M_H
Ok, thanks for this note.

I disabled pwm dither and sure enough the frequency stays the same across various values. I did however have to drop my pwm frequency from 15 kHz to 1 kHz in order to get 0.1 increment resolution. My laser driver wants a 15 kHz control signal but I'll see if it ok with 1 kHz.

Thanks again.

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

Time to create page: 0.088 seconds
Powered by Kunena Forum