View previous topic :: View next topic |
Author |
Message |
leporid
Joined: 04 May 2010 Posts: 6
|
trouble replacing internal osc with xtal in 18F2620 |
Posted: Wed Jun 30, 2010 7:34 pm |
|
|
I have a board using a PIC18F2620 that has pads for an SMD
crystal. Previously, this board was used without the
crystal and with the internal oscillator. There are no
capacitors with the crystal; I was told that they were
unnecessary if the traces were under half an inch (true?).
I have been unable to make the 18F2620 run at anything
other than 8 mHz, as determined by the the delay_ms test. I
assume that the internal oscillator is taking over due to
some problem with the crystal.
I have tried this with a 16 mHz crystal (with and without
12 pF caps), it produces a 2 ms pulse when delay_ms is 1 ms
and clock=16000000. With a 20 mHz SMD crystal and no caps
the pulse is 2.5 ms instead of 1 ms with clock=20000000.
I have tried many combinations of the fuses listed under
"// CLOCK-related" below, the other lines were kept the
same.
I would like to run the 18F2620 at 20 mHZ with a 20 mHz
crystal. Questions are: 1) are caps required on the crystal
if the leads are very short (~1/4" in this case) 2) What is
the correct #FUSE configuration to run it at 20 mHz with a
20 mHz crystal?
Any help would be much appreciated.
Using CCS C 4.106. Here's my (latest variation of) MAIN.H:
Code: |
#include <18F2620.h>
#device adc=10
#device PASS_STRINGS=IN_RAM
#FUSES NOWDT //No Watch Dog Timer
//#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //brownout reset
//#FUSES BORV21 //Brownout reset at 2.1V
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOMCLR //Master Clear pin used for I/O
// CLOCK-related
//#FUSES XT //XTAL
//#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
//#FUSES FCMEN //Fail-safe clock monitor
#FUSES PUT // Power Up Timer
//#FUSES LPT1OSC //Timer1 low-power operation
#FUSES NOIESO //*Internal External Switch Over mode
//#FUSES IESO //*Internal External Switch Over mode
#use delay(clock=20000000,crystal)
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 30, 2010 8:07 pm |
|
|
Quote: | I was told that they were unnecessary if the traces were under half an
inch (true?). |
Wrong. You need the capacitors. Two 22 pf caps will work.
Quote: | I would like to run the 18F2620 at 20 mHZ with a 20 mHz
crystal. |
Use the HS fuse.
Quote: |
I have a board using a PIC18F2620 that has pads for an SMD crystal.
|
Post a link to the web page for the board. |
|
|
leporid
Joined: 04 May 2010 Posts: 6
|
trouble replacing internal osc with xtal in 18F2620 |
Posted: Wed Jun 30, 2010 8:19 pm |
|
|
Wow, that was a quick reply! Thank you.
Quote: |
Post a link to the web page for the board.
|
The board was designed by someone long gone, it's not
not a publicly available part.
I'll try the higher-value caps and HS alone from the
"clock" related group. |
|
|
|