High frequency output PWM - how make good resolution of PWM?

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I have question concerning PWM. I want to make PWM output of about 100kHz frequency. Problem is I don`t think I will get high accuracy of controlling it when using such high frequency. Let`s assume I will use the highest clock frequency 16Mps. Dividing this frequency by desired frequency (100kHz)I receive 160. 160 is not many counts to get high accuracy of PWM. 50% would be 80 counts then 100% is 160 counts and one count is only 0.625% of accuracy.

Can I solve somehow this thing?
Maybe use specially designed PWM controller or timer?

Last Edited: Thu. Apr 12, 2012 - 11:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Counter-question: What accuracy do you require?

BTW, the term here should be "resolution" rather than "accuracy".

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would like to get at least 0.1% of resolution if this is possible?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use an ATtiny45, the pwm clock can be 64MHz. The resolution will be 8 bit, or about 0.4%

It all starts with a mental vision.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ifryd,

A PWM with a fundamental freq of 100 KHz and 0.1% resolution equates to clock frequency of 100 MHz using a "standard" timer-counter approach to PWM generation (such as that used in AtMega-Tiny series processors). I don't believe any of these will run at 100 Mhz - maybe one of the XMega series because they have internal clock multipliers. Perhaps a post to that forum may get you some ideas in that uP family.

Elsewise, you are probably looking at an FPGA or CPLD solution using a family/technology that can operate at that 100 MHz clock rate.

There may also be some sort of phase-lock-loop, frequency multiplier, or similar discrete logic "magic" that could do the job.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I'll bite: What kind of PWM app requires high frequency and 0.1% resolution in steps?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may use a DDS to switch the pwm-time between
two values, for example with 0.2 probabilty
using 10cycles and with 0.8 probability 11 cycles makes
0.2*10+0.8*11=10.8 cycles

But this is only "in the mean" and you have the pwm
jitter around the wanted value.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wanted to make converter on ferrite core which would run with such frequency and I could precisely control it`s power by PWM. It is prototype device so I am at designing stage. Anyway your answers are very helpful.
Of course ferrite core can run on lower frequency f.e. 25kHz and I think I will decrease it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

160 counts are enough. Your loop regulation will switch between two adjacent values in order to give you the desired output.
Try it in real and you may see your PWM will play around even with three values.
Another option is 90PWM2 or 90PWM3 at 64Mhz with dithering in hardware.
An even better solution is to use a dedicated chip and to control it with the micro.
George.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did something similar using a Tiny26 to generate a sinewave. I used an accumulator collecting rollunder for fractional resolution.

It's in the projects section, "Accumulated PWM sinewave":
https://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=1493

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you use 16MHz crystal and full 8-bit timer for PWM, the PWM frequency is 62500 Hz and you get 1/256 resolution or about 0.39%.

You must decide what is more important, getting the frequency correct (or in fact the pulse repetition rate) or maximum pulse length, as the pulse length can only vary by 1 timer count regardless of the PWM frequency (pulse repetition rate).

So if you need a certain average pulse width, it may not matter if the maximum length of single pulse is 160 or 255, because you work counting pulse lengths in a 16MHz domain anyway.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
An even better solution is to use a dedicated chip and to control it with the micro.

Hmm yes I think I will use popular timer NE555 or something similar. I wonder how accurate I will be able to adjust duty cycle by precision pots.
Did you use other timers? In NE555 one sets duty cycle by RC constant.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I wanted to make converter on ferrite core which..

It is for a power supply ? Or what kind of converter ?
George.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It is for a power supply ? Or what kind of converter ?

Yes it is for power supply. But I wanted to have ability to control precisely power of the converter.
The converter is dedicated for prototype device which has to charge a capacitor and the capacitor should discharge with desired rate. So the capacitor can be charged with many impulses but discharges should be of precise frequency (lower than charging impulses)and precise frequency can be achieved and regulated by precise adjusting power of the converter.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at CD4046, it may give you more options.
George.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It sounds like you expect this to be an open-loop system. That is, just set the duty cycle and expect a given output voltage. It won't work that way. Your output will depend on the exact input voltage and the load. You REALLY need feedback.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

George

I just got two of this one http://www.linear.com/product/LT...
Specs are excellent , and you can get it in DIP :-)

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ifryd,

Quote:

So the capacitor can be charged with many impulses but discharges should be of precise frequency (lower than charging impulses)and precise frequency can be achieved and regulated by precise adjusting power of the converter.

Huh??? I might add: "Ice cream has no bones." and this still makes almost no sense to my EE sensibilities.

Can you maybe post a diagram and a complete explanation of what you are trying to do? I think myself and the other above responders are simply guessing at what your end-goal is with this project. Based on the wording of the above quote, I fear you may have a mixture of science and fiction here. You may be running off on a fool's errand founded in false principles that will not get you to your desired result.