introduction
DSP digital signal processors are divided into two basic types: fixed-point and floating-point. The biggest difference between them is that floating-point DSP has more powerful computing power and a wider range of dynamic accuracy than fixed-point DSP. Floating-point DSP has a hardware unit that specifically supports floating-point operations. Data in floating-point format can be directly added to hardware operations through code, so the operation speed is very high. Fixed-point DSP does not have a fixed-point operation unit. It must use software to implement real numbers in floating-point format, which increases the instruction code and indirectly makes the fixed-point DSP operation speed lower than that of floating-point DSP. Typical floating-point processors, such as TI's C6000 series, and almost all embedded microcontrollers are fixed-point processors, such as TI's C2000 series. Because floating-point DSP is more expensive, fixed-point DSP still has its huge advantages. However, any algorithm requires floating-point operations, so how to improve the speed and accuracy of floating-point operations on fixed-point DSP has become a key issue that users must consider when developing. The IQmath library provided by TI for the fixed-point processor TMS320C2000 series provides a good implementation method for solving the above problems.
1 Number Scaling: Q Format
Fixed-point DSP cannot process decimals directly. There are three ways to process decimals when programming:
① Define the variable as float type. This method requires the least programming, but the compiled code is the largest.
② Enlarge the integer variable to represent the decimal. This is a method often used by many programmers who develop fixed-point DSPs, but the program is not portable.
③ Use integer calibration to determine the decimal, that is, use Q format to represent the decimal. For fixed-point processors, no matter what type of data is defined, integer data is ultimately used for specific operations.
The essence of integer calibration is to determine the precision of the decimal by determining where the decimal point is located, which is usually expressed in Q format. The Q format of a 32-bit signed fixed-point number is as follows:
Where S is the sign bit, I is the integer part, and f is the decimal part. The size of the fixed-point number is calculated as follows:
For example, the decimal point of the Q15 fixed-point number is located to the right of the 15th bit, and the decimal 0.25 is expressed as 2000H using Q15. This is a very simple way to express a decimal in an integer format. For a fixed-point DSP, processing decimals is exactly the same as processing integers. It should be noted that when using Q format data for algorithm design, overflow must be considered. The range and precision of various Q format data representations refer to the literature.
2 TMS320F2812 fixed-point DSP processor
As a typical product of TI's C2000 series DSP, the fixed-point processor TMS320F2812 has a high cost-effectiveness and is widely used in industrial control, especially in areas that require high processing speed and processing accuracy. TMS320F2812 integrates Flash memory, A/D converter, event manager, QEP and a variety of communication modules, and has powerful control and signal processing capabilities, making it easy for users to develop high-performance digital control systems. In particular, the IQmath library designed by TI for the C28xx core can realize accurate floating-point operations and complex control algorithms on fixed-point DSP processors.
3 IQmath library and its application
The IQmath library is a highly optimized and high-precision mathematical function library. The functions contained in the IQmath library all use Q-format fixed-point numbers as input/output, allowing programmers to design floating-point algorithms on fixed-point TMS320F281xx processors, thereby increasing the speed of calculations.
3.1 IQmath Library Composition
The IQmath library can be used in C/C++ programming and consists of 4 parts:
◆IQmath header file IQmathLib.h
◆Object file containing all functions and value tables IQmath.lib
◆Command link file IQmath.cmd
◆GEL file for debugging IQmath.gel
3.2 IQmath Library Functions
The IQmath library mainly includes the following functions (which users can call directly when designing and developing programs):
◆Format conversion functions IQ(), IQN(), IQtoF(), IQtoIQN(), etc.
◆Arithmetic operation functions IQmpy(), IQdiv(), etc.
◆Trigonometric operation functions IQsin(), IQcos(), IQatan2(), etc.
References to each function in the IQmath library and its meaning.
3.3 Application of IQmath library functions
The following describes how to use the IQmath library in a C program. First, you need to install the IQmath library, which can be downloaded for free from TI's website http://www.dspvillage.ti.com. Then create a new project and add IQmath.lib and IQmath.cmd to the project. At the same time, you must also add IQmath.gel to the project, because the transformation and adjustment of IQ variables are all achieved through the GEL function. After setting up according to the above steps, you can use the functions in the IQmath library in the C language program. It should be noted that IQmath.cmd must contain the following content:
4 Fixed-point implementation of PARK transform floating-point algorithm
In the field of modern AC motor control, the space vector control method (SVPWM) enables the control strategy of AC motors to be similar to the control strategy of DC motors, and can achieve separate control of torque current and flux, thus becoming the mainstream AC servo drive control strategy. Using the powerful computing power and signal processing capabilities of DSP, the current and flux control of SVPWM can be implemented by software. The TMS320F2812 processor has two event managers (EVA/EVB) and encoder circuits (QEP) specifically for motor control, making it one of the best choices for motion control. Figure 1 is
a system block diagram of the SVPWM control algorithm implemented using TMS320F2812.
As can be seen from Figure 1, PARK transformation is one of the most complex transformations in the SVPWM control algorithm. It is a transformation of a rotating vector is from a stationary two-phase coordinate system (α-β) to a synchronously rotating two-phase coordinate system (dq). The PARK transformation coordinate mapping is shown in Figure 2.
From Figure 2, we can get the equation of PARK transformation:
Because PARK transformation is a floating-point algorithm, it is very expensive to implement it using floating-point operations on the fixed-point processor TMS320F2812. Using floating-point types for programming will generate very large codes, and will inevitably affect the efficiency and performance of the system in loop calculations. The IQmath library can convert floating-point algorithms into fixed-point algorithms, so that the calculation speed can be significantly improved, which is very effective for the design of motion control systems with good real-time requirements. The program segment for implementing PARK transformation using the IQmath library is as follows:
Figure 3 is a waveform diagram of the SVPWM program written by the IQmath library using the Embedded Target for TI C2000 DSP integrated development tool to calculate the PWM duty cycle.
5 Conclusion
The IQmath library can be used to achieve seamless connection between floating-point algorithms and fixed-point algorithms on the 32-bit fixed-point processor TMS320F2812, which can greatly enhance the computing power of the fixed-point DSP; high-precision calculations can be achieved without sacrificing time cycles, and the conversion, implantation and execution of floating-point algorithms can be completed quickly; the calculation accuracy can also be adjusted accordingly according to the different requirements of the application system, which is more efficient than directly using the ANSI C language.
Previous article:Transplantation of μC/OS-II on TMS320VC5402 Processor
Next article:Taxi safety monitoring system based on TMS320DM355 processor
- 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
- CST Chinese Tutorial
- Recommended fuel gauges for drone battery packs
- [Mil MYB-YT507 development board trial experience] Install pyecharts module
- MediaTek launches the largest recruitment in history, with annual salary of more than 345,000 for graduates with master's degree
- BlueNRG-Series RTC with Sleep Reference Design
- In a Class D amplifier, the output waveforms of the three stages are modulator, Class D amplifier, and low-pass filter.
- Did you know? 5G spectrum directly affects its future development vision
- Let's take a look at the working principle of the electronic circuit of this condenser microphone. Some of them are confused.
- Design of Phase Detection Broadband Frequency Measurement System Based on FPGA
- Good permanent magnet synchronous motor design