The ideal model for this function will be one node with some external circuit on one pin. Our examples will use minimal circuitry, such as a single resonant device connected between a single pin and ground.
The magic in these examples comes from our uncommon I/O pin electrical characteristics; from our computers that are fast enough to implement software defined I/O, generically referred to as "bit banging", at uncommon speeds; and from an architecture that permits us the convenience of employing an entire computer to attend to the duties demanded at a single I/O pin.
In the following sections we will explore the use of external crystals and R/C networks.
Using a GA144-1.10 (proto chip #004) in socketed test board #3 with Vdd at 1.80V, we connect this crystal between pin 16 (signal 300.17) and Vss; as initially tested there are about 1.25" of wire (30 nH) between the crystal and Vss, and about 2.25" of wire and PCB trace (57 nH) between the crystal and the chip pin.
Our motivation for using one pin rather than two, and for omitting other parts, is to prove that we can do without these things. Our view is that additional parts are only justified if they earn their keep, which includes any additional energy they may require by their mere presence.
Initial investigation begins using our Interactive Development Environment (IDE) to program the chip and test the node under test. We also need to see what is going on at the pin, and we'll continue to need this until we are certain we can start the crystal successfully. For this purpose we connect a Tektronix P6131 10:1 passive probe (10 Megohms, 10.8 pF) to the "high" leg of the crystal about 1/4" from the can, and observe it using an analog input on an H-P 1631D logic analyzer (minimum sample interval of 5 nS.)
Our strategy will be to have the node under test stimulate the crystal with a given number of cycles of a square wave whose period is timed by a different number of iterations of an empty unext (micronext) loop. The code being used gives a resolution of one micronext iteration, or roughly 2.5 nS, for the period as a whole. When the desired number of square wave cycles has been completed, and the last phase driven was low / Vss, the node will immediately set the pin to high impedance (250 megohms, 2.8 pF, plus, for now, the scope probe and wire/board parasitics.) We will watch the pin throughout the series of excitation cycles and will then look for a signal immediately following; the excitation square wave's period will be adjusted, manually, 2.5 nS at a step, until we see oscillation.
Since we may need to stimulate the crystal for a long time to impart the required amount of energy, we will use signal 300.1 as an output which goes high at the end of the stimulus phase when the crystal pin goes to high impedance; this may be used for scope triggering when the period of interest begins.
This diagram and phot reflect the initial test set-up:
The initial tests will use this code for node 300:
For the crystal frequency of 32.768 KHz, the period is 30.518 microseconds. At roughly 2.5 nS per unext iteration, the period would be roughly 12,207 loop iterations per cycle at typical room temperature. In reality the number should be a bit smaller than this because of the time required for the other work done during each stimulation cycle.
For each of the following tests we will manually try a range of frequencies, using
sweep to search for the crystal's resonance. This range will be shifting as the temperatures of the chip and the room vary, so some patience will be required.
Initially, we try 50 cycles of stimulus. The following trace shows no oscillation:
This is not what we need to see; even mechanically banging on the crystal should get it to oscillate at its resonant frequency with low amplitude. So we speculate that we simply have not put enough energy into it with this small sequence of square waves. Increasing the loop count in
try1 from 50 to 200, and setting the scope to trigger on the rising edge of 300.1, we obtain the following:
This is more like it! With more searching the resonance can be sensed, but the most we are getting out of the crystal is on the order of 100 mV peak to peak. Nevertheless, it is clearly resonating, given that we are seeing a signal at the correct frequency.
Increasing to 1000 cycles, we found the resonance; the maximum signal increased to +500, -125 mV and the resonance seems to be two or three of our period durations wide, which bodes well for our being able to automate this process! Now we go to 5000 cycles and are able to put enough energy into the crystal that it is exceeding our supply rails:
Interestingly, this resonance continues for quite a long time, even though the protection diodes are extracting energy each cycle. Further interactive experimentation followed, varying the start-up method, leading to these observations:
Now that we know it will be feasible to start the crystal under program control regardless of the variables affecting our timing, we need to develop and test that program and then to implement the code for replenishing the energy of the crystal so it will oscillate indefinitely. Along the way we will be seeking ways to minimize the energy consumed in both starting and sustaining the oscillation.
The first step will be to use signal 300.17 as a super high impedance scope probe, copying what is seen on that pin to 300.1 where it may be viewed on a scope without loading the crystal down any more than it will be when operating. We'll use this capability whenever we need to check what is going on without that relatively low impedance passive probe mucking up the data; it is one of the amazing capabilities of our architecture to actively probe a signal under actual operating conditions without perturbing that signal in any measurable way.