View previous topic :: View next topic |
Author |
Message |
jgschmidt
Joined: 03 Dec 2008 Posts: 184 Location: Gresham, OR USA
|
Looking for CLOCKOUT fuse for 18F26K22 |
Posted: Sat Apr 27, 2013 11:25 am |
|
|
Does anyone know the fuse setting to get the clock output on OSC2?
Usually this is CLOCKOUT or CLKOUT but neither works. Just something I like to use so I can verify proper clock setting with my O-Scope. The .h file and FUSES.TXT have not provided any clues.
Thanks. _________________ Jürgen
www.jgscraft.com |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1354
|
|
Posted: Sat Apr 27, 2013 11:58 am |
|
|
Just scanning through the list of fuses provided by the compiler it would depend on your oscillator setup. You should look at the fuses used to select the oscillator. Some have an _IO at the end of the name, which is what turns off the clock out. You would need to use a FUSE that doesn't have the _IO. If you are using the internal RC for example, it would be INTRC (INTRC_IO makes the pin I/O rather than clock out).
If you have the IDE take a look at the Valid Fuses tool. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 27, 2013 12:03 pm |
|
|
the fuses do seem a bit inscrutable in CCS sometimes, as the spelling does not always match the data sheet
when i am faced with a problem like that -
and am in a HURRY ( which is usually )
i use my MEI PROGRAMMER to sort it out
(microEngineering Labs, Inc.)
the MEI ( micro engineering labs) , USB programmer has a wonderful drop down menu with VERY clear settings for ALL processor fuses.
decodes what the compiler inserted in the same language as the datasheet
and
best of all, it will let edit the HEX fuse line in the CCS hex source file to incorporate whatever fuses you want - interactively.
Last edited by asmboy on Sat Apr 27, 2013 1:28 pm; edited 1 time in total |
|
|
jgschmidt
Joined: 03 Dec 2008 Posts: 184 Location: Gresham, OR USA
|
|
Posted: Sat Apr 27, 2013 12:16 pm |
|
|
Thanks. I've gone through those, checked the fuse settings in the listing to see if I could reverse one, and still no joy. Here is my setup:
Code: | #include <18F26K22.h>
#FUSES INTRC //Internal RC Osc, with output - doesn't work, CCS sets this back to INTRC_IO
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPUT //No Power Up Timer
#FUSES NOMCLR //Engages weak pullup
#FUSES NOBROWNOUT //No brownout reset
//#FUSES CLKOUT //Check FOSC/4 on OSC2 - should be .125us - doesn't work
#use delay(internal=32M)
|
When I try INTRC, the compiler listing shows INTRC_IO so it appears CCS is overriding this for some reason.
PCWHD 4.135 _________________ Jürgen
www.jgscraft.com |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 27, 2013 12:30 pm |
|
|
YEP
CONFIG1H
BIT 0-3 set as
1001 = Internal oscillator block, CLKOUT function on OSC2
looks right - BUT how to get that set ??
not a fuse in the CCS list seems right for that bit of change.
you could try patching the HEX file - after compilation |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1354
|
|
Posted: Sat Apr 27, 2013 12:46 pm |
|
|
As an alternative, the manual suggests this example as a way to manually set fuses:
Code: |
#FUSES 1 = 0xC200 // sets config word 1 to 0xC200
|
Obviously change the number and the value to fit what you need. I haven't tested that to see how it works yet though. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Apr 27, 2013 12:56 pm |
|
|
Quote: | #FUSES 1 = 0xC200 // sets config word 1 to 0xC200 |
That's a neat little gem I never noticed after all these years of RTM! _________________ Google and Forum Search are some of your best tools!!!! |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Sat Apr 27, 2013 1:33 pm |
|
|
Hey, cool - never noticed that before. Added a "flag" to my manual on that one (for others, it is in the #FUSES section - pg 105 or there abouts)
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 27, 2013 2:03 pm |
|
|
In a simple flash the led program, where you do your normal fuses, as well as they can be done so far- calling for an INTernal oscillator with PLL off
and AFTER the normal #fuses statements
ADD
#FUSES 1 = 0x0900
what does it buy you ?? |
|
|
jgschmidt
Joined: 03 Dec 2008 Posts: 184 Location: Gresham, OR USA
|
|
Posted: Sat Apr 27, 2013 5:00 pm |
|
|
Thanks, guys. I always enjoy and learn from these discussions.
I tried the #FUSES 1=0xF900.
First, the compiler didn't like spaces around the "=" sign
Second, in the listing it still forced F800 as the first fuse. In fact the FUSES override seems to not work at all.
Fortunately, I can set the bits manually with my PicKit2 and it's only for testing so no big deal. Just something that makes me wonder what other surprises await.
I even checked the configuration editor. It has the correct entry and value for the INTRC option. It just doesn't come through when compiled.
That's why we double, and then redouble, our software development time estimates, right?
Cheers, _________________ Jürgen
www.jgscraft.com |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 27, 2013 5:12 pm |
|
|
thats why when in doubt - i rely on my programmer
to 'fixup' faulty fuses.
and not afraid to do that to a release version either - if thats what
it takes to push it across the finish line. |
|
|
|