REFOCON not outputting max system clock

REFOCON not outputting max system clock

Postby Keno » Sat Dec 19, 2020 2:20 pm

I am using PIC18F42K80. I am trying to output same clock frequency that is being produced for CPU, with REFOCON register ( RC3/REFO pin as output). I was successful until I tried outputting maximum clock frequency, at which this PIC can operate.

Internal oscillator (INTIO1 mode):
If I set internal oscillator to 16MHz and then multiply that by 4 with PLL, I should be getting 64MHz clock frequency at REFO pin, but I get no signal (checked with oscilloscope). I get signal at REFO pin only for frequencies as high as 32MHz.

External oscillator (EC3IO mode):
With external oscillator driving PIC at 64 MHz frequency (obviously, no PLL multiplication is used), I also get nothing at REFO pin (no division used within REFOCON), but get signal, if I set division of frequency at REFOCON register by 2 (or lower) - that is (again) maximum of 32 MHz clock frequency signal.

According to my speculations, I would guess there is some unknown limitation within PIC itself, rather than software based error, since clock signal is reproduced for all clock frequencies below (including) 32 MHz clock signal. Here's code for INTIO1 mode (header file included):

Code: Select all
    // OSCILLATOR CONFIGURATION
   
    OSCCONbits.IRCF = 0b111 ;   // internal oscillator set to 16 MHz
    OSCCONbits.SCS = 0b00;      // primary oscillator clock is selected
    OSCTUNEbits.PLLEN = 1;      // PLL enabled
   
    while(OSCCONbits.HFIOFS != 1);  // wait until oscillator frequency is stable
   
    // REFERENCE OSCILLATOR AT RC3
   
    REFOCONbits.ROSEL = 0;      // system clock used as base clock of reference oscillator at RC3
    REFOCONbits.RODIV = 0b0000; // base clock value (not divided)
    REFOCONbits.ROON = 1;       // reference oscillator enabled
Attachments
header.h
(3.24 KiB) Downloaded 21 times
Keno
 
Posts: 9
Joined: Sat Nov 07, 2020 10:15 am
PIC experience: EE Student

Return to Oscillator

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest