Yes, and as I mentioned, I'm getting 2MHz out of OSC2. Since that is a /4 , the oscillator is in fact running 8. Only the PLL isn't working properly.
Yes, and as I mentioned, I'm getting 2MHz out of OSC2. Since that is a /4 , the oscillator is in fact running 8. Only the PLL isn't working properly.
Charles Linquist
I'm guessing here...the datasheet is a bit convoluted and jumps back and forth a bit...
2Mhz from OSC2 is right isn't it? OSC2 is FOsc/4, FOsc/4 is 8Mhz/4... System clock isn't FOsc in this case, it's the actual clock speed before the PLL...
Try that test program with
main:
High portb.0
pause 500
low portb.0
pause 500
goto main
.......just to see what happens. Should be one flash per second of course at 32Mhz. One flash every 4 seconds would certainly mean 8Mhz.
Also, I'm wondering if the bootloader is messing with your bits for you and shutting off your PLL!!!
Also, try putting the OSCCON statement before the OSCTUNE.
<br>Originally Posted by datasheet
DT
Yep I think DT just nailed it. Might be holding it off until it's in the right mode for the switch.
Confirmed -
Darrel, you were right again. Now that I switch to 8MHz BEFORE I enable the PLL, it
works as expected.
Thanks!
Charles Linquist
And one last "Gotcha" that I forgot to mention earlier - bits 0 and 1 of
OSCCON *MUST* be set to "00".
Even though you are running off the Internal Oscillator Block, if you
enable the PLL, you have to configure for PRIMARY OSCILLATOR.
Summary -
To run off the Internal oscillator and use the 4X PLL:
Set OSCCON bits 6 through 4 for either 8MHz (111) or 4MHz (110) and OSCCON
bits 1 and 0 for PRIMARY OSCILLATOR (00)
Set OSCTUNE.6 = 1 to enable the PLL.
In that order!
Charles Linquist
Bookmarks