Show by Label

Friday, August 23, 2019

Frequency Generator with fast edges

This post describes the building of a 20MHz frequency generator with a 1-2-5 frequency selection down to 1 Hz through a rotary decoder. The frequency generator is a stable high precision 5MHz oscillator.  The device also has fast rise (<=1ns) output edges that are generated through a Fast Rise assembly taken from a Tektronix PG506 Calibrator. The PG506 was used by Tektronix engineers to calibrate instruments. I used it extensively in my earlier career at Tek.

When I finished my GPSDO project, described in other post, I made that very precise 10MHz signal available as the master clock for this instrument.

The reason for this design
When I started to investigate the DIY build of a differential probe, see one of my other posts, I needed a fast edge pulse to measure the bandwidth in lieu of using much better equipment that I don't have. I also wanted to have a precise pulse generator with many frequencies, analog to the PG506, to measure and calibrate instruments or help in prototyping circuits.

For about 40 years, I held on to a Fast Rise Board assembly from a PG506 dating back to my time at Tektronix. The unit was defective coming out of a unit that was still under warranty (actually blown up by the user) and could not be repaired without some significant surgery. With some help I was able to fix it. For a long time I wanted to reproduce part of the PG506 Calibrator to test and adjust DMM's and oscilloscopes and although I even had a prototype for the Standard Amplitude amplifier up and running, I never saw the real need to spend some significant money on the required precision parts to finish it.

During this development I already built a PIC-AXE program to control the frequency selection so the time was right to put it all together. The main controller for the instrument is a PIC-AXE 14M2, and I use a second 18M2 controller to serially drive the LCD display. The PIC-AXE chips are very easy to use and are programmed in BASIC. PIX-AXE has a great Software Development Environment (SDE), which I think is even better than the Arduino SDE.

Please keep in mind that this is a quick-and-dirty "put together". Dealing with fast pulses with frequencies at 20MHz on proto-board are typically not very forgiving for glitches due to the fast switching of devices, and this is no exception. When (if) I decide to build a final version, I will have to make a proper PCB with power and ground planes and do a much, much better job at decoupling.
[Update: I did build a PCB, read on]

The building process
In any case, if you're interested, here is the design that I put together.

Clock generator

Above is the circuit diagram. Below is a picture of the oscillator I'm using. It's an old unit that was in my parts collection for 40 odd years as well. It was calibrated and measured to deliver 5,000.0021 KHz at 27 degrees Celsius. That's only 2.1ppm by the way.

A clock of 5MHz does not really work well in a 1-2-5 divider sequence, so I used a PLL chip to multiply the 5MHz oscillator output to get a 20MHz clock. The output of the 5MHz oscillator also goes to the front panel through a few buffers.

Because of the constraints of the enclosure, I mounted it upside on the top cover so it's still in the proper position. It's not "ovenized" but encased well to prevent wild ambient temperature fluctuations. The designers must have designed it with certain temperature parameters in mind, so I didn't want to mount it on its side or upside down.

Frequency Selection
The 20Mhz oscillator signal comes in at the top left of this diagram. It is divided by 7 74LS390 decade counters (two per package) into the main frequencies. All the outputs go to an 8-input multiplexer, a 74LS151. The selection of the 8 inputs goes through 3 inputs (A, B and C) and are driven by the controller. The output of the multiplexer then goes through a divider section of two 74LS109 flip-flops that divide the selected frequency through 2 or 4 to get the intended 1-2-5 frequency selection sequence. The divider outputs are selected through three OR-gates, who are also driven by the controller through NOR gates. The output of the OR-section is buffered and goes to the Fast Rise board, and also the the output BNC connector. (one still to-do is to replace U11.6 with the spare F02 and add that F04 gate in parallel to the output buffer section to get a bit more diving capability)

The controller also drives transistor Q1, which is used to activate a small relay. The relay switches the positive and negative power to the Fast Rise board. The Fast Rise board gets very warm when used, and that does not work well with a precision oscillator, so I decided to switch it off when not used, similar to the operation in the PG506. The zener diode is used to lower the 16.5V to the 12V DC for the relay.

CPU Circuit
The main controller circuit is quite simple. On the top left is a stereo connector that is used to program the device in-circuit, through the PIC-AXE USB to serial cable. The main 14M2 controller sends out a serial stream to the display controller, which is an other PIC-AXE controller, a 18M2 version. The main outputs of the 14M2 controller are the ports that drive the mux frequency selection and the /1 /2 and /4 step selection, in addition to driving the power for the Fast Rise board.
The selected settings are transmitted over a serial interface to another PIC-AXE controller on the LCD board section, and that drives the LCD display.
Lastly, the controller also deals with the rotary encoder. Pushing the rotary encoder button toggles the Fast Rise board power. Turning it left or right will select the output frequency.

