Speed not correct [solved]

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

Moderator: Benj

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]

Postby MarkW » Fri Feb 02, 2018 2:21 pm

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 45 times

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

Re: Speed not correct

Postby Benj » Fri Feb 02, 2018 2:47 pm

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

Postby MarkW » Fri Feb 02, 2018 3:56 pm

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

Postby Kenrix2 » Sun Feb 04, 2018 7:53 pm

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

Postby MarkW » Sun Feb 04, 2018 8:03 pm

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
These users thanked the author MarkW for the post (total 2):
medelec35 (Mon Feb 05, 2018 8:51 am) • Benj (Mon Feb 05, 2018 11:05 am)
Rating: 10%