PWM Frequecny - Page 1
Forum section: electronics / general

author: slowaudio
author_rank: Contributor
timestamp: May 09, 2014, 01:53:56 am
content: 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???

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 09, 2014, 02:07:51 am
content: And now you know why DACs are things that exist.Tim

author: Thomas
author_rank: Regular Contributor
timestamp: May 09, 2014, 06:45:21 am
content: 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.

author: slowaudio
author_rank: Contributor
timestamp: May 09, 2014, 01:23:11 pm
content: Quote from: T3sl4co1l on May 09, 2014, 02:07:51 amOh I know. Unfortunately the DAC has 12 bits of resolution and we really need some finer resolution, hence the 16 bits.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 09, 2014, 01:28:17 pm
content: 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

author: dannyf
author_rank: Super Contributor
timestamp: May 09, 2014, 01:30:04 pm
content: QuoteNot that difficult to combine two 8-bit or 12-bit DACs into a 16/20/24 bit dac.

author: slowaudio
author_rank: Contributor
timestamp: May 09, 2014, 01:31:39 pm
content: Quote from: Thomas on May 09, 2014, 06:45:21 amSo 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.

author: slowaudio
author_rank: Contributor
timestamp: May 09, 2014, 01:32:32 pm
content: Quote from: dannyf on May 09, 2014, 01:30:04 pmHow exactly does one do that? I'm not familiar with that technique.

author: dannyf
author_rank: Super Contributor
timestamp: May 09, 2014, 01:34:44 pm
content: Use a summing amplifier.Linear AN86 utilized it. I implemented on using two PWM generators - posted somewhere here too.

author: slowaudio
author_rank: Contributor
timestamp: May 09, 2014, 01:36:13 pm
content: Quote from: T3sl4co1l on May 09, 2014, 01:28:17 pmThis 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.

author: slowaudio
author_rank: Contributor
timestamp: May 09, 2014, 01:39:47 pm
content: Quote from: dannyf on May 09, 2014, 01:34:44 pmCool, thanks for the tip! That seems like it might be a great solution for us.Any other general tips for using this technique?

author: dannyf
author_rank: Super Contributor
timestamp: May 09, 2014, 02:18:43 pm
content: 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.