Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

18f Intrc + PLL

Status
Not open for further replies.

justDIY

Active Member
I'm having a heck of a time getting the PLL to engage on my 18F2620.

Config fuses:
FOSC3:FOSC0 set to 1000 (int rc, io on ra7:6)

Registers:
PLLEN (OSCTUNE:6) = 1
IRCF2:IRCF0 (OSCCON6:4) = 111

according to the datasheet, that is all I need to set. yet when I flash the chip, the program runs very slowly, in fact, it runs at 1/4 speed, which means the chip is still running at 8mhz, even though I have all my timing routines calculated for 8*4 = 32

i'm using Proton PDS (proton basic)

any suggestions?

2.6.4 PLL IN INTOSC MODES
The 4x frequency multiplier can be used with the internal oscillator block to produce faster device clock speeds than are normally possible with an internal oscillator. When enabled, the PLL produces a clock speed of up to 32 MHz.

Unlike HSPLL mode, the PLL is controlled through software. The control bit, PLLEN (OSCTUNE<6>), is used to enable or disable its operation.

The PLL is available when the device is configured to use the internal oscillator block as its primary clock source (FOSC3:FOSC0 = 1001 or 1000). Additionally, the PLL will only function when the selected output frequency is either 4 MHz or 8 MHz (OSCCON<6:4> = 111 or 110). If both of these conditions are not met, the PLL is disabled.

The PLLEN control bit is only functional in those internal oscillator modes where the PLL is available. In all other modes, it is forced to ‘0’ and is effectively unavailable.
 

justDIY

Active Member
i seem to have solved this one, more or less by random chance. in messing with the code, I ended up having PLLEN set several instructions after OSCCON was set. In reading the datasheet, it seems to fit, that the pic does some sort of sanity checking on the PLLEN bit, and perhaps setting OSCCON and PLLEN right next to each other doesn't work. However, with a few other instructions in between setting OSCCON and PLLEN works!
 
Status
Not open for further replies.
Top