View previous topic :: View next topic |
Author |
Message |
willie.ar
Joined: 21 Jan 2004 Posts: 15 Location: Argentina
|
12F675 @ 20 MHz |
Posted: Fri Nov 02, 2012 12:23 pm |
|
|
This could be a hardware limitation or something missing in the settings.
I am trying to run an easy Led blinker, 250 msecs on/off, on a 12F675 with a crystal at 20 MHz without success. It works at 4 MHz with a crystal set up as #FUSE XT. For 20 MHz I use #FUSE HS. Already tried XT for 20.
I check with an oscilloscope and the crystal actually oscillates at 20 MHZ but signal is about 2 V amplitude, between 1 and 3 V, and the program sticks or acts randomly. I connected suggested capacitors to ground as mentioned in datasheets.
I tried to find on Microchip specs any data regarding a different ID or suffix for 20 MHz (like the dash 20 on the F628) but seems to be the same package for all on the 12F675.
The remaining settings are:
Code: |
#FUSES NOWDT, NOCDP, NOPTRTECT, NOMCLR, NO PUT, NO BROWNOUT
#USE DELAY (CLOCK= ) /// 4000000 or 20000000
set_up_comparator(NC_NC_NC_NC);
set_up_adc_ports(NO_ANALOG);
set_up_adc (ADC_OFF);
Disable_interrupts(global);
|
I just found some posts in the forum but regarding the internal osc. Nobody complaining about crystals and 20MHz on the 12F675.
Am I missing something? Any help will be welcome.
tks
I need to use a code already working on a 16F628 that must run at 20 MHz. |
|
|
willie.ar
Joined: 21 Jan 2004 Posts: 15 Location: Argentina
|
Re: 12F675 @ 20 MHz |
Posted: Fri Nov 02, 2012 12:25 pm |
|
|
Also tried at 10.2 MHz and 7.37 MHZ without success. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Nov 02, 2012 12:35 pm |
|
|
Q1.What value have you chosen for the xtal caps ? |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Fri Nov 02, 2012 12:48 pm |
|
|
Hi,
I don't see a fuse to configure the oscillator. Generally, you'll use one of the
following: LP, XT, or HS. I'm not sure what happens if you don't specify
anything, but if the default is the low power crystal excitation, you might
experience what you are seeing? I don't have away to test this, but I'd add
the 'HS' fuse for the 20mHz crystal and see what happens!
John |
|
|
willie.ar
Joined: 21 Jan 2004 Posts: 15 Location: Argentina
|
|
Posted: Fri Nov 02, 2012 1:40 pm |
|
|
temtronic wrote: | Q1.What value have you chosen for the xtal caps ? |
thanks for your quick response. I´m using 22 and 30 pF |
|
|
willie.ar
Joined: 21 Jan 2004 Posts: 15 Location: Argentina
|
|
Posted: Fri Nov 02, 2012 1:42 pm |
|
|
ezflyr wrote: | Hi,
I don't see a fuse to configure the oscillator. Generally, you'll use one of the
following: LP, XT, or HS. I'm not sure what happens if you don't specify
anything, but if the default is the low power crystal excitation, you might
experience what you are seeing? I don't have away to test this, but I'd add
the 'HS' fuse for the 20mHz crystal and see what happens!
John |
Thanks for reply. HS was the first try. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Fri Nov 02, 2012 3:13 pm |
|
|
I'm worried about the general syntax of your fuses. For instance the fuse setting for no power up timer is NOPUT without spaces. I'd suspect the compiler is just getting these wrong because they don't match the legitimate values. The fuse values that are legal are in the start of the .h file for the chip. Use cut and paste from these, rather than typing them yourself.....
For a crystal, I'd always use PUT. It is needed to allow the crystal time to start.
Code: |
#FUSES HS, NOWDT, NOMCLR, PUT
#USE DELAY (CLOCK=16MHz)
|
This is 'cut and pasted' from a chip I was running yesterday using a 16Mhz crystal, without problems.
As a comment, what is the environment you are actually building this with?. Breadboard?. If so, it may just have too much capacitance to run at 20Mhz....
Best Wishes |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Nov 02, 2012 3:19 pm |
|
|
Quote: | I check with an oscilloscope and the crystal actually oscillates at 20 MHZ but signal is about 2 V amplitude, between 1 and 3 V | How did you connect the scope? Directly to the crystal will give incorrect results because the capacitance of the probe will disturb the oscillator too much.
What is your supply voltage? 10MHz or higher requires a minimum of 4.5V
Code: |
#FUSES NOWDT, NOCDP, NOPTRTECT, NOMCLR, NO PUT, NO BROWNOUT | This doesn't compile. There are at least 3 misspelled fuses. Please post real code, not something you made up!
The very important HS fuse is missing too.
What is your compiler version number?
What does your circuit look like? Is it a proper PCB or breadboard? If it is a PCB, did you design it yourself or is it a bought component? (type number and supplier?) |
|
|
willie.ar
Joined: 21 Jan 2004 Posts: 15 Location: Argentina
|
|
Posted: Sat Nov 03, 2012 7:32 am |
|
|
First of all, sorry for the syntax. It was not a copy paste of the C file but a quick typing since I was on another computer. From all your comments, understanding there is not such a special device for 20 MHz, I rewired and decoupled better the power supply right on the chip pins. and it works!! and yes it´s mounted on a solderless breadboard.
Also use PUT as Ttelmah suggested- if you can detail how it works...
It´s running at 5 V but good your comment ckielstra about that.
Thanks a lot for your time. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Sat Nov 03, 2012 1:09 pm |
|
|
Crystal oscillators take time to start.
PUT allows for this, not trying to run the chip, till a few mSec after the supply goes on. It is not needed for the RC oscillator which starts in only a few uSec, but crystals do like a bit of time....
Glad it is working now, though on a 'solderless breadboard', you will almost certainly find the crystal runs a little slow because of the extra capacitance these introduce.
Best Wishes |
|
|
willie.ar
Joined: 21 Jan 2004 Posts: 15 Location: Argentina
|
|
Posted: Sun Nov 04, 2012 5:31 am |
|
|
Ttelmah wrote: | Crystal oscillators take time to start.
PUT allows for this, not trying to run the chip, till a few mSec after the supply goes on. It is not needed for the RC oscillator which starts in only a few uSec, but crystals do like a bit of time....
Glad it is working now, though on a 'solderless breadboard', you will almost certainly find the crystal runs a little slow because of the extra capacitance these introduce.
Best Wishes |
Thank you. |
|
|
|