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

PIC18F2480/2680 Oscillator Issues

 
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

PIC18F2480/2680 Oscillator Issues
PostPosted: Wed Mar 12, 2008 8:51 pm     Reply with quote

Has anyone had issues getting a 18F2480 or 18F2680 to operate properly with 18.432 MHz 20 pF crystals? I've used the same processors with 12.000 MHz 20 pF crystals from the same manufacturer (ECS; same product family too, actually) and never had problems. The product I'm currently working on has 4 '2680s and one 2480. 3 of the processors are mounted on one PCB, and they all work. The last 2680 and the 2480 are mounted on their own boards, and I'm having a hell of a time just getting their oscillators to work.

I've laid out the boards nearly identically; the only small difference is that the two nonworking boards have a very slightly smaller (no more than 0.080" by 0.010") area clear of a top ground plane around their crystal & crystal caps. Caps are 22pF, by the way. HS fuse of course.

I learned a long time ago that top ground planes amongst the crystal circuitry is a bad idea. That's why I leave a clear area around the crystal. I was able to get the boards to sort of work (get their oscillators running, anyway) by manually enlarging the ground plane free area. However, that didn't completely solve the problem as they can't communicate via CAN or RS232, which tells me their clocks are off or varying.

I've also ruled out bad PICs and crystals, because I've swapped out the processors and crystals with no improvement in behaviour. I also tried 18 pF caps on one of the non-functioning boards, and they finally got it to (sort of) work. I don't have any other smaller cap values to try, but I doubt that this alone would explain what I'm seeing as 3 other processors with 22 pF crystal caps are working. Can anyone see any obvious problems that I can't?
Ttelmah
Guest







PostPosted: Thu Mar 13, 2008 3:22 am     Reply with quote

Your caps are actually too small.
The formula for the capacitance 'seen' by the crystal, is:

(Ca+Cp)/2

Where 'Ca' is the value of one of the added capacitors, and Cp is the pin capacitance of the chip (and the PCB round it).
So, if your crystal wants to 'see' 20pF, you need Ca+Cp to add up to 40pF. The pin capacitance of the PIC, is typically only about 3pF, and the board will double this (say a total of 6 to 8pF), so you need load capacitors of about 32pF. This is why 32pF capacitors are common.
Now an error in the load itself, won't stop the oscillator, but the whole circuit, _must_ produce 0, or 360degrees of phase shift, or it won't oscillate. Changing the capacitance alters this. There is normally a minimum capacitor value that must be present, for the oscillator to start. It may well be that you have moved outside this. It could be as simple, as the board being very close to the minimum capacitance needed, and the 'faulty' boards, have been better cleaned, resulting in Cp dropping.
So look at the following:
1) You are sure that HS has been selected as the oscillator type?. The XT oscillator will often run significantly above it's rated frequency, but gain is down, making component choice more and more crytical.
2) Double check the _type_ of the capacitors used. Some capacitors are not suitable in oscillators, displaying peculiar phase shifts, and massive losses. This is why traditional dielectrics like X7R are normally used.
3) Increase the capacitors to 32pF. Your oscillator accuracy will be better.
4) Double check the cleaning of the board round the oscillator.

Best Wishes
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu Mar 13, 2008 5:04 pm     Reply with quote

Thanks, you're a lifesaver. I've been kicking myself all day. I happened to have some 33pF C0G caps on hand, and they've done the trick. The 22pF caps I had been using were X7R. It's my standard practice to use X7R for crystal caps.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 13, 2008 5:14 pm     Reply with quote

I don't think you can get capacitors in that pF range in X7R. All I've ever
seen is NPO or COG. In fact, the NPO/COG types are better in every
way than the X7R types.
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