|
|
View previous topic :: View next topic |
Author |
Message |
imbue
Joined: 28 May 2005 Posts: 13
|
Crystal Problems - OT |
Posted: Fri Jan 06, 2006 1:00 am |
|
|
This is slightly off topic, being mostly about crystals, but I know that a lot of you guys have extensive experience and I'm hoping you can help me.
I am running an 18F2455 using a 20MHZ crystal with PLL to 48MHZ. I'm using the WDT and the FSCM. Now this application works great about 99% of the time, maybe more. My problem is that at random the crystal seems to fail. The FSCM interrupt records the error in EEPROM and restarts the MCU, but it usually only boots to the internal RC oscillator. After a few minutes the crystal starts working again (seemingly at random).
I can find no way to make the problem repeat. It's only happened half a dozen times, and the thing has run fine for maybe a fifty hours or so. I've verified that it's not triggered by heat or cold. I'm pretty new, so I am hopefully just missing something obvious, but I can't be the only one or Microchip wouldn't have made the chips have a FSCM.
The crystals I'm using are 20MHZ, and the impedance is 20pf. I am using 22pf caps because that's what I have. I've also read in the datasheets that having a bigger value makes it more stable, and that's what I need (stability).
Please help me. If it wasn't for this problem, I'd be done with this project, but now it's starting to drive me crazy. Thanks! |
|
|
Brian S
Joined: 06 Sep 2005 Posts: 13
|
|
Posted: Fri Jan 06, 2006 8:21 am |
|
|
Over the years, we've found a few crystals of all style/manufacturer which were defective, and showed an inability to start oscillating reliably. Others would stop oscillating for no apparent reason. Sometimes several crystals purchased at the same time had similar problems. Try another crystal from another manufacturer (to eliminate the "bad batch" issue).
It's also possible that the crystal has been damaged by overdriving it. Be sure to observe any drive-level constraints specified by the manufacturer for the exact type/model of crystal you're using. In particular, the subminiature cylindrical crystals usually have maximum drive levels much lower than standard HC49/U crystals. For these, check the crystal manufacturer's data sheet for recommended circuit. A crystal that has been overdriven should be replaced....they are not "self-healing".
Also, be sure that any reset circuitry for the PIC is solid and cannot be triggered by power spikes, ESD or EMI.
Hope this helps. |
|
|
imbue
Joined: 28 May 2005 Posts: 13
|
|
Posted: Fri Jan 06, 2006 12:01 pm |
|
|
I've heard similar things from other people about crystals being flaky. Still, I have trouble blaming the crystal alone. Back when I was just learing electronics, when something wouldn't work, I would replace the microcontroller thinking it must be bad. Invariably, I would always trace the problem back to a mistake on my part. I've yet to have a truly bad componet.
I'm not sure about overdriving. The crystals I have are rated for 4.0 mW maximum. I don't know how to tell if I'm overdriving it or not. I just thought that all crystals were about the same, I guess.
I replaced the crystal in question, anyway, and I couldn't get the replacement to oscillate for anything. I replaced that one too and now it seems to work fine again, but I have a gut feeling that won't last.
Can anyone tell me if I'd be better off using a low frequency crystal and letting the PLL make up for it? I'm sure there's a trade off.
I think in the future I will use the four pin self-contained crystal oscillators and stay away from plain crystals. An extra dollar is not worth the helpless feeling.
Thanks for you help. |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Re: Crystal Problems - OT |
Posted: Fri Jan 06, 2006 8:20 pm |
|
|
imbue wrote: |
The crystals I'm using are 20MHZ, and the impedance is 20pf. I am using 22pf caps because that's what I have. Thanks! |
Try this:
If the crystal requires a 20pF load ( CL ) and you are using 22pF let's see what the load will be with 22pF.
As I don't know how much stray your circuit has, I'll assume 3pF stray
22 * 22
CL = ---------- + 3 so CL is 14pF
22 + 22
So choice of 22pF only loads the crystal with 14pF !
Which is lower than 20pF ! Perhaps you should try 33pF caps. ! |
|
|
imbue
Joined: 28 May 2005 Posts: 13
|
|
Posted: Sat Jan 07, 2006 1:29 am |
|
|
Thanks for your reply, but I'm not sure that I understand you. You are giving the formula for capacitors in series; I don't have any in series. I am just running each leg of the crystal to ground through 22pf. So there are only two capacitors in the circuit. Maybe I am just totally misunderstanding you, like I said before, I'm pretty new to all this.
Here are the crystal's stats from the manufacturer:
# Frequency calibration tolerance: �50ppm@25�C
# Operating temperature: -10�C to +60�C
# Drive level: 4.0 mW maximum
# Frequency stability tolerance: �50 ppm from -10�C to +60�C
# Shunt capacitance: 7pF maximum
# DN's demotes extended temp. (-40�C to 85�C)
# Frequency: 20.0 MHz
# Impedance: 20pF
Now I assumed that the last part (Impedance) meant that I needed two 20pf caps to make it work right (each cap connected to the crystal and ground). I was also under the impression the values weren't super critical, is this correct?
Also, I hooked up my oscilloscope to one leg of a capacitor, and I saw a very clean signal. I couldn't see any spikes, lines, edges, etc. It was completely sinuous. Because of the problems I've been having, this actually surprised me!
Thanks again. |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
Crystal type: Series or Parallel |
Posted: Sat Jan 07, 2006 12:09 pm |
|
|
Most PIC's use Parallel crystals.
It is a common misconception that the circuit in most PIC data sheets is a series circuit ... it is NOT. ! A series crystal would have NO capacitors.
If the Load Capacitor for your crystal is quoted as 20pF (I think you call this impedance !) and IF it is a parallel type crystal, then the formula I gave you is correct.
Most PIC data sheets warn against using Series type crystals, they are unstable and unreliable in the PIC circuit, it may explain why you are having problems ... That is IF your crystal is a series type.
Anyway the formula is correct. The trick is knowing the stray capacity of your circuit. You can measure it and get close. in the end you may have to adjust the final values of C1 and C2.
There are many tales of woe about prototype boards working fine and production boards being unstable or not working at all.... Take care when adding conformal coating, solder masks etc, the stray capacity may be higher.
The real way to test a prototype is to make it exactly the same as the production version including solder mask, coating, shields etc. And most importantly test it at all temperatures. if it is battery operated you should also test at lowest and highest Voltage. That may not have anything to do with the oscillator, but it may catch another part of the circuit that craps out at extreme ends of the expected temperature range.
Can you post the actual crystal type and manufacturer, or Digikey, Mouser part number?
Good luck.
Last edited by Hans Wedemeyer on Sat Jan 07, 2006 8:15 pm; edited 1 time in total |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1908
|
Re: Crystal type: Series or Parallel |
Posted: Sat Jan 07, 2006 12:37 pm |
|
|
Hans Wedemeyer wrote: | There are many tales of woo about prototype boards working fine and production boards being unstable or not working at all.... Take care when adding conformal coating, solder masks etc, the stray capacity may be higher. |
I can offer a similar tale of woe.
When I do the layout on a pcb, I always route the signal lines first, followed by power, finally fill in virtually all the unused areas with a ground plane, and make all my ground connections to this plane.
Very early in my pic "career" I did a very simple board just like I described above. I had a devil of a time getting the pic to run at all. Sometimes it would start okay, most of the time not. If I did get it to run, it would run for a few seconds, then stall. I found that a good hard twack with my finger on the board next to the crystal would usually get it working for a few seconds at at least.
Then I realized what I had done. When I placed the ground plane, it filled the area all around/amongst the crystal and the two crystal capacitors. Basically the very small separation between the crystal lines and the ground plane was a capacitor - a relatively big one - and it was enough to stop the crystal oscillation altogether. Once I figured this out, I took out my two crystal caps altogether and the thing worked like a champ.
From that point on, I always made sure to keep my ground plane away from my crystal and the crystal traces. No issues with crystals since then, either.
Hope this helps. |
|
|
mcafzap
Joined: 07 Sep 2003 Posts: 46 Location: Manchester, UK
|
|
Posted: Sat Jan 07, 2006 1:01 pm |
|
|
Worth reminding you that 'scope probes have associated capacitance too. I can no longer read mine, but I seem to remember 1M//20pf Sorry I can't recall the 10:1 type's impedance. |
|
|
imbue
Joined: 28 May 2005 Posts: 13
|
|
Posted: Sun Jan 08, 2006 3:54 pm |
|
|
Here is a link to where I bought these crystals. Jameco They don't seem to have too much information though.
I am sure that it's a parallel cut crystal, because they also sell series cut ones. One thing that confuses me is that Microchips datasheet lists the caps for a 20MHz crystal at 15pf each. I know that�s just a guideline, but it seems to be a big difference between 15pf and 33pf.
I don�t have ground planes or anything near the crystal, but I think I can relate to your story, newguy. It seems that when my oscillator did fail, a hard vibration would start it back up. Now since it has only failed a few times I assumed that it was a coincidence, but after hearing your story I bet that�s what woke it up.
When I scoped the circuit I had the probes set to the 10x setting. I�m not sure what this added to the circuit either. The waveform really did look great to me, though, probably just to confuse me even farther.
Now, how do I tell when my circuit's fixed, because when it's broken it can work for days at a time without problems. I guess I just have to wait it out?
Thanks for all your replies, guys. I'm learing a lot here. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 08, 2006 4:18 pm |
|
|
I wouldn't buy from Jameco. Who really knows what that crystal is ?
They don't list a real manufacturer.
Look at pages 915 and 916 from Digikey. These two pages show
just a portion of the ECS crystals that they stock. And they stock
many more manufacturers as well. Notice how each crystal is identified
with "series" or if parallel, with the load capacitance.
http://dkc3.digikey.com/PDF/T061/0915.pdf
http://dkc3.digikey.com/PDF/T061/0916.pdf
Furthermore, they give the manufacturer's part number and you
can go to the ECS website and download all their data sheets and
spec sheets on it.
You can also get all this data by going through their excellent online
search engine at http://www.digikey.com
It's actually better to do it that way than by viewing the catalog PDFs
that I posted above.
Digikey has a minimum order of $25 (US). So you may want to use
http://www.mouser.com instead. But their search engine or methods
are not nearly as good. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
ECS |
Posted: Mon Jan 09, 2006 8:42 pm |
|
|
imbue wrote: | Here is a link to where I bought these crystals. Jameco They don't seem to have too much information though.
I am sure that it's a parallel cut crystal, because they also sell series cut ones. |
PCM Programmer summed it up .... with Jameco you don't know wat you are getting.
You say "I am sure it's parallel.... because they sell series cut also"
Well that's no real evidence that what you got is correct. I also see where the "impedance 20pF" came from
The formula I quoted is from a data sheet I have from ECS... ! Sorry I don't have a link for it, but if you search the ECS web site I'm sure you can find it or something similar.
Getting the crystal/capacitors right is important if your design is going to be stable. ECS crystals from mouser.com or digikey.com only cpost $0.75 to $0.95 at most ! and remember to order a selection of small pF NPO capacitors so that you can swap them while doing tests. Just using 22pF is not good enough !
Good luck |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1908
|
Re: ECS |
Posted: Tue Jan 10, 2006 12:01 am |
|
|
Hans Wedemeyer wrote: | and remember to order a selection of small pF NPO capacitors so that you can swap them while doing tests. Just using 22pF is not good enough ! |
Amen to that. |
|
|
|
|
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
|