![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
__baltazar__ Guest
|
PIC18F takes forever to start |
Posted: Sat Mar 22, 2008 6:49 am |
|
|
SOS guys!
I have just switched to the PIC18F series devices. For a while I was confused with the PLL & the OSC setting but managed to go through it ( or I'm still missing something ...) Here's my problem. I am using a 20MHz crystal with 15pf Cs and played with PLL & CPU div settings to get a stable MCU clock. But everything seems to be futile. Either it takes about 2 minutes to get the PIC started or when it is running already , it hangs somewhere and slows down.
I'm trying to clock the MCU core at 48Mhz although it is not a requirement for the project.
Q1. What is the recommended most stable MCU clock I should use? (I don't need the USB periheral)
Q2. What is the best clcok setting then - there are more than a dozen?
Q3. Do I have the right understanding that I have 48MHz when PLL div 2 & CPU div 5 is set - that is at 20MHz crystal?
I would appreciate your help. I have not experienced such problem with PIC16. By the way , I am using here the brothers PIC18F2550 & 4550. |
|
![](templates/subSilver/images/spacer.gif) |
Matro Guest
|
|
Posted: Sat Mar 22, 2008 8:11 am |
|
|
Q1. There is no clock frequency more stable than another as long as you stay in the range of the specification
Q2. The best clock setting is the most appropriate to your needs...
Please check the fuses and that the 15pF match with the Xtal datasheet.
You can post your fuses configuration for further help.
Matro |
|
![](templates/subSilver/images/spacer.gif) |
baltazar_aquino
Joined: 16 Mar 2008 Posts: 27
|
|
Posted: Sat Mar 22, 2008 8:51 am |
|
|
Thanks for prompt reply Matro
Here's the test code
Code: |
#include <18F2550.h>
#device adc=8
#FUSES HSPLL //High Speed Crystal/Resonator with PLL enabled
#FUSES CPUDIV2, PLL5
#use delay(clock=48000000)
void main()
{
///simple test block - takes forever to start!
set_tris_b(0); // all output
while(1)
{ output_b(0);
delay_ms(500);
output_b(0xff); // fire up LED bank , sometimes hangs
delay_ms(500);}
}
|
The 15pF seems to be ok according to the data sheet. I use the same value in the PIC16f877a development board I designed. ![Shocked](images/smiles/icon_eek.gif) |
|
![](templates/subSilver/images/spacer.gif) |
drh
Joined: 12 Jul 2004 Posts: 192 Location: Hemet, California USA
|
|
Posted: Sat Mar 22, 2008 9:54 am |
|
|
The oscillator configuration options for this PIC are quite extensive. After a quick look at the data sheet, DS39632D, I think it shows a 16Mhz xtal as the highest for the mode you are using. _________________ David |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sat Mar 22, 2008 9:58 am |
|
|
Add:
#FUSES PUT, NOXINST, USBDIV, NODEBUG, NOLVP, NOWDT
A couple of these are 'optional' at this point, but NOLVP, is essential, unless you have the low voltage programming pins tied to the inactive state.
As has been said, there is really no 'best' frequency, for the master oscillator. Any multiple of 4MHz, up to the maximum supported by the chip. However higher frequencies, mean slightly more power cnsumption in the oscillator, and slightly more RF noise. 4MHz, can be fractionally more 'fussy' to get going, so personally, I tend to recommend 8MHz, or 12MHz.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
baltazar_aquino
Joined: 16 Mar 2008 Posts: 27
|
|
Posted: Sun Mar 23, 2008 11:13 am |
|
|
I'm still stuck on this. I even tried a lower crystal freq (11.0592mc) under HS mode only (no PLL) but still it won't run. I tested 2 chips already and I have a dozen of this for a target project. My old friend 877a will run the code at 20Mc in a breeze but this one truly disappointing. ![Crying or Very sad](images/smiles/icon_cry.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sun Mar 23, 2008 11:29 am |
|
|
How simple is your test code?.
I'd suggest you try something _really_ simple, like a single LED flasher. My suspicion is that something else is hampering your startup, in the code. The chips do run fine, and start just like any other. There are a lot of other things 'different' about these chips.
Put a scope on the oscillator output. Is it starting?.
Have you got brownout enabled?. What voltage?.
Add NOFCMEN, NOPBADEN, and NOIESO to your fuses.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
baltazar_aquino
Joined: 16 Mar 2008 Posts: 27
|
|
Posted: Mon Mar 24, 2008 8:38 am |
|
|
Ttelmah wrote: | Add:
#FUSES PUT, NOXINST, USBDIV, NODEBUG, NOLVP, NOWDT
A couple of these are 'optional' at this point, but NOLVP, is essential, unless you have the low voltage programming pins tied to the inactive state.
|
Bullseye! Thanks Ttelmah. It was really the NOLVP fuse that I need + the PUT. But I just noticed one thing. If I use the LF version (18LF2550), I have to use PUT but for the regular 18F2550, I got to use the NOPUT fuse. I don't have time to research for the reason now. Maybe someone out there has. Wow! , I got to work on my MIDI sequencer now. Thanks guys. This forum really works. BTW, Ttlemah, the test code I posted is the LED blink test ![Wink](images/smiles/icon_wink.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|