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 CCS Technical Support

Oscillator fuses for PIC24H device

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



Joined: 19 Sep 2003
Posts: 8

View user's profile Send private message Send e-mail

Oscillator fuses for PIC24H device
PostPosted: Wed Mar 05, 2014 5:32 am     Reply with quote

I have just changed from using a 18F device to a 24H device, most of the code works but I do find the fuses for the oscillator very confusing!
from the header file I lots of options
FRC,FRC_PLL,PR,PR_PLL,SOSC,LPRC,FRC_DIV_BY_16,FRC_PS,NOIESO,IESO,EC,XT,HS,NOPR, OSCIO,NOOSCIO
but I find it difficult to map these to the configurations in the data sheet.
Am I missing something is there a document somewhere that could help or do I need just to try them and then look at the code and reverse engineer what they mean?
I guess the problem is using a compiler that is compatable with such a large range of devices, but it is good to be able to move code between devices.
thanks
mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19569

View user's profile Send private message

PostPosted: Wed Mar 05, 2014 5:46 am     Reply with quote

In the compiler directory.
Fuses.txt.

Gives the CCS names, and what they are....

Best Wishes
mbarrett



Joined: 19 Sep 2003
Posts: 8

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 05, 2014 5:57 am     Reply with quote

Ttelmah wrote:
In the compiler directory.
Fuses.txt.

Gives the CCS names, and what they are....

Best Wishes


Thankyou!
did not know that file was there.

cheers
mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19569

View user's profile Send private message

PostPosted: Wed Mar 05, 2014 6:47 am     Reply with quote

Yes, it's worth always 'looking', since there is also a 'readme' with details of recent compiler changes as well. Smile
jeremiah



Joined: 20 Jul 2010
Posts: 1358

View user's profile Send private message

PostPosted: Wed Mar 05, 2014 9:50 am     Reply with quote

Most PIC24 chips use 2 different fuses to setup your system clock. The first fuse specifies what type of external circuit your chip is connecting to:
EC - External Oscillator Chip
XT - Medium speed crystal
HS - High speed crystal
NOPR - No external primary clock (I.E. using an internal clock)

The second fuse tells the internal system clock mux where the system clock should be routed from. Options for this fuse can vary a lot from chip to chip. Here are some common options:
PR - Primary external clock (previous fuse tells what type)
PR_PLL - Primary external clock + PLL
FRC - Internal Fast RC circuit
FRC_PLL - Internal Fast RC + PLL
SOSC - Secondary external oscillator
LPRC - Internal low power RC circuit

There are other fuses that provide settings for your clocks and their pins:
IESO, NOIESO handle internal to external switching mode
OSCIO, NOOSCIO handle turning external oscillator pins to digital (or not)
SOSC_DIGITAL, SOSC_ANALOG, NOSOSC handle turning secondary oscillator pins to digital (or analog or neither)

There can various others. The big thing is to figure out where you want your clock to come from. If it is internal, set NOPR for the first fuse, and then select the mux setting for which internal you want. If you are using an external chip, use EC with the mux fuse set to PR or PR_PLL. If you are using an external crystal, then use the data sheet to figure out if it is XT or HS and then set the mux fuse for PR or PR_PLL.

NOTE: that some of these fuse names also can change from chip to chip on the older compiler revs.


Last edited by jeremiah on Wed Mar 05, 2014 11:04 am; edited 1 time in total
temtronic



Joined: 01 Jul 2010
Posts: 9255
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 05, 2014 10:49 am     Reply with quote

Seems the newer PICs have more fuse settings than instructions !
When I've got a 'set of fuses' that does work, I save it as a file.
Something like '46k22_projectname.fuz', then #include it at the beginning of the programs.
It gives me a known, WORKING set of fuses for all projects with that PIC, saves me a lot of retyping, as I'm not a good typist (half dead finger), and save visual space in 'main' as a whole page of fuses is now in one line!
To me the less clutter on the screen is important.

hth
jay
newguy



Joined: 24 Jun 2004
Posts: 1911

View user's profile Send private message

PostPosted: Wed Mar 05, 2014 12:42 pm     Reply with quote

Depending on the crystal you choose you might also run into issues with the processor's oscillator not starting upon power up. I bought the CCS DSP Analog Development Kit some time ago and just getting it to run was the most frustrating thing I've ever done. Long story short, CCS built the board with a crystal that the processor isn't capable of starting from upon power up. I had to "boot" with the internal oscillator, then immediately do an internal-to-external oscillator switchover.

Details can be found here: http://www.ccsinfo.com/forum/viewtopic.php?p=159723&highlight=crystal#159723
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