Author Topic: Oscillator issue  (Read 6853 times)

0 Members and 1 Guest are viewing this topic.

Offline mpicker21Topic starter

  • Contributor
  • Posts: 27
  • Country: us
Oscillator issue
« on: August 13, 2016, 12:15:11 am »
I built a basic binary clock a while back that has a speeding issue.  I did some testing and found that it gains a full 60 seconds every 4 hours and 15 minutes.  I wasn't able to try to troubleshoot it until now as I just got a Rigol DS1054Z.  I use a SN75HC4060 and a 32.768 kHz crystal as my time base.  I assumed that the crystal was doing something weird but when I look at it in the scope it's not as bad as I suspected.  With my math, based on the time gain, I am somehow getting a clock of 32.896 instead of 32.768.  That's an extra 128 Hz.  Looking at the output of the crystal on the scope I am seeing a pretty accurate 32.7671 kHz.  Looking at my CLK pins though I'm 32.907ish (close to my calculation).  I am seeing a strange overall oscillation on the crystal though that may account for the extra 128 Hz.  I have attached screen grabs from the scope.  Does anyone know what might be causing this?  My hunch is noise on the power supply, which is a 5V wall wart but I'm not seeing any significant noise there.  As a note, this is done up on vero board.
« Last Edit: August 13, 2016, 12:48:19 am by mpicker21 »
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Oscillator issue
« Reply #1 on: August 13, 2016, 01:32:11 am »
Is it possible that while you measure the crystal with the probe, the extra capacitance makes the oscillator come good?
Which exact chip did you use as you state SN75HC4060, but is it a 74HC?
What passives did you use around the crystal, perhaps it's not being loaded correctly, if so the frequency and stability will be off?
Did you use a cap close to the chip on the power rails?
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Oscillator issue
« Reply #2 on: August 13, 2016, 02:01:19 am »
As your clock is fast by 1 part in 256, I would think it's a digital problem rather than the clock frequency being out.
As bobaruni said, HC4060's supply decoupled ?
Are outputs QG or QH driving something.
.  That took much longer than I thought it would.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: us
Re: Oscillator issue
« Reply #3 on: August 13, 2016, 02:24:21 am »
Is your scope probe on x10?
A schematic would help greatly...
 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: Oscillator issue
« Reply #4 on: August 13, 2016, 02:47:34 am »
Is the circuit built on a solderless breadboard with messy "antenna" jumper wires all over the place?
 

Offline mpicker21Topic starter

  • Contributor
  • Posts: 27
  • Country: us
Re: Oscillator issue
« Reply #5 on: August 13, 2016, 04:47:56 am »
Is the circuit built on a solderless breadboard with messy "antenna" jumper wires all over the place?
This is on stripboard.  I tried to avoid traces longer than they had to be.  I did the best I could without getting a PCB done.  (I like the home gamer look.)  Pictures attached.

