Main Site Documentation

Maximum PWM Frequency for USBizi and EMX chipsets?


I have straight and simple question for which I cannot find an answer anywhere:
What is the Maximum PWM Frequency for USBizi and EMX chipsets I can generate in hardware level?

P.S. When I tried to play with duty cycle on USBizi 144 chpset at 5MHz PWM frequency, I had successfull duty cycle at 100% and between 80% - 0%. Between 99% - 81% the PWM shuts off at all. At any higher frequencies over 5MHz it is completely buggy, sloppy and weird!

We are working on Intelligent PWM for our new line of products and I need to jam out max PWM frequency from FEZ Domino and FEZ Cobra boards.

Developers at GHI, please clarify this situation and give me straight answer regarding what max frequency I can reach along with stable duty cycle management.

I love the NETMF and your dev. boards!
Thanks a lot!

Viktor Z.


For advanced use or near upper-limit frequency, you should use “SetPulse” not “Set”. You can do very very high frequencies but then you lose in your step-resolution…just try SetPulse at high frequency and you will know what I mean.


What exactly SetPulse does? Will it enhance my PWM generation and stabilize duty cycle management on the go?

And one more time: can anyone tell me what is max safe frequency of PWM on GHI’s chipsets?
I am working on maxing out HHO Dry Cell production by the way of controlling max possible PWM.


May be this will help:


[quote]What exactly SetPulse does? Will it enhance my PWM generation and stabilize duty cycle management on the go?
Yes it will make everything easier for you to understand and control.

[quote]And one more time: can anyone tell me what is max safe frequency of PWM on GHI’s chipsets?
I am working on maxing out HHO Dry Cell production by the way of controlling max possible PWM.

There is no “safe” max frequency. The higher the frequency, the lower resolution you will have. We do 0% to 100%, that is 100 steps but the math fractions may not be on our side. If you only need 50% duty then the frequency can be quite high.

When you use SetPulse, you have full control over PWM. Because with this option, you configure the PWM exactly to the way it is set internally in the processor registers.

By the way, internally, “Set” actually uses “SetPulse”


Do I understand correctly – to get 50% pwm you toggle every other clock pulse so frequency can be as high as clk/2. To get 87% duty, for instance, you need to count 87 times, toggle, count 13, toggle, repeat, so your best rate would be clk over 100?


Yes, to configure PWM (internally) we give it the period and then the high pulse length.

The fastest you can do is
2xclock period
1xclock high pulse
…that is 50% duty

In order for you to get 25% duty you need a clock of 4x minimum
4xclock period
1xclock high pulse

This is better explained in user manual

Note that GHI also provides “Register” class and through it, you can write your own PWM to fit any specific needs.


I am completely lost here with SetPulse. It is definitely easier to use Set, but it is limited in comparison witj SetPulse. Right?


Correct. As Gus said “Set” uses internally “SetPulse”.


So if I wamt to set 400 KHz @ 80% dutu how should I write SetPulse?


I believe something like this:



When I use pwm.Set(Frequency, duty) all seems allright at 100% duty. When I lover duty cycle my power mosfets are overheating rapidly and it happened to kill one mosfet pair I was using for prototyping at average consumption of 60 Amp.

I still cannot understand the implementation of pwm.SetPulse.

Can you guys layout a formula where I can feed the pwm.SetPulse with needed Frequency and duty cycle?

I understand that the Frequency of the pulse is to be given in “Period of the signal in nano seconds” and duty cycle in “High time of the signal in nano seconds”.

What I nuderstand I should divide 1000000000 ns by frequency in Hertz or what?

Can anybody give me a definite answer?

Also, I have to change my frequency and duty cycle on a fly depending on my sensors values.

I managed to do that with pwm.Set, but the results are freaking out my power mosfets. So, I want to give the pwm.SetPulse a try, but still do not know how to give it the values I want.

Thanks a lot for your help!


10^9 /(freq in Hz) == period of the pulse (in ns) == period_nanosecond
period_nanosecond*duty (between 0 and 100%) == highTime_nanosecond

12.34kHz, 56% positive duty cycle would use

Your FETs should not be getting very hot unless you are drawing too much current through them or you’re not getting them turned on all the way. Post a schematic, even a rough one? Along with the FET part number?


Ok. Here I want to share what I achieved with finally switching from pwm.Set over to pwm.SetPulse

  1. Very smooth generation of needed frequency of up to 2 MHz.
  2. Painless scaling of Duty Cycle.
  3. My Power Mosfets do not overheat at duty lover 100%. With pwm.Set I had a lot of trouble with any duty cycle bellow 100%. They overheated and burned out so quickly.

I had to adapt the above given code in last message:

pwm.SetPulse((10 ^ 9 / PWMfrequency), (10 ^ 9 / 100 * PWMDuty));


Glad you got it to work and thanks for posting for everybody’s benefit. Still don’t know why your FETs would get hot – love to have a 'scope on the gate. May be one of those “we’ll never know but it’s ok 'cause it’s working” things.


I use 2x 120AMP 24V Power Mosfets 125N2RG and I was wondering why they are overheating badly.

One thing with the PWM management, and another one, as I am pretty sure, was that I was powering my FEZ Domino just from USB port at the same time driving BMP085, DS18B20 sensors and a mosfet driver. I think the board did not have enough current on its pins to drive the mosfet drivers efficiently in order to switch them on and off at right time. Seems they were overheating badly because of semi on/off state thus causing a lots of current leak through the gate.

Anyways, after powering the board by 12V regulated Power Supply the problem is gone.

And as to the PWM modulating, with the pwm.SetPulse I know for sure what is this baby doing. :wink: