cancel
Showing results for 
Search instead for 
Did you mean: 

Derive an exact timer rate from PLL

e d
Associate II
Posted on May 30, 2017 at 20:46

Hello,

I am working with the STM32L486 chipset and we need to generate an exact 38400Hz timer. Currently we have a 5MHz or 25MHz external clock coming in but the PLL clock tree does not seem to favor getting the exact 38400Hz rate for a timer. Is it possible with the above external clock rates? or if not, any suggestions to get this, including a different rate for external clock source?

Thanks,

ED

Note: this post was migrated and contained many threaded conversations, some content may be missing.
15 REPLIES 15
Posted on July 10, 2017 at 20:56

> there's not really a 'multiplier'

Clive, I know how a PLL works; it's just that the detals don't really matter for the purpose of this discussion (or for calculation the final freq).

The DS calls that signal 'PLL input clock'.

Is that 'fitter' of yours brute-forcing all the combinations?

JW

Posted on July 10, 2017 at 21:25

Thanks guys for this great exercise on the RCC module. I am getting a hang of it now. A few other related questions: What settings above from Clive One's fitter would be best for power consumption? Also, generally does turning on the PLL to manipulate the system clock cost anything as far as power? How significant (power consumption) is it?

Clive One: Is this 'fitter' your own program or if not, where can I get it? 

Posted on July 10, 2017 at 21:48

>>

Is that 'fitter' of yours brute-forcing all the combinations?

Well it doesn't visit all combinations as some paths are eliminated, but it scopes the various intermediate frequencies against the specification in the DS. I do think the values for PLL_N are unduly scoped.

>>

Clive, I know how a PLL works;

Fair enough, a lot of people don't, and assume multiplier means something other than a simple divider circuit, I'm trying to paint a different picture in their heads.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 10, 2017 at 22:04

It's one of those five minute apps I write to select gear ratios based on the rules and values the manuals suggest are available. One could arguably do the math when setting PLL rather than using hard coded values, which could make dynamically tuning the power usage easier. ie something you drove from the console rather than rebuilding the code for each test. It would make finding the sweet spot for the application easier, don't be afraid of going faster for a briefer amount of time if the power consumption envelope actually gets smaller rather than running continuously at a slower speed.

I haven't done the profiling work, but I'd expect you'd want to constrain the VCO frequency, so keeping PLL_P as low as possible for the target frequency. Depending on other taps and limited dividers you might want a higher VCO frequency to run other things. It's an asymmetrical pulse generator, which is why you need the DIV2 to get a 50/50 duty.

I would generally pick an HSE frequency that would be my nominal (slower) operating speed, and then switch to that and turn off the PLL. Now in profiling you might want to just disconnect the PLL from downstream logic to see how much that saves, and then look at what just the PLL/VCO contribute. And look at how much time is burned locking the PLL.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 10, 2017 at 23:00

Might be pushing it but would you mind sharing the pseudo code of your app? It would be a great tool to double check as one digs further into the manuals.

Anyway, I truly appreciate your pointers as I am still in the formative phase of my project.

Posted on July 12, 2017 at 23:49

>>

I would generally pick an HSE frequency that would be my nominal (slower) operating speed, and then switch to that and turn off the PLL.

What would be a good strategy to turn on/off the PLL on the fly to save power? In my case I would just run the HSE without PLL the majority of time (low power). But in booster mode I would like to turn on the PLL and jack up the clock to run more heavy processing stuff (on demand/on the fly). I might need to switch around the clock sources and be mindful of the wait states but what are the other pitfalls?

By the way,

Turvey.Clive.002

should be on ST payroll or I won't feel comfortable using/recommending ST products, period!