Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
Oscillator and PLL stuff - (SOLVED) |
Posted: Tue Apr 14, 2015 9:12 pm |
|
|
Nevermind - i figured it out... sorry for this... new PIC's have too many options.
Hi Guys, its been a while.
I can't figure out what bit I'm missing to get this thing to run at 48MHz.
I've been looking a the datasheet, and oscillator diagrams and concluded my problem is that although the PLL is enabled and the right prescaler is selected the PLL is being bypassed and I'm just running at 16MHZ as confirmed by O-Scope.
I suspect the problem to be the switch shown on Page 36 of the datasheet controlled by PLLEN and CFGPLLEN.... since I'm getting exactly 48/3=16Mhz or in other words, the raw oscillator frequency
Code: |
#include <18F47J53.h>
#fuses NOWDT,NODSWDT
#fuses NOXINST
#fuses NODEBUG
#fuses NOPROTECT
#fuses HSPLL,PLLEN,NOIESO
#fuses PLL4 //set usb pll clock to 4MHz (from 16Mhz input)
#fuses NOCPUDIV //set cpu clock to 48MHz
#use delay(clock=48MHz)
#byte OSCTUNE = 0XF9B
void main()
{
setup_oscillator(OSC_PLL_ON); <--------- This was wrong.
delay_ms(50);
while(1)
{
output_high(PIN_C2);
delay_ms(10);
output_low(PIN_C2);
delay_ms(10);
}
}
|
LST File:
Configuration Fuses:
Word 1: F708 NOWDT PLL4 PLLEN NOSTVREN NOXINST DEBUG NOCPUDIV NOPROTECT
Word 2: FF75 HSPLL SOSC_DIG CLOCKOUT FCMEN NOIESO WDT32768
Word 3: FBF7 DSWDTOSC_INT RTCOSC_T1 DSBOR NODSWDT DSWDT2147483648 IOL1WAY ADC10 MSSPMSK7
Word 4: FBFF WPFP NOWPCFG WPDIS WPEND LS48MHZ
Thanks!
G. _________________ CCS PCM 5.078 & CCS PCH 5.093 |
|