Page 1 of 1

Enabling PLL on 16Bit chips

Posted: Sat Sep 29, 2012 10:37 pm
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

Re: Enabling PLL on 16Bit chips

Posted: Sat Sep 29, 2012 11:17 pm
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

Re: Enabling PLL on 16Bit chips

Posted: Sat Sep 29, 2012 11:27 pm
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

Re: Enabling PLL on 16Bit chips

Posted: Sun Sep 30, 2012 12:13 am
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

Re: Enabling PLL on 16Bit chips

Posted: Sun Sep 30, 2012 12:55 am
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

Re: Enabling PLL on 16Bit chips

Posted: Sun Sep 30, 2012 10:54 am
by kersing
Martin,

After compiling your project importing the hex file into MPLAB gives:
error.jpg
error.jpg (27.14 KiB) Viewed 8836 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

Re: Enabling PLL on 16Bit chips

Posted: Sun Sep 30, 2012 1:01 pm
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 :)

Re: Enabling PLL on 16Bit chips

Posted: Sun Sep 30, 2012 1:12 pm
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!

Re: Enabling PLL on 16Bit chips

Posted: Mon Oct 01, 2012 10:24 am
by Benj
Hello,

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

Re: Enabling PLL on 16Bit chips

Posted: Mon Oct 01, 2012 10:56 pm
by medelec35
Thanks for update Ben,
But it does not appear to work.