Display Circuit
The display circuit consists of a PIC-AXE 18M2 controller that takes the serial input data from the main processor and multiplexes that to a typical LCD display. Due to space requirements, I selected an 8x2 LCD display. The code for this controller is a standard program that can be downloaded from the PIC-AXE site (Serial LCD). I used a ribbon cable to connect the display controller to the LCD display on the front panel.

DC Power Circuit
Due to space and noise considerations, I used an external 15-0-15VAC 2x300mA transformer. I have a number of these transformers in various voltages and housings and use them to power several of my tools. They all have 4mm test lead connectors, and I use a 3-pole DIN connector to connect the AC voltages to the power board.

For this instrument, I need three different voltages, +5V for all the logic, and +16.5 and -16.5 in addition to +5V for the Fast rise board.

With the 1.000uF capacitor (C4) in the positive supply side, there was a mains ripple on the +16.5V output when the Fast Rise board was activated. The Fast Rise board consumes a lot of power from the +16.5V and the +5V supply. The raw AC supply sagged to just below the headroom of the LM317, creating a hum on the positive High Rise pulse. Using Schottky diodes to create more headroom just didn't do it, so I added a 3.300uF in parallel to C4 and that fixed that problem. When (if) I decide to turn this circuit into a real PCB, I will redesign the power section and use high efficiency/low drop regulators and do a better job decoupling.

PG506 Fast Rise Board
The design of this circuit is a typical testament to the skills of the Tektronix analog designers, that were among the best in the industry in those days.

The code
The code for the main controller and the serial LCD driver can be found on my Github site: Frequency-Generator

The various parts as I built them look like this:

This is the power board. The little black square is the switching 5V regulator. I don't show the extra 3.300uF cap here, that was added later.

The Fast Rise board is at the very top. To the left is the front panel with the 8x2 LCD.
On the bottom of the case (in the middle here) is the main board. On the top left of that board is the PLL on an SMD carrier and the 4 LS390 decade counters. Next to them the 74LS151 mux and the LS109 flip-flops. Top right is the programming connector for the main controller. In the middle to the left is the 18M2 display controller and the adjustment for the display contrast. Next to that the 3 pins for the oscillator connection. To the right are the F32 OR gates and F02 NOR gates.
On the bottom row from left are the 14M2 main controller, the 74F04 buffers and in yellow the relay.

The standard Power-up screen after de device has booted up, displaying the version number of the software.

On the left side are the two Fast Rise output BNC's. On the top the positive edge, and below it the negative edge.
Below the LCD display are the main output BNC and to the right the 5MHz output of the oscillator. Top right is the rotary encoder with push button, and below it the output voltage adjust for the Fast Rise pulses.

How does it perform?

I'm using a 74F04 as the output drivers for my clock signals, and use two gates with a series resistor of 50Ohm. They produce a nice and steady 4ns rise time, using a 1mtr coax terminated in 50Ohm at the scope input.

I think I can improve on the cross talk and glitches, but that will be when (if) I design a proper PCB. [ I did]

Above is the 5MHz oscillator signal taken from the BNC connector on the front panel. Note that the end of the BNC cable is terminated into a 50 Ohm coax terminator before it goes to the scope input. Because of the poor decoupling on the main circuit board, the switching transitions of the various gates and the PLL are clearly visible. I don't care too much at the moment, more important for me right now is the frequency selection, the timing precision and the Fast Rise outputs.

Above is the 20MHz pulse, again terminated into 50Ohm.

Above is the 100KHz signal terminated into 50Ohm. The two gates of the 74F04 driver for the output are doing a good job, note the rise-time of 3.7ns.

Pushing the rotary encoder toggles the Fast Rise board power.

And here is the beautiful positive edge of the Fast Rise board. According to the PG506 specification, the Fast Rise edge should be <=1ns. This is at the limit of my RIGOL DS2072A (with the 300MHz hack - it reports that it is now a DS2302A).
The rise-time is not a steady 1.250ns, it varies a little. I was lucky when I pressed the print button on the scope to get this picture.

The pulse of the Fast Rise at 100KHz looks like this:

Calculating bandwidth from rise time
The "rule of thumb" calculation to infer bandwidth from rise time is BW = 0.35 / rise time for (Gaussian type) analog scopes and for DSO's it should be BW = 0.40  / rise time.

