32kHz crystal issues

No, no! (I'm looking at the picture) For even a half-assed bypass you need to insert one lead of the cap there directly next to pin 13 (Vdd), with the other lead to Vss. That makes a huge difference on a solderless breadboard--I've seen it.

But, the GPIO pin is obviously the problem, coupling into that poor, innocent oscillator's input.

You could consider a) reassigning that GPIO signal to another pin, b) or slowing its slew rate with an R-C... {or c) air-wiring pin 11 and seeing whether its coupling to pin 10 is still excessive}

Anyway, you've identified the problem, time now for the fix.

Cheers, James Arthur

Reply to
James Arthur
Loading thread data ...

Didn't do anything to the signal. I tried a couple of different things. Plus, the Vdd line doesn't show any glitches in sync with the GPIO pin.

Yeah, but... coupling how? Here's the scope:

formatting link

With the 10x, that's a 0.18v step for 7.6uS. It looks DC coupled. Could the 32k xtal circuit be so high impedance that even a few pF couples like that?

Those pins next to the 32k oscillator are also for the primary oscillator (not used), I wonder if they have different coupling characteristics within the chip?

Reply to
DJ Delorie

Capacitively, pin-to-pin, but principally via the breadboard I'd assume.

Consider: that's a 50mV step into roughly 20pF. A stray of 20pF x

50mV/(3.3V logic swing) = roughly 0.3pF of cross-coupling needed to produce that. You mentioned earlier that your solderless breadboard supplies 2pF.

