Design of frequency sweeper based on single chip microcomputer and FPGA

Publisher:SereneSoul55Latest update time:2011-11-21 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The frequency characteristics of a network include amplitude-frequency characteristics and phase-frequency characteristics. When designing a system, the frequency characteristics of each network have an important impact on the stability, working frequency band, transmission characteristics, etc. of the system. In actual operation, the sweep frequency meter greatly simplifies the measurement operation, improves work efficiency, and achieves the purpose of fast, intuitive, accurate and convenient measurement process. It is widely used in production, scientific research and teaching. This design uses digital frequency synthesis technology to generate sweep frequency signals, with single-chip microcomputer and FPGA as the control core. Through interface circuits such as A/D and D/A converters, the step adjustment of the sweep frequency signal frequency, digital display and display of the amplitude-frequency characteristics and phase-frequency characteristics parameters of the measured network are realized.

1 System overall plan and design block diagram
1.1 System overall plan

Taking the sinusoidal sweep frequency signal source with adjustable output frequency step as the excitation Vi of the measured network, the response of the measured network can be obtained as V0. By measuring the amplitude of each frequency point, the effective value of V0 and Vi can be obtained, and the ratio of the two is the amplitude-frequency response of the point; V0 and Vi are compared and shaped by zero crossing, and then sent to FPGA to measure the phase difference, the phase-frequency characteristics can be obtained.
Assume the excitation signal Vi=x(n)=Acos(ω0n+f), and the steady-state output signal V0=y(n). Using trigonometric identities, the input can be expressed as the sum of two complex exponential functions: , where . For input , the steady-state output of the linear time-invariant system is . According to the linear property, the response v(n) of the input g(n) is: . Similarly, the output v*(n) of the input g*(n) is the complex conjugate of v(n). So the expression of the output y(n) is obtained:

Therefore. The output signal and the input signal are sine waves with the same frequency, with only two differences: 1) The amplitude is weighted , that is, the amplitude function value of the network system at ω=ω0; 2) The phase of the output signal is equivalent to a q(ω0) delay in the input, that is, the phase value of the network system at ω=ω0. The control of the amplitude and phase measurement of this scheme is implemented through FPGA, which can make the measurement results accurate.
1.2 System overall design block diagram
The system obtains the externally set frequency sweep range and frequency step through keyboard scanning, and controls DAC904 by calling the DDS control module to output the frequency sweep signal. Since the signal will be greatly attenuated in the stop band of the network under test, the frequency sweep signal of the network under test is processed by program-controlled amplification, and then the effective value is sampled by AD637 and shaped by LM311. The effective value of the signal is converted by MAXl270 to obtain the digital value of the effective value, and the shaped signal is processed by the phase measurement module to obtain the phase difference value. Two RAMs are written in the FPGA to store the effective value and phase difference value of the measured signal. After completing a frequency sweep, the amplitude-frequency and phase-frequency curves are displayed on the oscilloscope through the waveform display module, and the amplitude and phase difference values ​​of specific frequency points are displayed on the LCD. The system implementation block diagram is shown in Figure 1.



2 Design of system function part
2.1 Generation of frequency sweep signal

Direct digital synthesis (DDFS) signal source. It is a completely digital method: first, the digital quantity of the discrete sample amplitude of a period of sine wave (or other waveform) is pre-stored in ROM or RAM, read out at a certain address increment interval, converted into analog sine wave signal waveforms of different frequencies after D/A conversion, and then filtered out the burrs through low pass to obtain the input signal of the required frequency. According to this principle, DDS can synthesize any waveform, and can accurately control the phase, and the frequency is also very stable. It is quite easy to make using FPGA, and the frequency sweep step is simple to implement. Assume that the frequency of the reference frequency source inside the FPGA is fclk, and a phase accumulator with a counting capacity of 2N (N is the number of bits of the phase accumulator), and the frequency control word is M, then the frequency of the output signal of the DDS system is fout=fclk/2N×M. The frequency resolution is: △f=fclk/2N. [page]


If the crystal frequency is 40 MHz, the frequency control word is 24 bits, and the phase accumulator is 31 bits, the output frequency range is 0.02 Hz to 312 kHz, and the step frequency is 40 MHz/231≈0.02 Hz.
The system uses a high-speed 14-bit current output D/A converter DAC904 to make a DDS sweep signal source. The FPGA is used to give it a 20 MHz clock signal to output a 10 Hz to 100 kHz sweep signal. The PCB board made of this device takes grounding into consideration well, so that the output signal can be achieved without obvious distortion at a frequency of 1 MHz. DAC904 uses an internal reference and bipolar connection method, and the output signal amplitude range is 0 to 5 V. Its schematic diagram is shown in Figure 2.


2.2 Amplitude-frequency characteristic test scheme
Use the integrated true RMS converter AD637 to first detect the effective value of each frequency point of the signal, and then read the obtained data into the single-chip microcomputer for processing after A/D sampling. The device has a simple external circuit and a wide working frequency band. It can be cascaded with the A/D converter to sample the effective value, average value, mean square value, and absolute value of any complex waveform. The measurement error is less than ±(0.2% reading + 0.5 mV), which can achieve high measurement accuracy.
2.3 Phase-frequency characteristic test scheme
The counting method is used to measure the phase. The idea of ​​the counting method is to convert the phase quantity into a digital pulse quantity, and then measure the digital pulse to obtain the phase difference. Perform an XOR operation on the converted digital pulse quantity to generate another square wave with a pulse width of T0 and a period of T. If the high-frequency counting clock pulse period is TCP, the count value within a period of T is:

