Enabling PLL on 16Bit chips

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Enabling PLL on 16Bit chips

Post by medelec35 »

My target device is PIC24FJ256GA106, but I believe this would apply to and PIC24F series.

I'm struggling to enable PLL on target device so internal oscillator is running at 32MH
8MHz internal osc x 4 via PLL

I have eblock with:

Code: Select all

OSCCONbits.NOSC = 0b111;
CLKDIVbits.RCDIV = 0b000;
Maybe I need to used command to unlock first?

Can only get hardware to run at 8MHz

Flowcode = V4.4.13.69

Maybe I need to used command to unlock first?

Not as familiar with 16 bit as I am with 8bit, so I'm assuming it's me rather than a bug

If anyone can help It would be really grateful.

Thank you

Martin
Attachments
Trying to run at 32MHz int osc.fcf_pic16
(4.5 KiB) Downloaded 335 times
Martin

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by kersing »

Martin,

Are you not looking for the "001 = Fast RC Oscillator with Postscaler and PLL module (FRCPLL)" mode for NOSC?

Best regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by medelec35 »

Hi Jac,
Thanks for your reply.
I have tried
OSCCONbits.NOSC = 0b001;

but still the same
Internal osc still running at 8MHz.


Martin
Martin

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by Enamul »

Hi Martin,
It's great chance for me if I could help you. I am always taking help from your posts. Although my version is demo and I can't see the config setting of the PIC you mentioned..But I have had a look in datasheet..
It seems to me..Jac is right..

Code: Select all

OSCCONbits.NOSC = 0b001;
CLKDIVbits.RCDIV = 0b000;
I have also noticed your post that still it doesn't work. Still I am posting the screen shot..to have your attention.
config.png
(21.93 KiB) Downloaded 4640 times
So, what I am trying to say the above code should be ok..in conjuction with POSCMD<1:0> set to 11 which can be set by config..although I can't see bcz of version :(
According to the...
The Primary Oscillator Configuration bits, POSCMD<1:0> (Configuration Word 2<1:0>), and the Initial Oscillator Select Configuration bits, FNOSC<2:0> (Configuration Word 2<10:8>), select the oscillator source that is used at a Power-on Reset. The FRC Primary Oscillator with Postscaler (FRCDIV) is the default (unprogrammed) selection. The Secondary Oscillator, or one of the internal oscillators, may be chosen by programming these bit locations
Enamul
University of Nottingham
enamul4mm@gmail.com

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by medelec35 »

Enamul wrote:Hi Martin,
It's great chance for me if I could help you. I am always taking help from your posts.
Thanks Enamul, It's appreciated.
Enamul wrote: It seems to me..Jac is right..

Code: Select all

OSCCONbits.NOSC = 0b001;
CLKDIVbits.RCDIV = 0b000;
Yes I agree with that one after re-looking at the data sheet.
Enamul wrote: So, what I am trying to say the above code should be ok..in conjuction with POSCMD<1:0> set to 11 which can be set by config.
Yes I did set Oscillator for Fast RC Oscillator with PLL Module (FRCPLL).
So POSCMD<1:0> should automatically be set to 0b11

That's the trouble with more control, it makes setting up much more complicated

Martin
Martin

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by kersing »

Martin,

After compiling your project importing the hex file into MPLAB gives:
error.jpg
error.jpg (27.14 KiB) Viewed 7657 times
A sure indication something is wrong. So time to investigate some more...

When changing oscillator settings in FC chip configuration the value of LASTWORDMINUSONE changes. According to the data sheet this means LASTWORDMINUSONE equals CONFIG2 as CONFIG2 has the bits for the oscillator settings.
Checking the chip configuration in MPLAB shows the LASTWORDMINUSONE value set by FC at address 0x2abfa. That is CONFIG3 according to data sheet.

Looking at the other configuration settings it seems all of them are mixed up.

Regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by medelec35 »

Problem solved!

Thanks kersing.
I should of loaded hex file in MPLAB or my progrmmer but I assumed ppp is settings correct config but I was wrong.

So I believe it's a PPP issue??

For example I have the hex file that's preloaded in the demo board.
Loaded it into MPLAP lab, PICkit3 programmer, ASIX programmer and PPP

The configuration settings all match except for ppp.
For example in all except ppp:
Watchdog timer disabled
Fast RC Oscillator With Postscaler and PLL module

In ppp:
Watchdog timer enabled
Fast RC Oscillator With Postscaler (no mention of PLL module)

As a workaround
I have removed configuration settings from flowchart, loaded flowchart in MPLAB, then set configuration settings and exported hex file.

Now I have internal oscillator working at 32MHz :)
Attachments
Trying to run at 32MHz int config set in mplab.hex
(940.61 KiB) Downloaded 287 times
Martin

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by kersing »

You are welcome.

It certainly looks like a PPP issue to me. Hopefully someone at MM will be able to solve this and release a fix as your current work flow works but is cumbersome.

Good luck with your project!
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

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: Enabling PLL on 16Bit chips

Post by Benj »

Hello,

I think I have found and fixed the issue in the attached file.
ppp_config_data5.cfg
(514.72 KiB) Downloaded 293 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Enabling PLL on 16Bit chips

Post by medelec35 »

Thanks for update Ben,
But it does not appear to work.
Martin

Post Reply