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 CCS Technical Support

PIC18F25K42 external osc not working

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



Joined: 21 Nov 2020
Posts: 9
Location: Australia

View user's profile Send private message

PIC18F25K42 external osc not working
PostPosted: Sat Nov 21, 2020 2:20 am     Reply with quote

Hi I'm newish to the CCS Compiler. I'm attempting to use the external osc on this chip. Here is my test code.
Code:

#include <18F25K42.h>
#FUSES NOWDT
#use delay(clock=32768000,oscillator=16384000)

void main()
{

   while(TRUE)
   {
      output_toggle(PIN_A1);
      delay_ms(1000);

      //TODO: User Code
   }

}

If I compile using the internal osc at 64MHz all works ok. However, when I try and load the above code I get a verification error.

I'm running PCWHD version 5.080, CCSLOADER version 5.064 with firmware 3.45. Target device ID is correct.
I'm connect to the osc1CLKIN on pin A7, pin 9 on 28 pin SOIC package.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 3:07 am     Reply with quote

Who is the manufacturer, and what is the part number of your external
oscillator ?

I suggest that you try this:
Code:
#use delay(oscillator=16.384M)
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 3:17 am     Reply with quote

What sort of external oscillator do you want?. You are not telling the compiler.
Also, the combination has to be possible.
The maximum frequency supported by the PLL is 64MHz, You are asking
it to do 65536000Hz....
From a 16384000 Hz crystal or oscillator the fastest the CPU can do is
16384000Hz.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 5:35 am     Reply with quote

Hmm.. I'm wondering if the external oscillator' is actually a 'canned crystal' as he says it's connected to ONE pin. If so, then the setup 'fuse' should be 'EC-IO' so you have to specify 'external' in the oscillator options ( osc=speed,external). You'll have to see about the correct syntax.as I don't recall ever using a 'canned oscillator' though I have a few here from nonPIC projects.
bill53



Joined: 21 Nov 2020
Posts: 9
Location: Australia

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 7:30 am     Reply with quote

Thanks everyone.

It's an XO oscillator, brand QANTEK, part number QX8T50B16.38400B50TT purchased from RS Components. Oscilloscope shows an almost clean 16.384MHz square wave with a 10x probe.

OK I've compiled using osc=16.384MHz while at the same time measuring the frequency at the osc1CLKIN pin with the scope, and it works. If I remove the scope it stops, re-apply it starts again. Looks like the XO osc needs to be loaded?? Any thoughts ?

Cheers Bill
bill53



Joined: 21 Nov 2020
Posts: 9
Location: Australia

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 7:45 am     Reply with quote

Further.

I compiled and load:
#use delay(clock=65.536MHz, osc=16.384MHz) with CLKOUT enabled.

I'm measuring 16.384MHz at the clock out pin. So looks like the chip is running over clocked.

Cheers Bill
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 9:05 am     Reply with quote

1st thought...
65.636MHz is way too fast for that PIC !!! datasheet says 64MHz is the MAX.

Really, use 16.384 as the clock= as see what happens

16.384 x4 is 65536, so maybe the PLL is 'on'.

Jay
bill53



Joined: 21 Nov 2020
Posts: 9
Location: Australia

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 11:16 pm     Reply with quote

Just to confirm. The PIC is working with:

#use delay(clock=65.536MHz, osc=16.384MHz) and with oscOUT enabled. But only with the XO output pulled high via 10M ohms in parallel with 10pF.

With the PIC running in this configuration I measure 16.384MHz at the oscOUT pin which I understand to be fsco so that would indicated that the PIC is running at 16.384 MIPS. Good. Yes, I now the specs say the max clock is 64MHz but I was curious to see if the PLL would run with a 16.384MHz external osc.

I've tested two copies of this PIC and both work in this configuration.

I've used this XO to provide a clock to an 18F4550 without any of these issues so maybe the 18F25K42 is a bit fussy? It seems that however I configure this combination of XO and PIC it will not run without the combination of the 10M pull up resistor in parallel with 10p.

Your thoughts would be appreciated. Cheers Bill.

Has anyone else had issues with the 18F25K42?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Nov 22, 2020 1:57 am     Reply with quote

bill53 wrote:


It's an XO oscillator, brand QANTEK, part number QX8T50B16.38400B50TT

OK I've compiled using osc=16.384MHz while at the same time measuring the frequency at the osc1CLKIN pin with the scope, and it works. If I remove the scope it stops, re-apply it starts again. Looks like the XO osc needs to be loaded ?

That should not happen. The whole idea behind a packaged oscillator is
that you don't have to fiddle with it. If you do, either the oscillator is
defective or something else is wrong in the components or the design.

Also, this oscillator has an enable pin. A high level on this pin enables the
output signal. A low-level tri-states the output. Normally, this type of
oscillator has an internal pull-up on the enable, to allow output by default.

You might try connecting an external pull-up to the Enable pin.
Check all connections to the other pins on the oscillator.

Quote:
So looks like the chip is running over-clocked.

It's not running properly. You have to put a special circuit on the output
of the oscillator to make it work, somehow. You should not be
over-clocking the PIC. If you're doing this for a commercial design, this
would be definitely bad.

This is the datasheet (more like a brochure) for your oscillator:
https://www.qantek.com/tl_files/products/oscillators/QX8.pdf
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 22, 2020 6:08 am     Reply with quote

I have to agree with PCMP that overclocking is a bad thing ! Ever have a PC lockup from tweaking the speed ? Sure the one 'on the bench' works fine but eventually dozens 'in the field' will fail 'somehow', maybe related to temp or humdidity... Also PCB design, layout and components have to be correct. While going from 64M to 65.5M may not seem that big of a deal....it's the itty bitty 'details', only one has to cause you problems.
Have to ask do you REALLY need the speed ? What process or code needs the minor increase from 64M to 65M5 ?

Jay
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Nov 22, 2020 2:15 pm     Reply with quote

I also agree that it sounds like a connection problem. I switched all my designs
to canned oscillators over 10 years ago and have never had a problem with
them in hundreds of applications. They have always been rock solid.
_________________
Google and Forum Search are some of your best tools!!!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Nov 23, 2020 7:37 am     Reply with quote

Actually I have seen problems with canned oscillators.

Had a batch of boards where the oscillators were unreliable, It turned out
to be a 'batch' problem with the oscillators. The can, was not properly sealed,
and was getting full of water when the boards were cleaned after
manufacture....

However have to agree I have never seen a problem, except where there
was a fault like this. Very Happy
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Nov 23, 2020 10:21 am     Reply with quote

I have always used ECS cans and never a problem (knock on wood).
_________________
Google and Forum Search are some of your best tools!!!!
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