where φx is the degree of phase difference.
This method is widely used, has high accuracy, simple circuit form, and is suitable for FPGA implementation.
In actual measurement, when the frequencies of the two input signals are high and the phase difference is small, the pulses obtained are very narrow, which will cause large errors. In order to overcome the above defects, the idea of ​​equal-precision measurement is introduced (as shown in Figure 3), and the multi-cycle synchronous counting method is adopted. A trigger is used to generate a gate signal with a width that is an integer multiple of the measured signal fa. Counter 1 is used to measure the number N1 of high-frequency pulses fm passing through the gate signal, and counter 2 is used to measure the number N2 of pulses after the gate signal, XOR signal, and high-frequency pulse are ANDed in the same time. Therefore, the phase difference is △φ=N2/N1x36 0°. While measuring the phase, a D flip-flop is introduced inside the FPGA, and one square wave signal is used to control another square wave. The high and low outputs of the flip-flop are used to determine whether the signal phase difference range is greater than 180° or less than 180°.

[page]

2.4 System display circuit design
In order to display the curve on the oscilloscope, it is necessary to send the scanning signal and data signal to the X and Y axes synchronously through two D/A converters. The DA converter in the X-axis direction outputs a scanning signal of 0~5 V sawtooth wave signal, and the data signal is -5~5 V, which reflects the signal amplitude and phase at each frequency point, and is output to the Y-axis direction by another D/A converter.

3 System software design
The system software design consists of a single-chip microcomputer and FPGA. The entire system uses the user key interrupt as the main line, calls different processing functions, and exchanges data with each control module in the FPGA through the bus, realizing the function of measuring the frequency characteristics of the system. The software flow chart is shown in Figure 4.



4 Conclusion
This frequency sweeper uses digital frequency synthesis technology (DDS) to generate a sweep signal. The 14-bit D/A converter DAC904 generates a 10 Hz to 100 kHz sine sweep signal and acts on the network under test. The output signal of the network passes through the effective value sampling circuit and the phase measurement circuit implemented by the comparator LM311 and the FPGA to complete the measurement of the frequency characteristics of the network under test.
In order to test the performance of the system, a resistor-capacitor double-T network with a center frequency of 5 kHz and a bandwidth of ±50 Hz was made. The test results show that in the passband and stopband of the network, the phase-frequency characteristic measurement has achieved a measurement accuracy of less than 3°, and the measurement error of the amplitude-frequency characteristic is less than 50%. In addition, the system can input the sweep range through the keyboard, display the amplitude-frequency and phase-frequency curves through the oscilloscope, and display the amplitude and phase characteristic values ​​of the network at a specific frequency point on the LCD. The system is simple to operate, low cost, accurate in measurement, and has strong practicality.

Keywords:MCU Reference address:Design of frequency sweeper based on single chip microcomputer and FPGA

Previous article:Several Commonly Used MCU System RAM Testing Methods
Next article:Design of domestic wastewater treatment system based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-17 02:59

Several points on low power consumption of microcontrollers
Readers who have done low-power product development should know that the power consumption of a product is not only a matter of hardware power consumption. In fact, software is also a key factor affecting the power consumption of the entire product. I have developed several battery-powered products before. Debugging
[Microcontroller]
PIC microcontroller development: assembling circuits on breadboard
  If we want to assemble a circuit on a breadboard, we generally need to refer to two methods, one is the physical wiring diagram and the other is the electronic circuit diagram. However, there is no correspondence between the original circuit diagram and the breadboard wiring. Microcontroller development engineers re
[Microcontroller]
PIC microcontroller development: assembling circuits on breadboard
51 MCU Series: Flashing Light
1. Design Tasks 1. To make a single light flash, connect a light-emitting diode D1 to the P1.0 port and make D1 flash on and off continuously with a time interval of about 0.125 seconds. 2. Design a running light. Connect 8 LED lights to the P0.0 port respectively (here, 3 lights are connected to each port
[Microcontroller]
Design of car light control system based on single chip microcomputer and CAN bus
1 Introduction CAN (Controller Area Network) was first proposed by Bosch of Germany. It is the most popular and commonly used bus in the automotive controller area network. Its main features are: CAN bus is a multi-master bus. Each node can actively send information to other nodes on the network at any time, regardl
[Automotive Electronics]
Design of car light control system based on single chip microcomputer and CAN bus
Design of Oil Well Pressure Test System Based on Single Chip Microcomputer
1 Introduction Pressure data is an extremely important data in the process of oil field exploitation. The perforation process is a key link, which has an important impact on high-quality opening of oil and gas layers and improving the production capacity of oil and gas wells. Perforation is the main completion proc
[Microcontroller]
Design of Oil Well Pressure Test System Based on Single Chip Microcomputer
EFM32 microcontrollers add low-energy sensor interface
November 9, 2010, at the Electronica 2010 in Munich and Oslo, Norway – Energy Micro, the energy-efficient microcontroller company, has added a universal low-energy sensor interface to its EFM32 microcontroller product family. The LESENSE function module enables autonomous monitoring of up to 16 external sens
[Analog Electronics]
EFM32 microcontrollers add low-energy sensor interface
Design of a multi-loop microcontroller consisting of a single-chip microcomputer and peripheral serial devices
    1 Introduction     Formation charging and discharging is one of the key processes in the battery production process, and its control level is directly related to the quality of the product. The process requires that the formation charger can charge and discharge the battery multiple times according to conditions s
[Microcontroller]
Design of a multi-loop microcontroller consisting of a single-chip microcomputer and peripheral serial devices
Robot Chasing Control System Based on Motorola Single Chip Microcomputer
As one of the greatest inventions of mankind in the 20th century, robots have undergone rapid changes in just 40 years. With the development of computer technology, communication technology, sensor technology, etc., the interaction between robots has become a hot spot in robotics technology. This paper designs
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号