View previous topic :: View next topic |
Author |
Message |
RenSeven
Joined: 28 Oct 2010 Posts: 5
|
Using external clock with PLL |
Posted: Wed Feb 16, 2011 12:53 am |
|
|
PIC24HJ32GP204, CCS v4.112
I have a 10mhz external clock, with PLL set to 8x, and need GPIO on OSC2. I cant figure out what fuses and such to set this up. Far as I can tell CCS has no EC with PLL option? The header file doesnt list EC_PLL8 or anything but plain EC as a fuse option.
From the uChip data sheet I need OSCIOFNC=0, FNOSCSEL=3 and FOSC=0, so F80006=3 and F80008=E0.
Specifying:
#FUSES OSCIO
#USE delay(external=10mhz,clock=80mhz)
I get FNOSCSEL=7 and FOSC=3 which is FRC mode. If I add:
#FUSES EC
I get FNOSCSEL=7 and FOSC=0 which is still FRC. If I try to use oscillator_setup(..) I get an error that the PLL isnt available.
The startup code doesnt not fix the oscillator on startup either, everything runs 8x too slow as the above would suggest.
If I patch the hex file to force the config bits everything works great! Except for the checksum being wrong and not being able to reproduce the code from source code 'n stuff. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Feb 16, 2011 12:58 am |
|
|
in cases like this you can specify #fuses none
and then use #rom to set the fuses yourself... I've done this in the past with broken fuses.
Then use #use delay with your clock rate and in your main, set up your oscillator if needed as the first thing you do.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
RenSeven
Joined: 28 Oct 2010 Posts: 5
|
|
Posted: Wed Feb 16, 2011 1:38 am |
|
|
Thanks Ben!
I'd like to not specify EVERY fuse, just the oscillator control. Does #ROM override #FUSES so I could be selective, without using the NONE? |
|
|
RenSeven
Joined: 28 Oct 2010 Posts: 5
|
|
Posted: Wed Feb 16, 2011 1:50 am |
|
|
...looks like they are OR'd together so I guess my answer is "no" or at least "not this time". Well, except 3/E3 is invalid or undocumented and seems to work like 3/E0 but I'm not that brave. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Feb 16, 2011 7:58 am |
|
|
RenSeven wrote: | Thanks Ben!
I'd like to not specify EVERY fuse, just the oscillator control. Does #ROM override #FUSES so I could be selective, without using the NONE? |
If you have #FUSES none, than NO fuse settings will be defined.
At that point, #rom usage should be absolute as long as you are careful not to declare anything afterwards that might attempt a fuse change. (IIRC)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|