CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

No CLKOUT while set as fuse

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Woody



Joined: 11 Sep 2003
Posts: 75
Location: Warmenhuizen - NL

View user's profile Send private message

No CLKOUT while set as fuse
PostPosted: Thu Mar 25, 2021 1:42 pm     Reply with quote

Hi all,

I'm using a (for me) new PIC (18F55Q43) and run into something that looks like either a compiler issue or me not getting it.

In short, the #fuses CLKOUT does not work.

-The PIC uses an external oscillator
-The PIC runs code (blink a led)
-I can toggle the CLKOUT pin (PIN_A6) so HW wise it seems fine.
-If I look at the config word (using CCS Device programmer SW) the
"Output clock on OSC2" in not selected.
- If I select this manually, save it to the .hex file, load and run it, the CLKOUT works.

So either I am forgetting something, or the compiler forgets something.

And another question that arose while researching this: is there a way to see what bits in the config word are set in the IDE itself?

Compiler 5.103
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 25, 2021 2:20 pm     Reply with quote

Just to be sure, check if the slew rate setting is causing the problem.
See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=57171&start=15
Woody



Joined: 11 Sep 2003
Posts: 75
Location: Warmenhuizen - NL

View user's profile Send private message

PostPosted: Thu Mar 25, 2021 2:47 pm     Reply with quote

I cleared the slew rate setting for A but that does not make a difference. The entire option is still not activated in the configuration word.

Although with this PIC I run into a number of differences with chips I worked with before, I start to think this might be a compiler issue after all.

Thanks for the suggestion!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 25, 2021 7:31 pm     Reply with quote

Can you post a small compilable program that shows the problem ?
The program should have:

- #include for the PIC
- #device statements (if any)
- #fuses (if any)
- #use delay (if any)
- other items
- A very simple main()
Ttelmah



Joined: 11 Mar 2010
Posts: 19217

View user's profile Send private message

PostPosted: Fri Mar 26, 2021 1:20 am     Reply with quote

I'd suspect the interlock is set wrong.

The CLKOUT fuse cannot be selected when you have XT, HS, or the LP
oscillator selected. It looks as if the interlock for this is set incorrectly,
so prevents the fuse being set all the time... Sad
If I go and edit the device table (device editor), and ensure that this fuse
is setup correctly, I see:
Code:

#include <18F55Q43.h>
#device ADC=12

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES CLKOUT                   //enable clock out
#FUSES ECH                      //high speed external oscillator

#use delay(CLOCK=20000000)

void main()
{
   while(TRUE)
   {

   }
}


Code:

Configuration Fuses:
   Word  1: FFFF   ECH RSTOSC_EXT NOCLKOUT PRLOCK1WAY CKS FCMEN
   Word  2: DFF7   MCLR NOPUT NOMVECEN IVT1WAY NOLPBOR BROWNOUT BORV19 ZCDDIS PPS1WAY STVREN NOLVP NOXINST
   Word  3: FF9F   WDTSW NOWDT WDTWIN_SW WDTCLK_SW
   Word  4: FFFF   BBSIZ512 NOBOOTBLOCK NOSAF NODEBUG NOWRTB NOWRTC NOWRTD NOWRTSAF NOWRT
   Word  5: FFFF   NOPROTECT


With the bit set to 1, which disables this.

If however I then change the setting in the device editor, so it has

[NO]CLKOUT 0100 0100 1

Which means that NOCLKOUT will give 0.
Code:

Configuration Fuses:
   Word  1: FEFD   ECL RSTOSC_EXT NOCLKOUT PRLOCK1WAY CKS FCMEN
   Word  2: DFF7   MCLR NOPUT NOMVECEN IVT1WAY NOLPBOR BROWNOUT BORV19 ZCDDIS PPS1WAY STVREN NOLVP NOXINST
   Word  3: FF9F   WDTSW NOWDT WDTWIN_SW WDTCLK_SW
   Word  4: FFFF   BBSIZ512 NOBOOTBLOCK NOSAF NODEBUG NOWRTB NOWRTC NOWRTD NOWRTSAF NOWRT
   Word  5: FFFF   NOPROTECT


With the bit set to off, the text still says 'NOCLKOUT'...
It seems to be ignoring the actual fuse value given from the code
completely, which is why I think it is the 'interlock'. So it permanently
sets the fuse to the 'NO' state, whatever you say. You can though get
it to go to '0', by overriding the setting with device editor, so it 'thinks'
the 'NO' state is 0 instead of 1.
I'd suspect the interlock is setup to 'allow' CLKOUT, when EC is selected
(which is how it works on chips without the slew control), but in this
chip where the external oscillator settings are ECL, ECM & ECH, this
doesn't then work... Sad

So you can get working, by changing the fuse bit in device editor as I
show for now, but it needs to be reported to CCS, that this option is not
working on this chip.
Woody



Joined: 11 Sep 2003
Posts: 75
Location: Warmenhuizen - NL

View user's profile Send private message

PostPosted: Fri Mar 26, 2021 2:16 am     Reply with quote

I raised this with support.

And I managed to not notice up to now that the fuse settings are stated way down at the bottom of the .lst file. I learned something today :-)

Thanks for the reaction.

Paul
Woody



Joined: 11 Sep 2003
Posts: 75
Location: Warmenhuizen - NL

View user's profile Send private message

PostPosted: Fri Mar 26, 2021 9:14 am     Reply with quote

Turned out that the #fuses CLK_OUT is overridden by a subsequent #use delay() if that statement does not contain the option 'clock_out'. As it did in my code.

Adding the option solved my problem.

It is in the manual. What can I say. Read the fine thing? Embarassed
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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