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

More
5 years 2 months ago #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;
 

Attachment not found



The g-code I'm using to test;
 

Attachment not found



The HAL file;
 

Attachment not found


 

Please Log in to join the conversation.

More
5 years 2 months ago #218174 by PCW
You will get a variable frequency if you enabled dither.
(you actually get PDM rather than PWM in this case)

Please Log in to join the conversation.

More
5 years 2 months ago #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 to join the conversation.

Time to create page: 0.163 seconds
Powered by Kunena Forum