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

[SOLVED] CLKOUT waveform?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

[SOLVED] CLKOUT waveform?
PostPosted: Thu May 10, 2018 11:31 am     Reply with quote

PIC18LF24K40. Compiler version 5.078. For the first time ever (for any PIC) I'm attempting to use the CLKOUT on OSC2.

Code:
#use delay(internal=64000000, clock_out)
#FUSES CLKOUT


3.3V supply.

It's running at 64MHz, confirmed. I do see a 16MHz waveform on OSC2 (pin A6), but it's misshapen. Instead of a waveform that varies between GND and 3.3V, I'm seeing a square-ish wave that toggles between ~2.8V and 3.3V.

Is this normal? I've tried two different boards and both show the same thing. Is there some other trick to get the CLKOUT signal to vary from GND to Vsupply?

Edit: Just tried doing the same thing but with a 16LF727. I see a rail-to-rail square wave with that.


Last edited by newguy on Mon May 14, 2018 12:41 pm; edited 1 time in total
temtronic



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

View user's profile Send private message

PostPosted: Thu May 10, 2018 12:43 pm     Reply with quote

Seriously doubt it's normal.... I'd suspect a kinda bad PIC ?, 'funny' PCB trace, floating or cap coupled to scope, bad scope probe( been nailed by that once ,arrgh...), crosstalk from another pin(BELL did that to me,ARRGH)...
Sure be nice to nail down why though.....
Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 10, 2018 12:50 pm     Reply with quote

If no one else can test it, I have an 18F47K40 coming in later this
afternoon. I can put a scope on it.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu May 10, 2018 12:59 pm     Reply with quote

PCM programmer wrote:
If no one else can test it, I have an 18F47K40 coming in later this
afternoon. I can put a scope on it.


Yes please.

Temtronic: no electrical gremlins. Everything is kosher. Same equipment that confirms that a 16LF727 works was used to confirm that the 18LF24K40 doesn't. I like this particular PIC but it does seem to suffer from some "teething" type problems.
temtronic



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

View user's profile Send private message

PostPosted: Thu May 10, 2018 7:36 pm     Reply with quote

yeesh i have enough 'fun' with 'old' PICs or peripherals that I've never used before...how anyone has any hair left using the new and 'better' PICs is beyond me.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 11, 2018 1:20 am     Reply with quote

The following program outputs a full-scale CLKOUT waveform, but it only
works up to 32 MHz. If I change the frequency to 64M, then CLKOUT has
an amplitude of 0.3v p/p.
Code:

#include <18F47K40.h>
#fuses  NOEXTOSC, NOWDT, BROWNOUT, PUT, NOLVP, NOXINST
#use delay(internal=32M, clock_out)

//======================================
void main()
{                                                                     


while(TRUE);
}

This was tested with a 3.3v Vdd, and compiler vs. 5.078.
temtronic



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

View user's profile Send private message

PostPosted: Fri May 11, 2018 5:25 am     Reply with quote

Hmm... don't use the PIC, havent DLD the datasheet
just food for thought...
to get 64Megs, does it use a PLL ? If so ,it could be the PLL 'acting funny', sending CLKOUT a bad signal,something we can't scope...

Curious, does it work OK at 5 volts? maybe the 64megs/3v isn't a good, though valid' combo ?
Jay
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri May 11, 2018 6:08 am     Reply with quote

PCM,

Interesting. Thank you. I also tried 2MHz and 1MHz with the same result. When I get in I'm going to try other frequencies as well.
temtronic



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

View user's profile Send private message

PostPosted: Fri May 11, 2018 6:20 am     Reply with quote

Ok.. doesn't sound like a PLL problem...assuming low clock bypasses PLL...
have you a couple more of the same PICs to try ? Maybe this one is 'damaged' (say from ESD ?? )
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri May 11, 2018 7:26 am     Reply with quote

So....

64MHz: misshapen positive offset 0.5Vp-p waveform out.
48MHz: misshapen positive offset 1.5Vp-p waveform out.
32MHz: proper rail-rail output square wave.
16MHz: proper rail-rail output square wave.
12MHz: proper rail-rail output square wave.
8MHz: proper rail-rail output square wave.
4MHz: misshapen positive offset 2Vp-p waveform out.
2MHz: misshapen positive offset 1Vp-p waveform out.
1MHz: misshapen positive offset 0.5Vp-p waveform out.

