Operating the Counter Module

Frozen Content

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 monitor signal frequencies in a design.

Accessing the Counter Module's Instrument Panel

The host computer is connected to the target Counter 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 counter 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 in 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.


Figure 1. Nexus-enabled devices appearing in the Soft Devices chain.

For instruments such as the counter module, the Nexus protocol enables you to access the registers used for controlling the device. These registers 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 Counter, including changing the Counter's mode of operation (Frequency, Period, Event Counter).
  • Request a desired gating period – either from a predefined selection, or by entering a specific value.
  • View the actual gating period that is generated based on the requested gating period and the time-base.

The controls for a FRQCNT2 instrument used in a design can be accessed from the Devices view. Simply double-click on the icon representing the FRQCNT2 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).


Figure 2. Accessing the Counter module instrument panel.


Each FRQCNT2 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 TIMEBASE signal is used as the base for frequency and period calculations and is divided down to produce the range of gating periods that the Counter can use.

In order to achieve accurate measurements, 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 Counter Module - Options dialog, accessed by pressing the Counter Options button on the Counter's instrument panel.


Figure 3. Set the Time-base Frequency to be the same as the
TIMEBASE input.

Selecting a Gating Period

Access is provided on the instrument panel to specify the desired gating period for each channel of the Counter. This is the period of time in which cycles of an input signal are captured, in order to calculate the frequency or period of that signal. Bare in mind though that this is a requested gating period and may not necessarily be the actual gating period that can be used.

The range of actual gating periods that can be used 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 Counter can only use gating periods that are the reciprocals of integer divisors of this time base frequency. The gating period can be expressed as follows:

Gating Period = 1 / (Time Base Frequency / 2n)

where n is an integer in the range 0 to (2 32 -1).

The following sections take a look at the different ways in which a gating period for Channel A or Channel B of the Counter can be chosen.

Selecting a Predefined Gating Period

Use the available buttons on the panel to choose from the following selection of predefined and commonly used gating periods:

  • 0.1s
  • 0.5s
  • 1s
  • 5s
  • 10s

As you click on a button, the actual gating period that is used will be displayed in the small display window to the right of the gating-related buttons.

Requesting your own Gating Period

If the gating period you require is not available in the predefined selections, you can enter a specific gating period of your own. Simply click on the Gating button and enter a value for the period (in seconds) in the Choose Gating Period dialog that appears. Once again, the actual gating period used will be displayed on the panel and may differ from that requested, depending on whether or not the period you enter is the reciprocal of an integer divisor of the time base frequency.

Selecting the Mode of Operation

The FRQCNT2 device supports three operating modes – Frequency, Period and Count. The current mode is toggled, in that order, using the Mode button. As the mode is changed, the display for the channel will change accordingly and textual confirmation of the current mode will appear in the top-left corner of the display.
 

As the two channels of the device are mutually exclusive, Channel A can be configured to operate in the same or different mode to Channel B.


Frequency Mode

In this mode, the number of edges of the input signal counted during the specified gating period, is used to calculate the actual frequency of the signal.

Frequency = Number of edges / Gating Period

The frequency range supported by the device is:

0 to TIMEBASE / 2 Hz


Figure 4. Channel B of FRQCNT2 in Frequency Mode.

Period Mode

In this mode, the number of edges of the input signal counted during the specified gating period, is used to calculate the actual period of the signal.

Period = Gating Period / Number of Edges

The resolution supported by the device is:

1 / (TIMEBASE / 2) Seconds


Figure 5. Channel B of FRQCNT2 in Period Mode.

Count Mode

This mode is used to display a running total for the number of edges of the signal that have been captured. This is the only mode that does not depend on the gating period – it is purely just an event (edge) counter.

In this mode, the Counter is able to display the number of edges in the range 0 to 9,999,999,999. Upon reaching the maximum count limit, the Counter will rollover to 0 and continue.


Figure 6. Channel B of FRQCNT2 in Count Mode.

Running the Frequency Counter

When a design that incorporates one or more FRQCNT2 instruments is programmed into an FPGA device, each channel of each instrument is, by default, in the Run mode. To toggle between normal Run and Paused modes, simply click on the Run button () for the respective channel on the Instrument Panel.

Using the Reset button for a channel will reset the gating period (when the operational mode is either Frequency or Period) and reset the edge count to zero (when the operational mode is Count). In each case, the affected channel of the Frequency Counter will enter Paused mode.

You are reporting an issue with the following selected text and/or image within the active document: