Clock Speed Switch Delay
pjv
Posts: 1,903
Hello Chip;
I'm trying to understand something about switching clock speeds, and I need some help.
My understanding of the Propeller is that it is a "static" device, and can run at any clock speed from DC to maximum, currently around 80 or 90 MHz. In the normal "PLL" mode, the basic crystal oscillator is always cranked up by a constant 16X, and any slower "PLL" value is then a binary tap-down from there.
What I don't understand then, is the need for the approximate 75 uSec delay in making a speed change. I could understand it if in fact the PLL loop changed a divider and needed to recover from a step change, but the divider is after the PLL loop, and hence there is no change to that when selecting a different speed. And since the Propeller is "DC" capable, speedwise, why is this delay necessary?
Am I misunderstanding this?
It would be a great benefit to those of us who wish the unit to mostly run at slow speeds with bursts of high speed to not have this delay. At high speeds the 75-ish microseconds alone is enough to get some tasks completed, permitting a switch back to low speed.
Any chance of improving this in a next rev of silicon?
Thanks for listening,
Cheers,
Peter (pjv)
·
I'm trying to understand something about switching clock speeds, and I need some help.
My understanding of the Propeller is that it is a "static" device, and can run at any clock speed from DC to maximum, currently around 80 or 90 MHz. In the normal "PLL" mode, the basic crystal oscillator is always cranked up by a constant 16X, and any slower "PLL" value is then a binary tap-down from there.
What I don't understand then, is the need for the approximate 75 uSec delay in making a speed change. I could understand it if in fact the PLL loop changed a divider and needed to recover from a step change, but the divider is after the PLL loop, and hence there is no change to that when selecting a different speed. And since the Propeller is "DC" capable, speedwise, why is this delay necessary?
Am I misunderstanding this?
It would be a great benefit to those of us who wish the unit to mostly run at slow speeds with bursts of high speed to not have this delay. At high speeds the 75-ish microseconds alone is enough to get some tasks completed, permitting a switch back to low speed.
Any chance of improving this in a next rev of silicon?
Thanks for listening,
Cheers,
Peter (pjv)
·
Comments
The Propeller manual suggests (in the section introducing the CLK register) that the crystal be allowed 10 milliseconds from activation (oscena bit), before switching over to it as it as the master clock source. And once the xtal is up to speed, the PLL can be enabled (pllena bit) and an additional 100 microseconds should be allowed for it to lock. Since the PLL is supposed to operate between 64 and 128 megahertz, there might be a strange output waveform if it is driven by a lower frequency while the crystal gets up to speed. My guess is that it would just be erratic, but not fatal.
The following is a snippet of code I've been using to step up through clock settings. This switches from the 20khz oscillator to the much faster RCfast=12mhz oscillator, and then enables the crystal, while still running from RCfast, then after a delay swiches over to operation from the xtal at 5mhz, then enables and steps through several PLL settings. I didn't put the required delay of 100 microseconds after turning on the PLL. But nothing bad happened. The next time I have this hooked up, I'll look at how long the PLL is taking to lock.
The switch from RCslow to RCfast is lightning fast for those quick response but lowest current situations.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
My tests have all been in assembler, and in making the switch from 80 Mhz with PLLX16 to 40 Mhz with PLLX8, which I believe to be a divide-by-two of the same crystal setting and PLLX16, there is simply a pause in execution of approximately 75 uSec.
And since neither the crystal nor the actual PLL is altered, I don't understand the need for the delay...... there is nothing to be stabilized.
Cheers,
Peter (pjv)
Chip Gracey
Parallax, Inc.
Thanks for the clarification, and I look forward to the next rev......... lots of new goodies and improvements in store, I'm sure!
Cheers,
Peter (pjv)
How about the other delays that are suggested in the manual? For example, is there any danger of a clock glitch if we switch directly from RCslow to xtal+pll16, without first going through the software delays of 10 milliseconds for oscena + 100 microseconds for pllena? Not that I really need to do that, but is it a gotcha?
-- Tracy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I was giving this section some more thought:
In the PLL mode, the binary taps behind the 16X crank-up are likely a muxed selector into a simple counter chain. If that chain is made from synchronous dividers, and a speed change is implemented with an instruction driven from that chain, would that not imply that it is impossible to get a glitch?
I can understand the issue·if the PLL loop·were thrown out of sync, and had to recapture the control point, but in the case of selecting a different tap in a divider chain, not so.
When you have time (I'm sure you're run off your feet just now), could you add some more insight here for us?
Cheers,
Peter (pjv)
·
I·knew you were going to bring this up!
No, even if it was made from a synchronous counter it would glitch, because if you go from a high-speed tap to a slow-speed tap, you have no assurance that the new slower tap will be in a known state. Going from slow to fast is another story because when the slow tap toggles, you know that all faster taps just went from low to high. As it is implemented, the taps are a cascade of flipflops with·each Q-not tied back to both·D and the next-slower tap's clock input. You can see this is totally chaotic, as it forms a ripple counter. This takes the lowest power, though. Since we have three loosely- or un-related clock sources that we need to switch among, I thought a simple, singular solution would be best. I was very cautious/conservative with the approach we took on this clock switching because I knew that a screw-up here could undermine the whole design. Yes, what we have is slow (average 75us), but it's rock-solid. I will see about improving this in the next chip, perhaps by using the fast RC clock.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
When the crystal oscillator is first enabled, it sputters around the threshold voltage, creating sporadic and unusably small clock cycles. Once the crystal's energy level builds up, it's oscillating voltage becomes big enough that it is crossing quickly over and under the threshold and there are no possibilities of these glitches. This takes ~5ms, but 10ms is a conservative allowance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
The fact that you have a (non-synchronous) ripple counter explains the possibility of unpredictably short clock glitches.
However, in the case of a synchronous counter, I still don't believe it, as any the edges occur at the same instant. The fact that the Propeller can handle the fastest normal clock assures that it can also handle the shortest possible synchronous "glitch" pulse.
I'm not looking to pick a fight as I'm sure I would not win that one, and since the architecture is a ripple counter, the point becomes moot.
Maybe next rev!
Cheers,
Peter (pjv)
If the fast RC gets used instead of the slow RC, the transition time will become 83ns - 166ns. That will be way better and that is probably how this will get improved.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Post Edited (Chip Gracey) : 5/2/2006 7:16:17 PM GMT
Again, only valid for synchronous counters........ it is the very clock(s) that timed the instruction to change the speed to begin with, hence it is synchronized to the clock, and the places where edges can occur are totally deterministic, and hence can be properly allowed for.
I realize that using RCFast in a future rev will be a good improvement, abeit not deterministic relative to the crystal based oscillator. It's the determinism that I love so much..... it allows me to do unusual things, and still have it all predictable.
Cheers,
Peter (pjv)
I think what might be really good is to just have a programmable divider on the PLL and then always use the same output. This would never glitch.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
I'm all for that!
Cheers,
Peter (pjv)