Speed not correct [solved]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Speed not correct [solved]

Post 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
Attachments
FC7_TEST_64MHZ_18F46K22.fcfx
(10.42 KiB) Downloaded 195 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Speed not correct

Post 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.

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: Speed not correct

Post by MarkW »

Hi Ben,

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

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: Speed not correct

Post by Kenrix2 »

Does this work?

Code: Select all

OSCCON=0b01110000;

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: Speed not correct

Post 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

Post Reply