TMS320LF2407 is a high-performance, low-cost DSP processor promoted by TI. Its processing speed reaches 30 MIPS. In addition to the integrated RAM, Flash and timer, it also integrates A/D converter, PWM controller and CAN bus controller modules. It is particularly suitable for control systems with high real-time requirements such as motors and power conversion. However, the usual method of designing DSP programs is to use C language in the DSP integrated development environment CCS, which takes a lot of time to write and input program codes. Designing DSP programs in a graphical way in Matlab can shorten the product development time.
1 Introduction to Embedded Target for T1 C2000 DSP
At present, the new version of Matlab software (Matlab7.O) has integrated the development toolkit of TI's C2000, C5000, and C6000 series DSPs, which can be used to design and simulate DSPs in a graphical way in the Matlab/Simulink environment. And it can directly convert the designed graphic file (.mdl) into a C language program. Among them, the development tool of the C2000 series is EmbeddedTarget for TI C2000 DSP. This toolkit
2 Design of ADC conversion and FIR filtering processing program
The following are the steps to design ADC conversion and FIR filtering using the Embedded target for TI C2000 toolkit.
Step 1: In the newly created Simulink file (.mdl), place the LF2407 eZdsp function block in C2000 Target Preferences for parameter initialization. The dialog box settings are shown in Figure 1. The DSP timer clock prescaler can be selected from I to 128, and the corresponding timer sampling time is:
Click to see the original image
Where Timer Period is the maximum clock count period of DSP. LF2407 is a 16-bit fixed-point processor, so the Timer Period is 216-1. The Timer Clock Prescaler value set in Figure 1 is 2. When the operating frequency (CPU Clock Speed) of LF2407 is 40MHz, the sampling time of the fixed-point processor calculated by the above formula is 0.003 2 S. Since data processing requires a certain amount of running time, it is necessary to select an appropriate timer sampling time through experiments.
Click to see the original image
The functional block for implementing A/D conversion is C24x ADC, and its parameter settings are shown in Figure 2. The A/D conversion channel can select any channel in module A or B, or multiple channels, and the sampling time of A/D conversion is set to 64/80 000.
Click to see the original image
Step 2, design the FIR filter. In the Signal Processing Bloekset of Simulink, put the filter design tool (FDATool1) into the file, double-click the icon, and the filter design dialog box shown in Figure 3 pops up.
In Figure 3, select the filter type as FIR low-pass filter, the sampling frequency is 6kHz, the low-pass frequency is 1kHz, and the cut-off frequency is 2 kHz. First click Design Filter in the dialog box, then click the Realize Model icon in Figure 3 to enter the model realization dialog box, select Over-write generated "filter" block, and a functional block diagram of an FIR filter named "Filter" is generated in the design block diagram. Then delete the FDATool icon originally placed, and connect Filter to the diagram. The completed design is shown in Figure 4.
Click to see the original image
The gain module (Gain) added in Figure 4 is to achieve data type conversion. Since the ADC conversion output is 16-bit integer data, and the filter input requires double-precision floating-point data, the data type parameter (Signal datatypes) of Gain is set to float ("double"). Gainl converts floating-point numbers to integers, so the data type parameter is set to uint (16). The register (C24x To Memory) module is added in Figure 4 to make the design complete. In the generated C program, the output of the gain module Gainl is rth-Gainl, which can be called by other applications.
Step 3, generate C program from the graphic file. In Figure 4, run the Configuration Parameters item under the Simulation menu, the configuration dialog box pops up, select the Real-Time WorkShop item, click the Build button, and the block diagram of Figure 4 is converted into the C language code of TI C2000DSP, and the CCS2 software is automatically called to compile and run the program. The generated C language program includes: interrupt vector file vectors.asm, interrupt service program MW_c24xx_csl.c, ADC conversion control testADC.c, main program TestADC_main.c, etc.
3 Modify and improve the program
The program directly generated by Matlab can realize ADC conversion and digital filtering functions, but there are still some problems in the running process because many default settings are used in the program. In the program generated by the above method, only the timer interrupt is processed in the interrupt handler. When other interrupts are caused by interference signals, the DSP will shut down. Therefore, an invalid interrupt (_nothing) should be defined in the interrupt vector, and an interrupt service program should be added to the interrupt response program. In the modified program, the italic part is the modified code. The modified program is as follows:
Interrupt vector file vectors.asm:
Click to see the original image
Click to see the original image
In the ADC conversion processing program, the DSP sequencer pointer is not reset after each ADC conversion. Although the program is set to perform A/D conversion on only one channel, the result is a cyclic conversion of 16 channels, causing incorrect input data to the digital filter. Therefore, the program needs to be modified. Add in testadc_c:
TestADC_B.C24xADC=MMREGS[RESULT0]>>6; /*A/D conversion result is shifted right by 6 bits*/
MMREGS[ArN2TRL2]=MMREGS[ADCTRL2]l0X4242; /*Reset the sequencer pointer and clear the A/D interrupt flag*/
If you need to output the result through the t/o port, you can define an I/o (portl00) in testadc_c, and then output the FIR filtered data rtb-Gainl. The program is as follows:
Click to see the original image
4 Experimental results and conclusions
The program designed by the above method can run normally on the TMS3201LF2407A processor. The experimental results show that the anti-interference ability of ADC conversion has been significantly improved after the FIR filter is used. The method of quickly establishing the TI DSP model and directly generating the C language program with Matlab simplifies the development of DSP software. The Embedded target for TI C2000 toolbox also contains other tools, such as PWM control, CAN bus control and general I/O control. These tools combined with other tools in Simulink can complete the design of DSP programs with complex functions, and only a small amount of modification is required to achieve the design of functionally correct C language programs, saving program writing and input time.
Previous article:Design of OSD application platform based on BES7456 chip
Next article:Design of RTAI Kernel Scheduler Based on CBS Algorithm
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Today afternoon 14:00 live broadcast [Latest TI C2000 real-time control chip - F28003X]
- SPI slave returns data to the host in dislocation
- SensorTile.box V335 Firmware
- SensorTile.box IoT-related application supplementary content
- Introduction to DDS Principle (Chinese).pdf
- BlueNRG-1 adds DeviceInformation information
- [GD32L233C-START Review] 15. Flash erase and write operations, using FLASH as EEPROM
- [Original] [Ultra-low power STM32U5 IoT Discovery Kit] - 3: BLE-1
- How to test ch9328?
- 【ATmega4809 Curiosity Nano Review】 Flashing Light