Load two frequencies into an AD9837 and switch between them. On a scope triggered by the SPI chip select, some changes occur near a peak and others occur partway up a slope. Check what the test is meant to preserve. A continuous sweep should continue from the phase the waveform has already reached while changing the rate of advance. A repeatable excitation burst can require a particular starting phase on every trigger. The same DDS can be part of either design, with different acceptance checks.
Frequency and phase travel through different registers
In the AD9837 block diagram, FREQ0 and FREQ1 supply the increment to the same 28-bit phase accumulator. With reset released and accumulation running, the selected word determines how far the phase advances on each MCLK cycle. Imagine a pointer moving around a dial. Selecting a different frequency changes the size of each following step. The data sheet calls the selection bit FSEL, at D11 of the control word. Keep PSEL, RESET, the sleep settings and the waveform mode fixed to test a change in FSEL alone.
PHASE0 and PHASE1 hold separate 12-bit phase offsets. PSEL chooses the offset added to the accumulator output, independently of which frequency register supplies the increment. For example, write zero to PHASE0 and 1,024 to PHASE1. Changing PSEL alone adds 1,024 ÷ 4,096 × 360°, or 90°, to the phase seen in the ideal sine. If the driver flips FSEL and PSEL together, decode the complete control word before attributing the observed phase step to the reference oscillator.
Put numbers on the change
Assume an exact 12.8 MHz MCLK and a B-grade device. Program 800 kHz into FREQ0 and 1.6 MHz into FREQ1, with both phase offsets at zero. The tuning word K is output frequency divided by MCLK times 228. The two words are 16,777,216 and 33,554,432. Both are exact integers here. A complete write sends 0x4000 then 0x4400 to FREQ0 and 0x8000 then 0x8800 to FREQ1. Table 7 also requires consecutive complete 28-bit writes to alternate between the frequency registers. Changing the selection between already-loaded words is a control register write.
In the ideal accumulator, the first setting advances by 22.5° per master clock. Suppose the switch takes effect after five such increments starting from an illustrative zero. Phase has reached 112.5°. The next advance is 45°, taking it to 157.5°, followed by 202.5°. If the same control write also selected the 90° offset in the earlier example, the 157.5° accumulator phase would appear as 247.5°. This calculation describes the sequence once the new selection is effective internally. It does not assign 112.5° to a particular edge on the SPI bus. The DAC, fitted filter and probes remain part of what the scope shows.
Decide whether to test continuity or a repeatable starting phase
For phase continuity, capture MCLK, FSYNC and VOUT at the same time. If the scope has digital channels, include SDATA and SCLK for control-word decoding. Test both fixed frequencies first. Then switch repeatedly and fit each side of the transition using the steady portions of the waveform. Compare the inferred phases at the estimated transition time and state the permitted error. An automatic period counter may average a cycle that crosses the transition with complete cycles before or after it. Record the effect of the fitted output filter and any instrument filtering when assessing the phase relationship.
For a repeatable starting phase, follow the manufacturer's initialization sequence. Assert RESET, load defined values into the frequency and phase registers, select the intended pair and schedule reset release in relation to the trigger. The data sheet says reset brings the relevant internal state to a midscale output while leaving the frequency, phase and control register contents intact. The DAC output appears after seven or eight MCLK cycles from reset release under the described operation. At the example 12.8 MHz, that is about 546.9 or 625.0 ns. The 78.125 ns difference between one clock cycle and the next alone exceeds an illustrative 30 ns trigger-to-output variation budget. Examine the timing relationship to MCLK and overlay repeated bursts at the receiving point to verify both starting phase and timing spread.
Keep separate production tests for the two cases. For a continuous change, write only the selection bit and record both frequencies and the fitted phase difference. In the restart test, run the same initialization and release sequence on every pass and log trigger-to-first-usable-cycle time. Match the receiver and filtering when comparing old and new boards, and check both steady frequencies before interpreting the transition.
Specify the speed grade and keep the traces tied to the parts
The manufacturer specifies a 5 MHz master clock for the A grade and 16 MHz for the B grade. A 12.8 MHz design needs the appropriate B-grade ordering configuration. Check the actual input thresholds, high and low pulse widths and period against the supply conditions and the waveform at MCLK. When requesting a replacement oscillator, keep its full part number, supply and output interface with the measured MCLK, fixed-frequency checks, captured FSEL and PSEL transactions and the acceptance method. Purchasing can then match the speed grade, and engineering can trace a phase change to the frequency selection, phase offset or analog output path.
Manufacturer reference · Analog Devices AD9837 Rev. A, Tables 2 and 7 and Figures 20–23
