Operating the Frequency Generator Module
Once the design has been processed and downloaded into the physical FPGA device, the instrument can be used. Displays and controls for the instrument can be found on the device's associated instrument panel. This panel enables you to effectively use the instrument in your design.
The following sections detail how the instrument panel is accessed, and subsequent use of the panel to generate a signal of the desired frequency.
Accessing the Frequency Generator Module's Instrument Panel
The host computer is connected to the target Frequency Generator module using the IEEE 1149.1 (JTAG) standard interface. This is the physical interface, providing connection to physical pins of the FPGA device in which the instrument has been embedded.
The Nexus 5001 standard is used as the protocol for communications between the host and all devices that are debug-enabled with respect to this protocol. This includes the frequency generator module, as well as other Nexus-compliant devices such as debug-enabled processors, digital I/O modules, logic analyzers, counters and cross-point switches.
All such devices are connected in a chain – the Soft Devices chain – which is determined when the design has been implemented within the target FPGA device and presents within the Devices view (Figure 1). It is not a physical chain, in the sense that you can see no external wiring – the connections required between the Nexus-enabled devices are made internal to the FPGA itself.
For instruments such as the Frequency Generator module, the Nexus protocol enables you to access the registers used for controlling the device. These register are not exposed as such, rather input to them is provided through an instrument panel, which allows you to:
- Set the time-base frequency
- Control operation of the Generator
- Request a desired frequency – either from a predefined selection of frequencies and Baud rates, or by entering a specific value
- View the actual frequency that is generated based on the requested frequency and the time-base.
The controls for a CLKGEN instrument used in a design can be accessed from the Devices view. Simply double-click on the icon representing the CLKGEN device whose controls you wish to access, in the Soft Devices region of the view. The Instrument Rack - Soft Devices panel will appear, with the chosen instrument added to the rack (Figure 2).
Each CLKGEN device that you have included in the design will appear, when double-clicked, as an instrument in the rack (along with any other Nexus-enabled devices).
Obtaining Accurate Results - Time-Base Definition
The TIMEBASE
input to the device is essentially a reference clock, either the external system clock (on the NanoBoard) or some other clock source in the design. The entire range of frequencies that the Generator can produce is based on this reference clock.
In order to achieve accurate frequency generation, the Time Base Frequency for the device must be set to the frequency of the clock signal wired to the TIMEBASE
input. For example, if the external system clock is used as the TIMEBASE
input and the frequency of this clock has been set to 50 MHz, then the Time Base Frequency for the device should, for accurate results, be set to 50 MHz as well.
The Time Base Frequency for the device is set in the Choose Time-base Frequency dialog, accessed by pressing either the Set Time Base or Options buttons on the Generator's Instrument Panel.
The Choose Time-base Frequency dialog also contains an option to enable 50/50 duty cycle for the generated output frequency. Enable/disable this option in accordance with your design requirements. By default, this option is enabled.
Requesting an Output Frequency
The REQUEST FREQUENCY region of the Instrument Panel allows you to specify the desired frequency for the output signal. Bare in mind though that this is a requested frequency and may not necessarily be the actual frequency that can be generated.
The range of actual frequencies that can be generated is based on the value of the chosen Time Base Frequency (which in turn is set to equal the frequency of the incoming TIMEBASE
signal). The Generator will produce output frequencies that are integer divisors of this Time Base Frequency.
Requesting a frequency for the output signal can be carried out in the following ways:
Selecting a Predefined Frequency
Use the available buttons on the panel to choose from a selection of predefined and commonly used frequencies – in either the Hz, kHz or MHz ranges. As you click on a button, the actual frequency that is generated will be displayed in the ACTUAL FREQUENCY region of the panel.
Selecting a Predefined Baud Rate
A range of commonly used Baud rate frequencies are available for selection when requesting the frequency for the generated output signal. To use one of the predefined Baud rates, simply click on the Baud Rates button on the panel and choose the desired rate from the pop-up menu that appears.
The actual frequency that is generated will again be displayed in the ACTUAL FREQUENCY region of the panel.
Requesting your own Frequency
If the frequency you require is not available in the predefined selections, you can enter a specific frequency of your own. Simply click on the Other Frequency button and enter the frequency and units (Hz, kHz, MHz) in the Choose Frequency dialog that appears. Once again, the actual frequency generated will be displayed on the panel and may differ from the requested frequency, depending on whether or not the frequency you enter is an integer divisor of the Time Base Frequency.
When selecting a predefined frequency or Baud rate, using the Shift and/or Ctrl keys as you make your selection will provide the following multipliers:
- Shift + Selected frequency – multiplies the selection by 4
- Ctrl + Selected frequency – multiplies the selection by 2
- Shift + Ctrl + Selected frequency – multiplies the selection by 10.
If the requested frequency in each case is not an integer divisor of the Time Base Frequency, the generated output frequency will be rounded to the nearest frequency that is. As shown in Figure 5, if the actual frequency is different to that requested, the percentage difference between requested and actual frequencies will be shown.
Running the Frequency Generator
When a design that incorporates one or more CLKGEN instruments is programmed into an FPGA device, each instrument is, by default, in the Run mode. To toggle between normal Run and Paused modes, simply click on the Run button () on the associated Instrument Panel.
If you require the generated output to be inverted, simply click on the Invert entry () on the front of the instrument panel to toggle the current output state.
Verification of the Generated Frequency
As described, the Instrument Panel for the Frequency Generator module will display the actual frequency of the generated output signal. You can also verify the output frequency of the generated signal by using a Counter module (FRQCNT2).
The output from the Frequency Generator module should be wired into one of the Counter module's input channels. For accurate results, the same reference clock used as the TIMEBASE
for the Generator should also be used as the TIMEBASE
input for the Counter and the Counter's Time Base Frequency set to this reference clock frequency. This ensures synchronization between the two instruments. Figure 6 shows an example of wiring the two instruments together.
Figure 7 shows the Instrument Panel displays for both the CLKGEN and FRQCNT2 devices.
Consider the example illustrated by Figures 6 and 7. In this case, the external system clock has a frequency of 50 MHz and this value is set as the Time Base Frequency for both instruments. The Frequency Generator module has been requested to provide an output frequency of 40 MHz. The actual frequency generated is 33.333 MHz. This value for the signal's frequency is confirmed by the Counter module, which takes the output from the generator as its channel A input. The display verifies the actual frequency of 33.333 MHz.