Help with Fast PWM

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
matst
Posts: 3
Joined: 28 May 2020 22:14

Help with Fast PWM

Post by matst »

Hi

Received my z-uno today and are trying to control a fan that has pwm speed regulation. It need 25khz pwm.

I guess the best approach would be Fast PWM?
Does anyone have an example with comments? I have some trouble understanding zunoFastPWMSet

Br
Mats

matst
Posts: 3
Joined: 28 May 2020 22:14

Re: Help with Fast PWM

Post by matst »

Based on the reference i expected the below code to give 50% at 25khz, but the fan does not behave as it should. I don't have an oscillometer.
4mhz / 25khz = 160

Code: Select all

pinMode(PWM3, OUTPUT);

zunoFastPWMInit(0);       // 0 for 4 MHz (tick is 0.25 μs) and ZUNO_GPT_SCALE1024 for 31.25 kHz (tick is 32 μs)
zunoFastPWMSet(80, 80); // Low and high level time in timer ticks.
zunoFastPWMEnable(1);     // Start
The fan runs fine on a Arduino (with modified PWM frequency)

User avatar
PoltoS
Posts: 5626
Joined: 26 Jan 2011 19:36

Re: Help with Fast PWM

Post by PoltoS »

Please note that FastPWM is on PWM0 pin.

matst
Posts: 3
Joined: 28 May 2020 22:14

Re: Help with Fast PWM

Post by matst »

That solved my issue. Thanks!

Post Reply