LeapSecond.com
picPET -- Precision Event Timer, more versions

26-Oct-2013

Introduction

The picPET™ has proven to be quite a useful little stand-alone chip. Now and then a special need arises and I spin a new version of the firmware, based on the same 8-pin DIP pic12F675 chip.

Most people get the original pP01 since it works perfectly with either native serial or serial/USB adapters.

If you are making your own PCB using a MAX232 (serial) or FTDI (USB) chip, consider pP02 instead.

If you are also interested in timing either the rising or the falling edge of a signal, consider pP05 instead.

picPET (pP01)

The original picPET. Simple and easy: power, ground, and 10 MHz clock. One rising edge event input and one RS232 serial output. About as simple a T2D or TDC (Time to Digital Converter) or TSC (Time Stamping Counter) or CTSC (Continuous Time Stamping Counter) you can imagine.
;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<-
;            RS232 output  <----|3  01  6|<-
;                             ->|4      5|<----  Event pulse input
;                                --------

picPET (pP02)

Some users want to drive MAX232 converter chips in order to produce a true +/- 10 V RS232 output (suitable for long serial cable runs). These MAX232 chips require an inverted RS232 signal. Other users want to convert RS232 to USB with FTDI chips. These chips also prefer an inverted RS232 signal.

One solution is putting a transistor or inverter IC between the picPET and the MAX232 or FTDI. That works, but a simpler solution is pP02, which allows you to select normal or inverted RS232 output polarity; and no external level-shifting hardware is required

;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<+---
;            RS232 output  <----|3  02  6|<+---
;            RS232 invert  o--->|4      5|<+---  Event pulse input
;                                --------
The other change in pP02 is that weak pull-up are enabled on pins 7, 6, and 5.

picPET (pP03)

This one was a special test. Please ignore.
;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<~---  Signal input
;            RS232 output  <----|3  03  6|<~---  Reference/ADC input
;            RS232 invert  o--->|4      5|---->  Event output
;                                --------

picPET (pP04)

One customer wanted not only a timestamp but also a capture of 2 digital pins; sort of a timestamping logic analyzer. Please ignore.
;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<+---  Bit0 input
;            RS232 output  <----|3  04  6|<+---  Bit1 input
;            RS232 invert  o--->|4      5|<+---  Event pulse input
;                                --------

picPET (pP05)

I like this picPET. It has the configurable RS232 polarity feature of pP02 (pin4). You can configure if the event input triggers on the leading or the trailing edge (pin7). And it allows you to optionally zero/synchronize the counter (pin 6).

By default (pin 4 high, pin 6 float high, pin 7 float high), it is pP01.

;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<+---  Rise(1)/Fall(0)
;            RS232 output  <----|3  05  6|<+---  Sync(0)
;            RS232 invert  o--->|4      5|<+---  Event pulse input
;                                --------

picPET (pP06)

This picPET captures events and also the analog voltage of a pin at the instant of the event. Please ignore.
;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<~---  Analog sample
;            RS232 output  <----|3  06  6|<+---  Sync(0)
;            RS232 invert  o--->|4      5|<+---  Event pulse input
;                                --------

picPET (pP07)

This picPET is used in conjunction with a charge/discharge pulse interpolator circuit. Please ignore.
;                                ---__---
;                5V (Vdd)  +++++|1      8|=====  Ground (Vss)
;            10 MHz input  ---->|2  pP  7|<~---  Analog sample
;            RS232 output  <----|3  07  6|---->  Ready output
;            RS232 invert  o--->|4      5|<+---  Event pulse input
;                                --------

picPET clock rate trick

A picPET normally takes a 10 MHz clock and generates timestamps with 100 ns LSDigit resolution and 400 ns granularity. The timestamps are output at 19200 baud using normal RS232 polarity and 5V TTL voltages. The maximum output rate is about 110 timestamps per second.

Since the PIC processor and picPET firmware is fully synchronous, some perfectly safe, predictable, and useful things happen if you exactly double or half the clock speed.

One trick is to drive the chip with a 20 MHz clock instead of 10 MHz. In this case the LSDigit resolution is 50 ns, the granularity is 200 ns, the baud rate is 38400, and the maximum output rate is about 225 timestamps per second.

Similarly one can use a 5 MHz clock -- the serial output is 9600 baud, and other parameters scale accordingly.

The PIC supports clocks rate from 0 (DC) to 20 MHz.

picPET reciprocal clock trick

Normally the 10 MHz clock with which you drive a picPET is the reference frequency. This might even be 10 MHz from a super accurate GPSDO. The periodic events from some DUT (Device Under Test) are then measured against this reference. If the DUT is itself another oscillator you can divide it down to 100 Hz or 10 Hz or 1 Hz (1PPS) and feed it into the picPET event input. The result is a nice data stream showing gradual phase drift over time. From this one can calculate frequency offset, stability, and drift rate of the DUT. It is assumed the error is due to the DUT (event input) and not the REF (GPSDO 10 MHz clock input).

If you have a GPS 1PPS and if the DUT is 10 MHz, the other trick is to let the DUT drive the picPET clock and feed the super accurate GPS 1PPS into the picPET event input. The will also provide a nice data stream showing gradual phase drift over time. From this one can calculate frequency offset, stability, and drift rate of the DUT. It is assumed the error is due to the DUT (clock input) and not the REF (GPS 1PPS event input).

Both cases are equivalent. A picPET, like any other phase comparator or frequency counter, is inherently just a ratio device. One can never measure absolute frequency: instead you simply measure DUT frequency relative to the REF frequency. So it doesn't matter if the reference is the slow-frequency (event) being timed or if the reference is the high-frequency (clock) used for timing.

picPET farm

Given the above one can imagine measuring a dozen 10 MHz XO or OCXO at the same time. Each oscillator drives its own picPET and all picPET's share a common GPS 1PPS event input. The individual RS232 data streams are collected and the long-term performance of each oscillator is thus simultaneously and independently measured. Only a GPS 1PPS time reference is required (not a GPSDO frequency reference).


See LeapSecond.com PIC project page.
Return to LeapSecond.com home page.
Comments/questions to tvb.