0 Introduction
Fourier transform is a form of transformation that transforms a signal from the time domain to the frequency domain. It is a method often used to analyze signals in digital signal processing. Some characteristics of a signal are not always obvious in the time domain. By transforming it to the frequency domain through the Fourier algorithm, its characteristics become clear at a glance. For example, interference from the power supply system is always difficult to identify in the time domain, but discrete harmonics of 50 to 60 Hz can be clearly seen in the frequency domain.
In computer systems, data is actually processed in the form of discrete Fourier transform (DFT). Since DFT has a large amount of computation and is not suitable for embedded control systems, the fast algorithm of DFT, fast Fourier transform (FFT), is often used in practical applications. Although FFT has a much smaller amount of computation than DFT, it is still difficult to implement FFT multi-point and real-time operations using ordinary single-chip microcomputers. DSP (digital signal processor) has the characteristics of fast computing speed and high precision, which just meets the requirements of FFT and can solve this problem well.
1 Principle of Fast Fourier Transform
The Fourier transform of a non-periodic continuous-time signal x(t) can be expressed as
The calculated value is the continuous spectrum of the signal x(t). However, in the actual control system, what can be obtained is the discrete sampling value x(nT) of the continuous signal x(t). Therefore, it is necessary to use the discrete signal x(nT) to calculate the spectrum of the signal x(t).
The DFT of a finite-length discrete signal x(n), n=0, 1, ..., N-1 is defined as:
|
|
It can be seen that DFT needs to calculate about N2 multiplications and N2 additions. When N is large, this amount of calculation is very large. Using the symmetry and periodicity of WN, the N-point DFT is decomposed into two N/2-point DFTs. In this way, the total amount of calculation of the two N/2-point DFTs is only half of the original amount, that is, (N/2)2+(N/2)2=N2/2. In this way, the decomposition can be continued, and N/2 can be decomposed into N/4-point DFTs, etc. For N=2m-point DFTs, they can be decomposed into 2-point DFTs, so that the amount of calculation can be reduced to (N/2)log2N multiplications and Nlog2N additions. Figure 1 shows the relationship between the amount of calculation required and the number of calculation points of FFT and DFT. The superiority of the FFT algorithm can be clearly seen from the figure.
Decompose x(n) into the sum of two sequences of even and odd numbers, that is
The lengths of x1(n) and x2(n) are both N/2, x1(n) is an even sequence, and x2(n) is an odd sequence, then
Where X1(k) and X2(k) are the N/2 point DFTs of x1(n) and x2(n) respectively. Since
both X1(k) and X2(k) have a period of N/2 and WN k+N/2=-WN k, X(k) can be expressed as:
The operation of the above formula can be represented by Figure 2, and its shape is called butterfly operation. Similarly, after m-1 decompositions, the N-point DFT is finally decomposed into N/2 two-point DFTs. Figure 3 shows the decomposition process of 8-point FFT.
The principle of FFT algorithm is to achieve large-scale transformation through many small and easier transformations, which reduces the operation requirements and improves the operation speed. FFT is not an approximate operation of DFT, they are completely equivalent.
2 Implementation of Fast Fourier Algorithm on TMS320LF2407
According to the characteristics of the FFT algorithm, the processor must complete the multiplication and accumulation work within one instruction cycle, because complex number operations require multiple table lookups and multiplications to be realized. The second is indirect addressing, which can realize the increase/decrease of one variable address, which is convenient for various table lookup methods. Thirdly, the input sequence x(n) of the FFT transform is arranged in the so-called reverse order of the code bits, and the processor must have the ability of reverse indirect addressing. The DSP controller is specially designed with a unique reverse indirect addressing, and can complete the multiplication and accumulation operations within one instruction cycle. Therefore, for the analysis and processing of digital signals, DSP has an absolute advantage over other processors. This article uses TI's C2000 series TMS320LF2407 chip to implement the FFT algorithm.
TMS320LF2407 fixed-point DSP is a DSP designed for industrial control, motor control and digital signal processing. It has single-cycle multiplication and addition instructions, FFT reverse indirect addressing function, and the highest running speed is 40MIPS. In order to make full use of the reverse indirect addressing function unique to DSP chips, the FFT algorithm program is written in assembly language, and the main program is written in C language, so the program has good compatibility and scalability.
The main program flow chart is shown in Figure 4. System initialization mainly completes the necessary settings of DSP system control and status registers, wait state generator control registers, interrupt registers, etc.
The sampling function of this program is: x=sin(20πt), and the sampling frequency is 640Hz.
The input data waveform is shown in Figure 5. In general, we only care about the amplitude spectrum of the signal in the frequency domain. The calculation of the amplitude spectrum |X(k)|2 is: X(k)=XR(k)+jX(k), |X(k)2|=|Xr(k)|2+|Xi(k)|2. The signal amplitude spectrum |X(k)|2 of the FFT calculation result is shown in Figure 6.
The input signal frequency is 10Hz. According to the formula f=kfs/N, f is the frequency of the original signal, k represents the position where the peak occurs, fS is the sampling frequency, and N is the number of calculation points. From the amplitude spectrum, we can see that the peak appears at k=1, so f=1×640/64=10, which is consistent with the actual frequency of the original signal, indicating that the calculation result is correct.
3 Application of Fast Fourier Transform (FFT)
FFT is widely used in production practice and scientific research. Figure 7 shows a typical application of FFT. The following is a brief introduction to the application areas of FFT.
(1) Spectrum analysis. Spectrum analysis of the main body or components of various rotating machinery, motors, machine tools, etc. under actual operating conditions can provide design data and verify design results, or find the source of earthquakes and diagnose faults to ensure the safe operation of equipment. In sonar systems, in order to find ocean surface ships or submarines, it is necessary to perform spectrum analysis on noise signals to provide useful information and determine the speed, direction, position, size, etc. of the ship.
(2) Filtering. Filtering is the most widely used application of FFT. It makes it very simple to filter the frequency components of a waveform. For example, after performing FFT on the sampled signal, removing the unnecessary frequency components and then performing inverse FFT, the desired signal after filtering is obtained.
(3) Harmonic analysis of power monitoring systems. Harmonic analysis of power monitoring systems requires FFT calculation of sampled data, which is then redrawn through an LCD screen or other human-machine interface to help technicians understand the quality of power.
4 Conclusion
Experiments have shown that this program runs well in the TMS320LF2407 fixed-point DSP, with fast speed and reliable calculation results. It can meet the requirements of accuracy and real-time for general signal processing and industrial control, and has high academic value and good application prospects. Secondly, mastering FFT and learning to think about problems in both the spatial domain and the frequency domain can often allow us to use simple methods to solve complex problems.
Previous article:FPGA Verification in Embedded Video Processing Systems
Next article:Low voltage dynamic reactive power compensation device based on TMS320LF2407A
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Analog PID
- Suddenly I want to ask myself
- Explain in layman's terms how computers work
- Hardware Knowledge Trio
- After-class review | Highlights of ADI power supply expert training course
- Newbie help: What is the difference between AT89C51 and C52 in protues?
- What RF challenges does WiFi 6 router bring?
- dynamic
- EEWORLD University Hall----Live Replay: Infineon Intelligent Motor Drive Solution
- Should I switch from MCU to Linux? Come in and see what the experts say