3
\$\begingroup\$

I'm working on a project which uses a PIC with a 32kHz watch crystal attached to Timer1. Unfortunately, the chip I'm currently using, PIC16F1827, shares the T1OSI & T1OSO pins with ICSPCLK & ICSPDAT.

I'd like to be able to use the ICSP, ideally without having jumpers or other manual management.

What would be the best way to isolate the crystal from the ICSP?

The data sheet, and other notes I've found around this, are not specific, obviously given the wide range of circuitry that might be connected to the ISCP pins.

It is recommended that isolation devices be used to separate the programming pins from other circuitry. The type of isolation is highly dependent on the specific application and may include devices such as resistors, diodes, or even jumpers.

Edit to add: I believe the crystal is a DT-26 model, from MEC.

\$\endgroup\$

3 Answers 3

4
\$\begingroup\$

With a decent programmer that has sufficiently low impedance drive on PGC and PGD (our USBProg has 150 Ω, for example), a crystal between those two lines shouldn't interfere with programming.

However, check the crystal specs. The problem is that ±5 V accross the crystal, especially something low power like most 32768 Hz crystals, could damage it. Since the crystal is high impedance relative to the programming lines, even at its resonant frequency, you can put a resistor in series with it. It's can't be so high as to cause a meaningful phase shift at 33 kHz, but maybe there is a value between that and where it can still protect the crystal. Again, the key is the crystal datasheet. If necessary, ask the crystal company if it is OK to put ±5 V accross it at arbitrary frequencies.

Added in response to datasheet:

It says the crystal effective series resistance is 22-40 kΩ and that the max drive level is 360 nW. Those together imply only 89 mV, but that would be what should be accross the crystal at the resonant frequency. It can probably tolerate much more off resonance, but that is of little use since you can't guarantee the programmer won't happen to produce signals near 33 kHz between PGC and PGD for long enough to be a problem, and you don't know what "near" and "long enough" are.

So yes, it appears you do have a problem that needs careful consideration. It doesn't look like there will be any easy answers, just annoying choices. The first step would be to talk to the crystal manufacturer and find out what you can really get away with when you're not expecting the crystal to be producing good timing. Normal operating limits and absolute maximum limits can be quite different, and this datasheet is rather vague on the specifics.

\$\endgroup\$
1
  • \$\begingroup\$ I've added what I think is the data sheet for the crystal I have. I'm not sure if there's enough info on there to determine anything useful in this context. I'm also using a PICKit 3, the manual for which only mentions "Clock and data signals are in High-Impedance mode (even when no power is applied to the PICkit 3 programmer/debugger system)". Any guidance on a thumb suck resistor value to start with? It's all a bit black magic to me at the moment. \$\endgroup\$
    – ptomli
    Commented Jun 20, 2012 at 12:13
4
\$\begingroup\$

Mike rightly says that the crystal is high impedance, but I would still isolate it since the maximum allowed drive level of these tuning fork crystals is usually 1 \$\mu\$W. That's for resonance, but I don't know what a high amplitude logic level signal will do to the crystal.

I would use switches with the lowest possible on-resistance. Routing seems to be more critical than I thought, then an analog switch in a 1.45 mm MicroPak, like the FSA1157, is better suited than a big reed relay.

\$\endgroup\$
2
  • \$\begingroup\$ Routing is critical for 32.768 crystals. Because they operate at extremely low power they are prone to noise pickup. See TI document: ti.com/lit/pdf/slaa322 \$\endgroup\$
    – markrages
    Commented Jun 20, 2012 at 19:20
  • \$\begingroup\$ @markrages - I stand corrected. Thanks for the interesting link. \$\endgroup\$
    – stevenvh
    Commented Jun 21, 2012 at 4:23
3
\$\begingroup\$

The crystal will not affect programming as it's a high impedance device, however you should test to see if 5V waveforms during programming have any damaging effect on the crystal

\$\endgroup\$
1
  • \$\begingroup\$ Without a scope available I suppose the only way I could test is to try it and then see if, over time, the clock is notably affected. Don't mind busting one or two if that's what it takes. \$\endgroup\$
    – ptomli
    Commented Jun 20, 2012 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.