Page 1 of 1

Speed not correct [solved]

Posted: Fri Feb 02, 2018 2:21 pm
by MarkW
Hi

I have a 18F46K22...Flowcode7 V7.2.1.4

I wish to run at 64mhz PLL, and have set all the parameters
correctly, config setup / compiler speed / osccon / osctune
with 1sec led test....it flashes led at 4 sec intervals which
tells me the compiler setting is correct but the other settings also
look correct
Not sure now what is the problem??

Attached file for help pls

thanks
Mark

Re: Speed not correct

Posted: Fri Feb 02, 2018 2:47 pm
by Benj
Hi Mark,

In your configuration settings try enabling either the Fail-Safe Clock Monitor or the Internal/External Oscillator Switchover or both. I think when I've had PLL issues in the past one of these settings allowed the PLL to fire up and start working.

Re: Speed not correct

Posted: Fri Feb 02, 2018 3:56 pm
by MarkW
Hi Ben,

I tried all 3....no luck, i am sure all the control registers
are set correct as well :(

Re: Speed not correct

Posted: Sun Feb 04, 2018 7:53 pm
by Kenrix2
Does this work?

Code: Select all

OSCCON=0b01110000;

Re: Speed not correct

Posted: Sun Feb 04, 2018 8:03 pm
by MarkW
Hi Ben

I found the problem :)

Once PLL is enabled config and osctune, the osccon (bit 0/1) must be set
to both 0 (primary clock set as source)....its counter intuitive but correct
because when PLL is enabled it takes internal osc first into the PLL block
and then outputs as the primary source
Page 26 of the datasheet shows this.....
So for others that have this issue, there is the solution

Thanks

Mark