Tested and confirmed with two different PCBs (same processor), same results. Didn't find the good waveforms because I only tried 64, 2, and 1MHz yesterday. I have a nice large SMD pad to probe the CLKOUT signal but admittedly my ground connection for my scope probe is bad as it's just me holding the negative clip on the ground side of an 0603 capacitor.

Reluctant to call it ESD but I can't completely rule that out either. Same behaviour with 2 samples, in my mind, points to the processor. What's most troubling is the low frequency oddness. I'd expect weirdness at high frequencies but not what are really quite low frequencies.

I'm going to chalk this one up to experience and from this point forward I'm not going to trust that I'll have a nice clock source handy unless I test it first.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Fri May 11, 2018 8:01 am     Reply with quote

newguy wrote:
So....

64MHz: misshapen positive offset 0.5Vp-p waveform out.
48MHz: misshapen positive offset 1.5Vp-p waveform out.
32MHz: proper rail-rail output square wave.
16MHz: proper rail-rail output square wave.
12MHz: proper rail-rail output square wave.
8MHz: proper rail-rail output square wave.
4MHz: misshapen positive offset 2Vp-p waveform out.
2MHz: misshapen positive offset 1Vp-p waveform out.
1MHz: misshapen positive offset 0.5Vp-p waveform out.

Tested and confirmed with two different PCBs (same processor), same results. Didn't find the good waveforms because I only tried 64, 2, and 1MHz yesterday. I have a nice large SMD pad to probe the CLKOUT signal but admittedly my ground connection for my scope probe is bad as it's just me holding the negative clip on the ground side of an 0603 capacitor.

Reluctant to call it ESD but I can't completely rule that out either. Same behaviour with 2 samples, in my mind, points to the processor. What's most troubling is the low frequency oddness. I'd expect weirdness at high frequencies but not what are really quite low frequencies.

I'm going to chalk this one up to experience and from this point forward I'm not going to trust that I'll have a nice clock source handy unless I test it first.


Your local Microchip FAE might like to know about this.
_________________
David
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri May 11, 2018 8:09 am     Reply with quote

Later today when I have time I'm going to open a support ticket with Microchip. The current errata says nothing about problems with the CLKOUT and the internal oscillator.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Fri May 11, 2018 10:35 am     Reply with quote

Remember the chip does have a programmable clock source. Might be easier to use this!...

Must admit I had a good 'online' search to see if anyone else had mentioned this. Given the small number of people who use the CLKOUT it doesn't seem to have been spotted yet. One possiblity is it may be 'batch specific' to a particular set of these chips. It must be fairly common though since PCM_programmer found one with the same problem.
Ouch....
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri May 11, 2018 12:14 pm     Reply with quote

Ttelmah wrote:
Remember the chip does have a programmable clock source. Might be easier to use this!...

Must admit I had a good 'online' search to see if anyone else had mentioned this. Given the small number of people who use the CLKOUT it doesn't seem to have been spotted yet. One possiblity is it may be 'batch specific' to a particular set of these chips. It must be fairly common though since PCM_programmer found one with the same problem.
Ouch....


Good idea regarding the clock reference module. Will investigate later today.

I burned probably 3h yesterday wondering what I was doing wrong regarding the oscillator CLKOUT. I got sort of locked into using it because I'm migrating an existing product to a slightly different application, and the existing unit uses the processor's CLKOUT to generate a waveform that gets used in other parts of the circuit. Monkey see, monkey do. Anyway, hit this weird "wall" with the CLKOUT not working "as advertised", and grew progressively more frustrated throughout the day.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri May 11, 2018 2:21 pm     Reply with quote

Regarding the reference clock output module: similar behaviour to the CLKOUT module. Seems like the output clock driver has a usable bandwidth of ~8MHz. For example, set the processor to run at 64MHz from the internal clock and try to output that as well: output line sticks high. Set the divider to 8 and a wonderful 8MHz clock appears. However, this clock's duty cycle cannot be varied from 50%. If you try to set the processor's clock and divisor to any combination that results in an output frequency > 8MHz, and you're going to be disappointed. Same behaviour as with the CLKOUT: DC offset attenuated waveform which disappears entirely (line sticks high) once the desired output frequency gets too high. Seems like less than 8MHz is supported, but I haven't fully exercised everything such as trying to vary the duty cycle from 50%.

Edit: support ticket opened with Microchip. PCM, if you have a moment you should also open a ticket regarding the processor you played with yesterday. Sounds like it's either a data sheet omission (i.e. the output waveform is limited to be less than ~10MHz) or it's a pretty major screw up at the silicon level.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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