Abstract: At present,
the algorithm development of
DSP
mainly relies on manual C code, which is not only labor-intensive, but also depends on the special and expensive simulator for program downloading. This paper proposes a comprehensive solution for DSP algorithm development based on Matlab/
Simulink
environment and
program downloading
by using
serial port
communication. This solution can make good use of the existing functional modules of Matlab, greatly reducing the difficulty of DSP algorithm development. By using
RTW
technology, the algorithm can be automatically generated into C code. Using serial port communication to download and debug the program is convenient and effective, saving the cost of system development. Experimental verification shows that the use of this solution shortens the algorithm development cycle, the results are reliable, and the cost is low.
Keywords: DSP; serial port; RTW; Simulink
0 Introduction
Digital Signal Processing (DSP) is a mature digital processing technology. It has the advantages of fast speed, high precision, strong anti-interference ability, small size, stable performance, etc., and is particularly suitable for processing complex control algorithms. At present, the traditional DSP function development method is to use assembly language or C/C++ language to develop DSP functions, which has the disadvantages of long cycle, large workload, complex debugging, etc., which is not conducive to algorithm verification and rapid product development. Moreover, the price of the simulator that the program download depends on is generally expensive, which also increases the cost of product development.
This paper uses the TMS320F2812 chip to independently develop a hardware platform, and proposes a rapid development solution to build an algorithm model and automatically generate C code in the Matlab/Simulink environment, and download it to the DSP target board through the serial port.
1 Overall scheme introduction
The hardware platform independently developed in this paper uses TMS320F2812 as the core processor, and develops functions such as serial port communication, orthogonal encoding, PWM output and startup mode jumper. The DSP rapid development method based on the Matlab/Simulink environment first uses the independently developed software to establish a connection between the DSP hardware, Code Composer Studio development environment (CCS) and Matlab software, and then establishes the motion control algorithm model in the Simulink environment. In this modeling process, users can operate the DSP's memory and registers like operating Matlab variables. After the model is built, the RTW technology is used to automatically generate the corresponding C/C++ code from the model. The code can be supported by the CCS integrated development environment. After CCS compilation, the executable code is generated. Finally, the DSP serial port is used to download the executable code to the DSP storage for execution. The flowchart of the process is shown in Figure 1.
Developing DSP in Matlab environment can not only conveniently use Matlab's existing mathematical toolbox to complete the design of complex algorithms, but also unify all operations into Matlab command flow operations, which greatly reduces the difficulty for designers to master different software.
2 Matlab modeling
In Simulink environment, use the DSP-related library in the toolbox to drag the required modules to the model window to build the target model. This process is similar to the ordinary Simulink modeling process. Special attention should be paid to several important modules. The Target module predefines all basic hardware information of the DSP, such as the main frequency and storage allocation. It is a module that must be included in each model. This module needs to be placed at the top level of the model and has no input and output settings. The peripheral module contains all functional peripherals of the DSP, including I/O ports, PWM waveform generators, timers, QEP orthogonal encoding functions, etc. The algorithm module library contains commonly used algorithm models of DSP, such as PID controllers. These algorithm libraries all support IQrnath format, which is a function that converts floating-point operations into fixed-point operations, which can improve the efficiency of floating-point operations of DSP. After the model is built, the C/C++ code corresponding to the model can be generated by compiling it using the RTW function, and the corresponding Project file can be generated. Use the CCS integrated development environment to compile the code, that is, to generate an executable file, ready for serial port downloading.
3 Serial port download
The function of program download based on the serial port is realized by using Matlab's serial port communication instructions and a boot function in the DSP.
3.1 Boot function
The boot function is written in the ROM of F2812, which is executed when the DSP is powered on or restarted. It is used to transfer the execution code from an external source to the internal memory; thereby allowing the code to be stored in an external slow and non-volatile memory, and then booted to the fast memory inside the DSP for execution. The boot function provides a variety of boot methods to meet different system requirements. Different modes are determined by the signals of the GPIO pins. The corresponding relationship is shown in Table 1.
This article uses the SCI boot mode to transfer the executable code to the DSP through the serial port for execution. Therefore, the DSP hardware pins must have corresponding signal inputs.
[page]
3.2 Serial communication
Matlab has an object that supports serial communication. Using this object, you can easily implement all events related to serial communication between the host and the slave, such as setting parameters (baud rate, data bit, stop bit, etc.), sending/receiving data, interrupts, etc. In this article, the most basic process of using Matlab's serial function is as follows:
3.3 Program download steps
After writing the serial communication function on the host computer, you can use the serial port to download the executable code to the DSP target board for execution. Follow the steps below:
(1) Data conversion. The boot function has corresponding format requirements for the incoming data. The file compiled by CCS must be format converted before it can be received by the boot function. This process can be completed using the hex2000 tool provided free of charge by TI.
(2) Hardware settings. Set the DSP hardware to SCI boot mode.
(3) Establish serial communication. Save the converted data stream as a Matlab variable, and transfer the data in the variable to the DSP according to the serial communication method described above.
(4) Program execution.
4 Experimental Verification
In order to verify the reliability of this solution, this paper designs an experiment of serial port control motor speed regulation. The content of this experiment is: the host computer uses the serial port to send speed instructions to perform PID control on the motor speed. Among them, the motor is driven by PWM, and the PWM cycle register value is set to 64,000 count cycles. The hardware connection of this experiment is shown in Figure 2. The DSP and PC are connected by serial port. The control model established by the host computer is shown in Figure 3.
The main frequency of the DSP used in this paper is 150MHz. According to the result of the conversion after clock division, the actual PWM wave period is about 850μs. The upper computer sends a command of 75% of the maximum speed, and the corresponding PWM duty cycle is 75%, of which the actual length of the high level is about 640μs, which is consistent with Figure 4 observed with an oscilloscope. Therefore, the DSP function development scheme proposed in this paper is reliable.
5 Conclusion
This paper proposes a DSP algorithm development based on the Matlab/Simulink environment and a rapid development scheme for program downloading using the serial port. This scheme makes good use of Matlab's powerful scientific computing and visual graphics development functions, shortens the development cycle of the DSP algorithm, reduces the workload of DSP programming, and saves hardware costs. Finally, it is verified on the hardware platform designed by this paper, and the results show that the scheme is feasible and effective.
Previous article:Processing of wall crack detection images based on DSP digital signal processor
Next article:Design of Intelligent Substation Power Grid IED Based on DSP and CPLD
Recommended ReadingLatest update time:2024-11-17 02:44
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- The ESP32-C3 module of Anxinke failed to run after burning MicroPython 1.1.17
- How to choose MOSFET indicators? System design of ACDC and DCDC? PCB layout and heat dissipation? Have you watched these useful videos?
- C2000 F2810 The program does not run after encrypting the CSM function
- Usage of DSP C54X ioport
- My opinion on 3G network
- McBSP Serial Interface Technology and Program Design of TMS320VC5410
- Is this the intention of the forum?
- 4G DTU
- 400 V DC-BUS solution for UPS based on TI C2000
- CST Antenna Simulation and Engineering Design