Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PWM frequency resolution problem

Status
Not open for further replies.

yokel

Junior Member level 3
Joined
Nov 13, 2008
Messages
30
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,529
Hi,
I am using dsPIC33J256GP710 for PWM generation. As this device doesn't support any built-in PWM functionality, I am using the output compare PWM mode in this regard.

I am operating the mcu at it's highest speed which is 40MHz. Now I need to generate PWM with variable frequency from 600KHz to 700KHz. But the problem is with the equation PWM Period=(PRy+1)*Fcy I can't get all the frequencies in this range, eg. I can't generate exactly 620KHz if I want. With each increament in PRy value (timer period) the frequency changes by 15-8 KHz.

Please tell me how can I generate any frequency within this range with this speed.

thanks a lot in advance
 

That is a problem with micro PWMs. You may be able to do better if you use a timer to interrupt the processor and toggle bits in the interrupt routine but you will still be quite limited. Otherwise you need a hardware solution e.g. an FPGA.

Keith.
 

HI

As our dear keith say's it is a problem with most micro of this type

I can offer 2 more practical solution's

1) change micro to TI TMS320F28xx who have a high res PWM engine

2) Use a dds algorithm (probably will not work with low speed micro) to produce the desired frequency

All the best

Bobi


The microcontroller specialist
 

assuming a cpu speed of 10Mhz, and a 16bit timer for pwm. your minimum pwm resolution should be 10Mhz/64K=150hz.

you can further smooth that with the use of scalers.

it is true that you may not be able to generate exactly all frequencies of your desire but that's the price you pa with digital - they are discrete.
 

Without using a PLL or a fractional algorithm, the output frequency can't be generated in a different way than dividing down 40 MHz fcy by an integer factor. Obviously, you need a different hardware to generate a continously variable frequency. As the dsPIC33 timers can be used as frequency dividers for an external input as well, an additional 4046 PLL should be sufficient to generate the intended frequencies.
 

millwood said:
assuming a cpu speed of 10Mhz, and a 16bit timer for pwm. your minimum pwm resolution should be 10Mhz/64K=150hz.

That isn't the resolution - it is the lowest frequency you could generate with a 10MHz clock and 16 bit counter. The resolution is 100ns - the period of the clock. As it is required to generate around 600kHz, the counter would need to be set to 16 or 17 giving a frequency of 625kHz or 588kHz - rather large steps. Even with an 80MHz clock the steps would be quite large.

Keith
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top