CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Using external clock with PLL

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RenSeven



Joined: 28 Oct 2010
Posts: 5

View user's profile Send private message

Using external clock with PLL
PostPosted: Wed Feb 16, 2011 12:53 am     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 12:58 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 1:38 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 1:50 am     Reply with quote

...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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Feb 16, 2011 7:58 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group