Implementation and Application of FFT Algorithm Based on TMS320LF2407

Publisher:人妙果华Latest update time:2009-11-09 Source: 电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Implementation and Application of FFT Algorithm Based on TMS320LF2407

Previous article:FPGA Verification in Embedded Video Processing Systems
Next article:Low voltage dynamic reactive power compensation device based on TMS320LF2407A

Latest Embedded Articles
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号