I s'pose 'tisn't usually a problem unless the GPIO transition comes when the oscillator input's close to its threshold, and is of the opposite polarity (same polarity just triggers the oscillator's output edge early, while opposite polarity produce a glitch).

Absolutely yes! For example, a 10 megohm oscillator input Z (not unusual) x 20pF yields a 200uS time constant ! (But *your* waveform suggests about 4uS t/c, best I can tell, suggesting a Z near 200K. Your earlier reports also indicate a low-ish input Z.)

Another possibility is d.c. coupling, leakage between the pins. Again, that could be the solderless breadboard. A little dirt might explain that.

But it's most likely breadboard capacitance, methinks.

Note that the breadboard shunt capacitance provides a pulse of negative feedback from the oscillator's output pin immediately after the oscillator's input pin crosses threshold--that's nasty too.

Maybe. Dunno.

Cheers, James Arthur

Reply to
James Arthur

According to the microchip PIC24F datasheets i found, the pin termination for sosco is 15 pF to Vss, and for sosci 50 pF to Vss and 464 ohms to Vdd/2 (say a pair of 910 of resistors to Vss and Vdd). Put what high value resistor you want parllel to the Xtal. Putting 50 ohm resistors to any other place will probably kill oscillation altogether.

--
 JosephKK
 Gegen dummheit kampfen die Gotter Selbst, vergebens.  
  --Schiller
Reply to
joseph2k

Thanks for the details. I'll move that signal away from the OSC pins and ground that pin, and do the usual EMI stuff on the final board, once I'm done trying other resistor values to see if I can get the signal tweaked toward center.

Well, that's a coincidence. I just picked the pulse that showed up best on the screen ;-)

Reply to
DJ Delorie

its a lot more than a few pf, I measured the capacitance once it was between 10pf and 30pf depending on the type of breadboard.

wich realy is horrible for things like this.

I would stop the adjacent pins ineterfering anywich way you can ie disable the output/lift the IC pin and just see if the oscillator works properly then. then go for the proper pcb.

Colin =^.^=

Reply to
colin

Yes.

Sometimes increasing the drive resistor so that it interacts with the capacitors making more phase shift than normal will stop a higher spurious mode.

Also over driven crystals tend to shift up in frequency.

Reply to
MooseFET

I can't find that--can you say where you found it?

Thanks, James Arthur

Reply to
James Arthur

I think the crystal's on frequency, but his glitches are giving him extra counts, i.e., on occasion a glitch produces two counts (instead of one) per 32,768 cycle.

Cheers, James Arthur

Reply to
James Arthur

behaved

It could be. If he triggers his scope from a known good 32768Hz, he could tell. He can trim the frequency to stop the waveform, and then check the count he gets.

Reply to
MooseFET

Good idea.

In this particular case he's located the glitch-source, so if he fixes the glitches--which he has to do anyhow--the whole problem will likely just go away.

But, in the general case your idea is a slick way to prove the existence of glitches when you're getting extra counts, a way that would be especially useful in situations where you can't see 'em.

Cheers, James Arthur

Reply to
James Arthur

For that breadboard the makers specify 0.8pF strip to strip. I've also measured it at 0.8pF. Stray capacitance signal coupling on these breadboards is minimal. Most problems are due to the use of long jumper wires and high impedance inputs.

--
Posted via a free Usenet account from http://www.teranews.com
Reply to
john jardine

It was within 4 pages (40 items) of the initial search string "PIC24F". It was a Microchip datasheet (AC characteristics section). QFP package if that makes any difference. I might have misread it though.

--
 JosephKK
 Gegen dummheit kampfen die Gotter Selbst, vergebens.  
  --Schiller
Reply to
joseph2k

Ok, I did some experimenting.

First off, I realized something important - the chip has an internal

2.5v regulator for it's core logic, so the DC offset isn't as suspect as it could have been.

I swapped the GPIO next to the OSCI return with a different GPIO that doesn't change once the system's running, and that got rid of the interference. There doesn't seem to be interference from the next pin over, which is the high speed OSCI, and which is also a GPIO with lots of edges.

I replaced the 330k resistor with a 560k resistor. It didn't change any of the DC offsets, but it did reduce the drive Vpp some (and increased the startup time from 1s to 3s ;)

With either resistor, the drive phase and return phase are not 180 degrees out of phase. More like 120, as if the filter wasn't pushing it around enough. However, the return peak corresponds to the first part of where the drive signal hits gnd; maybe an even bigger resistor? Nope, even 1M doesn't change the phase. I guess I'll have to tune it once it's on the final PCB and the stray capacitance is finalized, yes?

Meanwhile, I'm going to write some software to internally compare the

32k clock to the FRC clock so I can see what effect the scope probes have.

DJ

Reply to
DJ Delorie

If you need less disturbance from the probe and don't have a FET probe at hand, you might try a 100:1 probe instead of the usual

10:1 probe. I have seen situations where the 100:1 probe disturbs the working circuit less. Needless to say, this doesn't work well with low-level signals.
--
Guy Macon
Reply to
Guy Macon

My "scope" is a cheap parallel-port 32Ms scope. It's not sensitive enough for a 100x probe.

Anyway, I relayed the RTC's 1s interrupt to a GPIO pin and measured it with the logic analyzer (500Ms/s compressed :). Assuming the LA is "perfect" (ha), the 32k crystal is fast by 36ppm at the moment (and reasonably stable at that). That's 3 seconds/day, well within the adjustability of the RTC, and probably something I can tune with capacitors on the PCB later.

Anyway, I attached the scope probe and the RTC ran *way* slow (relatively speaking, still ppm), so added capacitance will definitely slow the clock. Unfortunately, the spec sheet for the crystal doesn't have a cap/freq curve, so it will be trial and error.

Of course, I'll have to compare it to a more precise time standard at that point.

Reply to
DJ Delorie

Thanks for your reply. I scanned the PIC24FJ64GA004 datasheet and the PIC24 Family Reference Manual's oscillator chapter with no luck. 464 ohms sounds super-heavy, so I suspect that must be a misprint, but I couldn't find it anywhere. Luckily DJ's in clover now, so no worries.

Cheers, James Arthur

Reply to
James Arthur

Good--glitch problem solved.

Not that you need it, but here's a poor man's low-frequency FET probe you can kludge together just in case...

|\\ FET-input op-amp. | \\ LF356, TL082 etc. >--o--------|+ \\ | | >---o------->

| .-|- / | R1 [10M] | | / | | | |/ | | C1 | | | 100n | | o--||--o---------' | | R2 [10M] | === GND

Run it on +/- 12v. It's simple, not great, but way better than your 'scope for probing that 32KHz clock.

Cheers, James Arthur

Reply to
James Arthur

I was wondering how to do that. Thanks!

Reply to
DJ Delorie

For future archive-searchers, I wanted to note that the step-then-R- C waveform in DJ's 'scope picture was riding on a big sinewave, which I neglected.

Accordingly, the R*C time constant was a *lot* longer, and the PIC

32KHz oscillator's input impedance is *much* higher than I guessed above, more like 1-to-2M.

Cheers, James Arthur

Reply to
James Arthur

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.