View previous topic :: View next topic |
Author |
Message |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
PIC24HJ Fuse question Internal OSC |
Posted: Fri Mar 26, 2010 7:07 pm |
|
|
Hi All,
Been slowly ripping my hair out trying to get the internal oscillator to function at full speed rather than the basic 7.37Mhz.
Does anyone have an example of fuses for the 24HJ series MCU
This is what I have been using:
Code: | #include<24HJ128GP502.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS //No boot segment
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES FRC_PLL //Internal Fast RC Oscillator with PLL Enabled
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES OSCIO //OSC2 is general purpose output
#FUSES NOPR //Pimary oscillaotr disabled
#FUSES NOWINDIS //Watch Dog Timer in Window mode
#FUSES WPRES128 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS16 //Watch Dog Timer PostScalar 1:32768
#FUSES PUT128 //Power On Reset Timer value 128ms
#FUSES IOL1WAY //Allows only one reconfiguration of peripheral pins
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NORSS //No secure segment RAM
#FUSES NOSSS //No secure segment
#FUSES NOWRTSS //Secure segment not write protected
#FUSES NORBS //No Boot RAM defined
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
#FUSES NOJTAG //JTAG disabled
#FUSES ICSP3 //ICD uses PGC3/PGD3 pins
#FUSES NOALTI2C //I2C mapped to alternate pins |
#use delay(internal=7370000), I was expecting that changing this value to 73,700,000 would take care of the PLL for me?
Am I missing something for setting the PLL Multiplier etc?
Thanks in advance.
Chris |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Mar 26, 2010 9:08 pm |
|
|
No, the value is in HZ
and the oscillator is 7.37MHz (7370000)
-ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Fri Mar 26, 2010 9:23 pm |
|
|
Thanks Ben,
I put the 73,700,000 for ease of reading, if I set to 73700000 then the PIC does not start, have looked through the datasheet regarding the oscillator config for the PLL etc which I can find but couldn't find a way in CCS to do it.
At 7.37Meg, the OLED runs fine but not the fastest for a full refresh of the screen hence needing extra speed, as the board was a quick mockup, I don't have anywhere to put an Xtal sadly.
Thanks
Chris |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Mar 27, 2010 2:52 am |
|
|
PCD (at least a recent version) is supporting your intended configuration prefectly.
A #use delay syntax that PCD can understand is e.g.:
Code: | #use delay(clock=73.7M,internal) |
To answer questions like this, that aren't exactly covered by the compiler documentation (although you can guess
the solution from the #use delay description) you can do two things:
- Read the device datasheet thoroughly to understand the chip's capabilities and the SFR or #fuse settings that
must be performed. If the intended setup isn't fully supported, you have manual SFR programming as a last ressort.
- Play around with the compiler settings, in this case #use delay parameters, and check the generated initialization code.
I also can't do but this. |
|
|
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Sat Mar 27, 2010 8:35 am |
|
|
Thanks FVM for clarifying that, appreciated :o) |
|
|
|