A Low-cost DSP Rapid Development Method

Publisher:烟雨江湖Latest update time:2011-07-01 Source: 现代电子技术Keywords:DSP  RTW  Simulink Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.







b.JPG


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.

c.JPG


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:
d.JPG
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.

a.JPG


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.

Keywords:DSP  RTW  Simulink Reference address:A Low-cost DSP Rapid Development Method

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

TMS320C54x DSP implementation of RSA algorithm
  introduction   In today's telecommunications era, the use of large-scale electronic computers to process data has greatly accelerated the transmission of information. However, the most worrying issue has also emerged, which is the security of information. The method to protect information is data encryption. By en
[Embedded]
Design of image compression wireless transmission system based on DSP
1 Introduction With the development of aerospace technology, image wireless transmission technology is becoming more and more mature. Embedded image wireless transmission technology has attracted much attention in a wide range of fields due to its advantages such as easy installation, flexibility, and wide
[Embedded]
Design of dynamic liquid level depth test system based on DSP
1 Introduction   The dynamic liquid level depth is the distance from the wellhead of the oil well to the surface of the oil layer downhole, and is an important parameter in the regular testing of the pumping well. The average sound velocity in the well pipe can also be calculated from the dynamic liquid level depth.
[Test Measurement]
Design of dynamic liquid level depth test system based on DSP
Research on Dual-CPU Servo Controller Based on AT89C51+DSP
1 Introduction In recent years, with the continuous progress of the manufacturing industry, modern manufacturing industry has increasingly higher requirements for precision, accuracy, high speed and automation. Most traditional motion controllers use 8051 series 8-bit single-chip microcomputers. Althoug
[Industrial Control]
Embedded License Plate Recognition System Based on Blackfin561
With the development of science and technology and economy, the number of cars is gradually increasing, and traffic management problems are becoming increasingly severe. How to establish a scientific and effective traffic management system is the focus of traffic management. With the rise of science and technology, in
[Embedded]
Embedded License Plate Recognition System Based on Blackfin561
DSP video processing via open source API
Digital signal processors (DSPs) offer excellent multimedia performance. In general, they run codecs at only 40% to 50% of the cycles required by general-purpose processor (GPP) cores. DSPs also offer much greater flexibility and reconfigurability than ASICs. But until now, to use DSPs in digital video applications,
[Industrial Control]
DSP video processing via open source API
Broadcast-grade digital audio delay device based on high-precision Σ-Δ ADC and DSP
Audio delay devices can be used in live broadcasts of radio stations. They delay audio signals for a period of time before broadcasting them, in order to prevent the host's slip of the tongue or some unhealthy remarks from listeners on the listener hotline from being spread through broadcast media, thereby achieving
[Analog Electronics]
Broadcast-grade digital audio delay device based on high-precision Σ-Δ ADC and DSP
Design of 256PPM modulation based on TMS320C5410
introduction FSO (Free space optical) refers to the communication between two or more terminals using laser beams transmitted in space as information carriers. It includes laser communications between deep space, synchronous orbit, low orbit, medium orbit satellites, and between the ground and satellites. I
[Embedded]
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号