The RIGOL specifications for the DS2302A list a 300MHz bandwidth (@ 3dB) with a typical rise time of 1.2ns.
If we use the rise time specification of 1.2ns for the RIGOL with the factor of 0.40, we get 333MHz, on paper...

In the above actually measured case, the calculated bandwidth is 0.40 / 1.3ns (max) = approx. 307MHz. Spot on!

Master clock precision
After I upgraded my FY6600 Function Generator & Counter with a 1ppm precision TCXO oscillator, I measured the frequency of the master oscillator to be 5,000,001.7 Hz. This seems to be a little better that the part got after calibration (5,000,002.1 Hz). Either way, that is a remarkable precision for such an old and never used part.

The next step is to measure it again as soon as I have my GPS disciplined oscillator ready, which is a project I'm starting right now. If all goes as planned, this should allow me to verify the clock precision of my counter within 1ppm, and also allow me to calibrate the master clock again. The now up and running GPSDO was used to measure the precision of the FY6600. It is exactly 1Hz too low at 10 MHz. This means that the precision of the 5MHz oscillator is even better than I first anticipated.

As mentioned earlier, there are some things I could do to get rid of the noise, glitches and cross talk, but right now, I'm very happy with the results.

Update [may 2020]
I used this unit extensively while testing the 100 MHz differential probe design that my friend and I designed recently. Look at our blogs that details this project. We could only really characterize the diff probe with the fast edges. That alone was worth the trouble to build this unit.

In addition, after having now completed three working Global Positioning System Disciplined Oscillator (GPSDO) units on another project, described on this blog, I wanted to test a couple of things. For this test I needed a very stable and precise 1 second clock signal, to replace the jittery but very precise 1s pulse coming from the GPS unit that drives the GPSDO. This is a perfect task for this unit, but it needed a "final" modification.

To feed the unit with the extremely precise GPSDO 10MHz output, I added a BNC connector to the back panel, and wired that to the oscillator input pins on the main board. From now on, I will connect the 10MHz square wave output of one of the GPSDO units to this input to create a very precise 10MHz base clock. In order to get the master 20MHz clock back, I needed to change the configuration of the PLL multiplier chip from 4x to 2x. I also no longer needed the 5MHz oscillator, so I took it out.

Needless to say, this change in the setup works very well. So well actually, that I'm now seriously considering making a decent PCB layout and get rid of the nasty glitches and wiggles on the output pulses.
Update December 2020
For a while I decided to invest the time to design a PCB and see if I could reduce the cross-talk and get better signals. Besides, the wiring was complicated such that it would have been very difficult to make modifications or worse, a repair.
Because of the density of the many parts on the PCB and reducing cross-talk, I decided to go SMD as much as possible. This also meant that I had to redo the schematics considerably before I could turn it into a PCB.
Here are the schematics for version 2:

And here is the PCB design:


Note that for the rectification diodes, I used SS54 types, because that's what I had. They are very fast diodes, typically used in DC-DC convertors. A better one would be the B2100-13-F or equivalent. 
I made one error with the layout.  When I selected the clock multiplier from the library, it attached the wrong package to it, and I didn't notice this until I de-soldered the chip from the carrier I was using on the version one and wanted to place it. Bummer. The footprint is so small that you can't really finagle it. I tried, but that didn't work so I soldered the chip on a small carrier board and used short tiny wires to make the 4 connections.

It only took a few hours to solder all the parts in place and test the circuits. I changed some of the wiring going to the various other boards and places and voila:

The signals are a lot cleaner, especially the Fast Rise signals. There is still some of the 10MHz wriggle on top of the waveforms, but other than that, it is much cleaner.
Here is a picture of the 5MHz signal that I also show a little up from the version 1 circuit.

This is cleaner, the 20MHz wriggles are gone, only the 10MHz are still there and even more important, I now have a 50% duty cycle.

The plans is now to connect it to my GPSDO. When I tried that, the GPSDO lost lock immediately. This happened before and is caused by ground loops and DC connections. I'm definitely going to design a multi-channel distribution amplifier with electrical isolation.

After I added the isolated output protection (transformers) to my GPSDO, I could use it as the source for this instrument and also for my FY6600 waveform generator. This is described in another project on this Blog.


The code
The PCB Gerbers and the code for the main controller and the serial LCD driver can be found on my Github site: Frequency-Generator

I have several PCB's available at cost and shipment so if you're interested, send me a PM or add a comment to the Blog.

If you like what you see, please support me by buying me a coffee:


William Jessie said...
This comment has been removed by a blog administrator.
paulv said...

You could, but need to be aware of the switching noise that can get out or in of the box.