PWM Frequency

Hello,

I am trying to increase my MKR Zero pwm frequency. I found some valuable solutions on this forum with registers manipulation, but they implie to break the analogWrite() function.
Does anyone knows a way to increase the pwm frequency (on pin 7 for example) without breaking analogWrite() ? I would like to have at least 10kHz.

Thanks,
Leo

Hi Leo,

If you're using register manipulation to control the PWM frequency on a particular pin, it shouldn't affect the analogWrite() function, unless the function happens to be using the same timer.

The analogWrite() function uses the digital pin number, to determine which timer (TCC or TC) is selected.