Author Topic: PWM Frequecny  (Read 2929 times)

0 Members and 1 Guest are viewing this topic.

Offline slowaudio

  • Contributor
  • Posts: 22
PWM Frequecny
« on: May 09, 2014, 01:53:56 am »
Hi,

I'm trying to get a better understanding of how PWM frequency is determined. FWIW we're using an ST32F303VC processor...

So I have a 16-bit timer, that has PWM capabilities, in conjunction with an LPF that will be acting as a DAC. I'm trying to determine what frequency the PWM is running at for the LPF filter.

So in order to get the full 16-bits across the duty, that means that one period has to be divided into 2^16 divisions. If the timer is getting 72MHz clock, does that mean that the frequency of the PWM is 1.1k? (72*10^6/2^16). That seems awfully low...

Is any of this right, or am I way off???
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 14385
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: PWM Frequecny
« Reply #1 on: May 09, 2014, 02:07:51 am »
And now you know why DACs are things that exist. :)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Thomas

  • Regular Contributor
  • *
  • Posts: 81
  • Country: no
Re: PWM Frequecny
« Reply #2 on: May 09, 2014, 06:45:21 am »
Your calculations look good.

Sure you need 16-bit resolution?
Reducing resolution will increase the frequency, but you probably know that by now.

BTW, Timer 1 and 8 in the STM32F303 can work on CLK x2. That helps a little.
See the Reference Manual section 7.2.10.
 

Offline slowaudio

  • Contributor
  • Posts: 22
Re: PWM Frequecny
« Reply #3 on: May 09, 2014, 01:23:11 pm »
And now you know why DACs are things that exist. :)

Tim

Oh I know. Unfortunately the DAC has 12 bits of resolution and we really need some finer resolution, hence the 16 bits.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 14385
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: PWM Frequecny
« Reply #4 on: May 09, 2014, 01:28:17 pm »
What, you mean like onboard DAC?  What's the INL/DNL spec on that anyway?  I haven't seen embedded analog that was worth its salt (I admit I haven't looked at the STMs in detail).  For any real work, you use external devices.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PWM Frequecny
« Reply #5 on: May 09, 2014, 01:30:04 pm »
Quote
Unfortunately the DAC has 12 bits of resolution and we really need some finer resolution, hence the 16 bits.

Not that difficult to combine two 8-bit or 12-bit DACs into a 16/20/24 bit dac.
================================
https://dannyelectronics.wordpress.com/
 

Offline slowaudio

  • Contributor
  • Posts: 22
Re: PWM Frequecny
« Reply #6 on: May 09, 2014, 01:31:39 pm »
Your calculations look good.

Sure you need 16-bit resolution?
Reducing resolution will increase the frequency, but you probably know that by now.

BTW, Timer 1 and 8 in the STM32F303 can work on CLK x2. That helps a little.
See the Reference Manual section 7.2.10.

So I could possibly get away with 15-bits. Is there a way to only utilize 15-bits of the 16-bit register thus doubling the frequency response?

I could look into Timer 1 & 8. We have 4 PWM outputs, but in reality only two of those outputs to be higher definition.
 

Offline slowaudio

  • Contributor
  • Posts: 22
Re: PWM Frequecny
« Reply #7 on: May 09, 2014, 01:32:32 pm »
Quote
Unfortunately the DAC has 12 bits of resolution and we really need some finer resolution, hence the 16 bits.

Not that difficult to combine two 8-bit or 12-bit DACs into a 16/20/24 bit dac.

How exactly does one do that? I'm not familiar with that technique.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PWM Frequecny
« Reply #8 on: May 09, 2014, 01:34:44 pm »
Use a summing amplifier.

Linear AN86 utilized it. I implemented on using two PWM generators - posted somewhere here too.
================================
https://dannyelectronics.wordpress.com/
 

Offline slowaudio

  • Contributor
  • Posts: 22
Re: PWM Frequecny
« Reply #9 on: May 09, 2014, 01:36:13 pm »
What, you mean like onboard DAC?  What's the INL/DNL spec on that anyway?  I haven't seen embedded analog that was worth its salt (I admit I haven't looked at the STMs in detail).  For any real work, you use external devices.

Tim

This is for a senior design project, so in reality I would agree with you that outboard is superior. However given the time and budget constraints, we're looking to use on-chip solutions.
 

Offline slowaudio

  • Contributor
  • Posts: 22
Re: PWM Frequecny
« Reply #10 on: May 09, 2014, 01:39:47 pm »
Use a summing amplifier.

Linear AN86 utilized it. I implemented on using two PWM generators - posted somewhere here too.

Cool, thanks for the tip! That seems like it might be a great solution for us.

Any other general tips for using this technique?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: PWM Frequecny
« Reply #11 on: May 09, 2014, 02:18:43 pm »
1. I assume that you use it in an open loop environment. Stability in a wide-range closed loop environment is quite difficult;
2. The circuit / concept is deceptively simple, if you want to maintain monotonicity over the full range - pick your resistors carefully.
3. I assume that you are to use the pwm modules - do so via isr and utilize center-aligned isr so it is glitchless.
4) Think about if you need the two pwm modules to be synchronized.
5) think about your application and pick the lpf carefully.
6) leave some rooms and allow some resolution overlap: if your goal is a 16-bit dac, use two 12-pit pwm generators. This helps improve monotonicity and minimizes glitches.

Good luck.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf