Help! I've slowed down and I can't speed up! (SOLVED)
mpark
Posts: 1,305
I'm trying to use clkset to switch my Propeller between rcslow and xtal1+pll16x. This is what I have so far:
If I uncomment those three commented-out lines, I expect the clock to rev up to 80MHz after 3 seconds, but it doesn't. I see current consumption jump slightly after 3 seconds (from 3.8mA to 4.8mA) but the LED remains off.
What is the correct procedure to switch from rcslow to xtal1+pll16x?
_clkmode = xtal1+pll16x _clkfreq = 80_000_000 pub main | t dira[16]~~ repeat clkset(%000_00_001, 20_000) ' rcslow outa[16]~ waitcnt(clkfreq * 3 + cnt) 'clkset(%011_01_001, 20_000) 'waitcnt(clkfreq / 100 + cnt) 'clkset(%011_01_111, 80_000_000) outa[16]~~ t := cnt repeat until cnt - t => clkfreq * 3This sets the clock to rcslow and the LED toggles on/off every 3 seconds. So far, so good.
If I uncomment those three commented-out lines, I expect the clock to rev up to 80MHz after 3 seconds, but it doesn't. I see current consumption jump slightly after 3 seconds (from 3.8mA to 4.8mA) but the LED remains off.
What is the correct procedure to switch from rcslow to xtal1+pll16x?
Comments
-Phil
In general, it is safe to switch between clock modes by using a single CLKSET command, however, if enabling the Crystal Oscillator circuit (CLK register’s OSCENA bit) it is important to perform the clock mode switch as a three-stage process:
1) First set the CLK register’s PLLENA, OSCENA, OSCM1 and OSCM0 bits as necessary. See CLK Register on page 28 for more information.
2) Wait for 10 ms to give the external crystal time to stabilize.
3) Set the CLK register’s CLKSELx bits as necessary to switch the System Clock to the new source.
The above process is only necessary when switching the Crystal Oscillator circuit on. No other clock mode changes require this process if the Crystal Oscillator circuit is left in its current state, either off or on. See the Clock object in the Propeller Library for clock modification and timing methods.
But it looks like you're doing that. Can you verify that you can run at 80MHz out of the gate? IOW is your crystal circuit operational?
-Phil
-Phil
I don't suppose there's any way to get that 3.8 mA even lower though, is there?
But what board are you using? Are you measuring the current draw of the Propeller chip alone?
Meanwhile, I tried to duplicate my Spin program in SimpleIDE, but strangely I had to divide CLKFREQ by 25 instead of 50: Same board, but dividing by 50 had the same problem as my first post.
Wondering if anyone has some insight as to why Spin and C differ here.
Mike
-Phil
But if Phil has a different theory, I'd love to hear it!
In retrospect, that seems reasonable.
-Phil