Is your scope probe on x10?
A schematic would help greatly...
The probe is on x10 and so is the scope.  I tried x1 and I think it actually made the crystal unstable.  (I'm still new to this thing.)  A schematic for the portion of the circuit in question is attached.  I initially had just the 22pF caps in the circuit as that seemed to work on the solderless breadboard but when I put it on the stripboard I needed more capacitance (14pF per side).

Is it possible that while you measure the crystal with the probe, the extra capacitance makes the oscillator come good?
Which exact chip did you use as you state SN75HC4060, but is it a 74HC?
What passives did you use around the crystal, perhaps it's not being loaded correctly, if so the frequency and stability will be off?
Did you use a cap close to the chip on the power rails?
You made a good point so I went back to the scope and probed both pins at the same time but got the same results.  Screen grabs attached.  One interesting thing is that the duty cycle on the CLK pins changed in this configuration but I get the same frequencies.

As your clock is fast by 1 part in 256, I would think it's a digital problem rather than the clock frequency being out.
As bobaruni said, HC4060's supply decoupled ?
Are outputs QG or QH driving something.
I have a bulk capacitor, 100uF, where the power comes into the board and another .01uF on the Vcc pin.  The bulk cap is very close to the chip as well.  I'm using the fast pulse from Qh to drive all the latches on the 3 counting chips.  It's late and my mind is getting fuzzy but it seems to me that since I'm not latching the count to the output of the counters, and triggering the reset pin and next counter, until that pin pulses that I'd actually be slightly slow rather than slightly fast, right?  Unless I've got some crossed trace somewhere that is causing that pin to pulse my clock as well...  I think you are on to something.  Oh and it is an SN74HC4060N from TI.

It's late and I'm struggling to wrap my mind around what I did with this circuit.  I really should have done the full up schematic back then.  Documentation, or lack thereof, will screw you every time.  I'll track down Qh tomorrow and try to post an update.
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Oscillator issue
« Reply #6 on: August 13, 2016, 07:18:49 am »
Way too much current on the XTAL, try raising the 24R resistor to a few K.
Or you can calculate the resistor as R = 1/(2*PI*F*C)
Where F = 32768 and C = the load capacitor in Farads (in your case 36p) Which gives you R = 134K
Maybe try 100k and see how you go.
« Last Edit: August 13, 2016, 07:42:03 am by bobaruni »
 

Offline joeqsmith

  • Super Contributor
  • ***
  • Posts: 11899
  • Country: us
Re: Oscillator issue
« Reply #7 on: August 13, 2016, 02:49:31 pm »
Good looking workmanship.

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3327
  • Country: gb
Re: Oscillator issue
« Reply #8 on: August 13, 2016, 04:22:41 pm »
As said you are significantly overdriving the crystal.  As well as making the frequency inaccurate, this can actually fracture the crystal by exceeding the elastic limits of the material.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: Oscillator issue
« Reply #9 on: August 13, 2016, 04:23:11 pm »
With my math, based on the time gain, I am somehow getting a clock of 32.896 instead of 32.768.  That's an extra 128 Hz.  Looking at the output of the crystal on the scope I am seeing a pretty accurate 32.7671 kHz.  Looking at my CLK pins though I'm 32.907ish (close to my calculation).  I am seeing a strange overall oscillation on the crystal though that may account for the extra 128 Hz.
A x10 probe has some capacitance and the frequency decreases when the 'scope probe is attached so more capacitance may help. Try adding an extra 10pF, where ever you had your 'scope probe on the crystal.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Oscillator issue
« Reply #10 on: August 13, 2016, 05:28:07 pm »
Sticking with the fast by 1 part in 256...

If you zoom in closer to the disturbances from QH shown in DS1Z_QuickPrint4.png, you might find one of them is big enough to count as the extra clock cycle, which would give you the extra 1 clock in 256.

Your oscillator shows disturbances from all of the switching/counting. So I'd bet on it being the 0.01uF not being big enough, especially with the capacitance that QH has to drive. Changing the 0.01uF to 0.1uF or 0.22uF will fix it.  :P

I don't know enough about 32K XTAL circuits to know if the values there are bad or not.
.  That took much longer than I thought it would.
 

Offline mpicker21Topic starter

  • Contributor
  • Posts: 27
  • Country: us
Re: Oscillator issue
« Reply #11 on: August 13, 2016, 08:41:17 pm »
Thanks for the recommendations. I was thinking more about how that Qh pin could be acting as an antenna as that trace runs the length of the board. I was going to probe that pin and the crystal to see if that odd shape correlates. I'm willing to bet that it's a direct correlation. To those mentioning overdriving the crystal, I am pretty sure that is true too. When I was reverse engineering my board last night I actually did a doubletake on that resistor because it seemed low. I am willing to bet that I grabbed the wrong multiplier out of my bin.

Right now the crystal is oscillating at 50ish MHz so I may have finally borked the crystal. I will be replacing that resistor and adding more capacitance to the IC. If I am lucky I can salvage this crystal. If not I will have to order a new one.

Thanks everyone again for the help. I learn a lot from you guys. I'll post an update when I get the soldering iron out and make the changes.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Oscillator issue
« Reply #12 on: August 14, 2016, 12:00:59 am »
This might help, attached.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Oscillator issue
« Reply #13 on: August 14, 2016, 12:54:31 am »
You can only solve one problem at a time, start with the oscillator then see where that takes you.
Just replacing the crystal (If it's now broken) and changing the 24R will (should) solve your problem, adding more capacitance around the crystal oscillator will de-tune the frequency.
Don't just add capacitance to the crystal as trial and error.
Use the crystal manufacturers specifications for load capacitance then calculate the series resistance based on the formula previously posted.
Looking at your oscilloscope trace shows that the oscillator wants to break out into overtone harmonics and it's very jittery.
A crystal oscillator should be a perfect sine wave without any visible jitter or noise.
The switching spikes seen in the trace should not effect the oscillator if it's oscillating properly, CMOS IC's have a fairy high immunity to noise on the rails.
 

Offline mpicker21Topic starter

  • Contributor
  • Posts: 27
  • Country: us
Re: Oscillator issue
« Reply #14 on: August 14, 2016, 03:03:20 am »
Danadak: Thanks for the guide. I did a bunch of reading on this topic back when I built this clock. I did some number crunching too but don't have the figures. I didn't have the appropriate tools back then to troubleshoot. I will have to do some math. I think I inadvertantly put that small resistor in there though.

Bobaruni: I didn't plan on doing both at once. Also, the capacitance I was going to put in was going to be on the power input side, not the crystal. In hindsight, the reason that it worked on the breadboard but not the stripboard, before adding extra crystal capacitance, may have been that I slipped that wrong resistor in during the transition. That was 6 months or so ago. I'm always learning from mistakes.
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Oscillator issue
« Reply #15 on: August 14, 2016, 04:27:48 am »
Nothing to feel bad about, we are all still learning as electronics is forever evolving and often the best lessons are through mistakes.
At least you are giving it a go and you should feel good about that as many people get scared an that's what stops them from learning and achieving.
 

Offline mpicker21Topic starter

  • Contributor
  • Posts: 27
  • Country: us
Re: Oscillator issue
« Reply #16 on: August 14, 2016, 05:30:36 am »
The bad news:  Apparently I'm resistor band dyslexic.

The good news:  I wasn't over driving the crystal as bad as we thought.  I did, in fact, have a 100k resistor in where I thought I had the 24 ohms.

More good news:  I get a beautiful looking sin wave right now out of my crystal.

More bad news:  The frequency of the crystal is now 50MHz or so.

I'll have to get a new crystal.  I may have accidentally created a short and fried it.  I've abused it pretty badly mucking around with it like this.  Unfortunately I don't have a nice store I can run off to to get a crystal so I'll have to get it from Mouser.  I may as well get a few and try to get as many parts as I can for that power supply project I have started planning.  It's frustrating paying 5 bucks in shipping for a part that costs less than 1 dollar.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf