DSP Learning Guide

Source: Internet
Author: User
Tags manual documentation key loop

Graduate student during the TI DSP research, from a to the embedded point does not know the novice to the completion of a self-satisfied project, which has traversed a lot of detours, now put my knowledge of DSP learning and some references listed, may be helpful for beginners.

Laboratory is a smell pavilion DM642 Development Board, at that time this development Board is relatively new, the domestic Chinese information is very few, and the smell pavilion but the example program is the original program of TI, not like the example of the use of the program easy to get started, so maybe the board is more suitable for beginners to use.

DM642 is a high-end DSP for image applications, with a wide range of domestic applications in recent years. For the DSP software learning, personally think contains 3 aspects of things: 1: Chip peripherals, the basic operation of the chip and simple program operating environment. 2: Embedded lost Operating system principle (Dsp/bios). 3:DSP the migration and optimization of the algorithm. The following is a discussion of these three aspects.

1: Chip peripherals, the basic operation of the chip and simple program run.

Learning DSP first is to the chip and you use the chip peripheral data manual description is relatively clear, for beginners may be at the beginning of the datasheet feel very dizzy, because datasheet is just some illustrative things, he did not teach you how to use, So the datasheet part must be combined with the corresponding example program to see. For the peripheral operation of the chip TI provides a CSL function that helps you define some register addresses beforehand so you don't have to look up the detailed address of each register.

Most of the C6000 program development now uses C language, and very few key codes are linear or assembler. The minimum element required for a C-language run project is: the 1:mian function 2:cmd file 3:runtime support Lib. This is the minimum condition for a C-based project to run. In other words, with these three things we can do anything we want to do on the DSP, but given the need for large-scale engineering and complex applications, operating system Dsp/bios and drivers are often used.

In the stage first is to let a simplest hell world project run up, this project contains three files, a main.c a cmd file, a rts.lib. Then check the data sheet DSP peripheral Resources debugging again, this process is completed after a few basically hand:).

What you need to figure out in this process is a process, three files, and a simple debugging method. A procedure is how C language is generated. The process of an out executable file, usually containing a compilation, assembly, and connection of three processes. Several files are in the format of obj, cmd, map, file obj,cmd, and map files, which are discussed in detail in TI's CCS text-blocking help. In terms of debugging, we can use the Fidelity device to stop the program anywhere, and then use the CCS Memory view feature to see the area of the CPU address map you want to know.

This section of the resources can be viewed

(1) The programming of the hardware program of C + + language published by the TMS320C5000 series DSP

(2) Help documentation



2: Embedded lost Operating system principle (Dsp/bios)

This part of the embedded operating system knowledge, Dsp/bios is not open source, if you want to understand the operating system knowledge in-depth can see the original code UC/OS-II. The fundamentals of embedded operating systems are the same. After this completes in the TI about Dsp/biso The example program runs a familiar operating system each module, such as Tsk, the TIMER ...

After familiar with the operating system, the rest is the driving model of Dsp/biso, TI's driving model is the Class-mini driver mode, where class driver is a number of function interfaces, to provide access to the Mini driver. Where the Mini driver implementation in accordance with different boards and chips will not be the same, it is recommended to choose a peripheral resources, to understand its source code, these codes are generally in several C files, of which the most important is the implementation of 5-7 functions;

Mdbinddev ()

Mdunbinddev ()

Mdcontrolchan ();

......................

Dsp/bios drive is relatively simple, the drive can be divided into 2 parts, part of the function of the initialization and control of the hardware, this part of the relatively simple; the other part of the function is responsible for I/o,buffer synchronization, which is usually more complex, and this part of the function is often associated with the interruption , so be sure to always know when the interrupt occurs, what is done in the Interrupt service function, what the effect is on other functions, and so on when looking at the driver source code. If you can see the driver code again for C language improvement is very large.

This section of the resources can be viewed

(1) Dsp/bios User Guide

(2) How to write DSP device driver

http://www.embedded.com/columns/... 5?_requestid=176707

(3) embedded real-time operating system Uc/os-ii


Migration and optimization of 3:DSP algorithm

This part is the last work, generally is also time-consuming work. Now if the implementation of a more complex system does not do the DSP program optimization is certainly not. There are many ways to optimize the DSP program, there is a lot of information on the Internet, but in my actual experience, many people are not sure of the key place, if it is a complex algorithm, the first step of DSP optimization should be memory optimization, that is, the use of ping-pong Buffer technology will be processed in batches of data transported to the on-chip memory, in this project to combine on-chip resources, design a good data structure, and must consider to let the data alignment. Memory optimization is not mentioned in the Program optimization documentation, but is explained in a document called the Cache User Guide, so that many people do not know why. After the completion of the memory optimization is the program optimization the method described in the document,-O3, data packaging, inline, loop expansion, compilation and so on.

In the process of optimization, it is important to ensure the correctness of the processing results before and after the optimization, that is, the optimization can not lead to errors, and then try to improve the time.

The measurement of the elapsed time of the function after optimization ti has a document that teaches you how to measure the time of a function by using a timer, and a short assembler function that only has hundreds of cycle time for the runtime can also use the clock function of CCS to measure time.

In short, program optimization is a time-consuming physical activity, haha.

This section of the resources can be viewed

(1) Program Optimization Guide

(2) Cache User Guide

For TI 6000 series DSP Beginner (original)

Preface
Recently in HELLODSP ([Url=. /]http://www.hellodsp.com[/url]) applied for a moderator, originally was to apply for tms320c6000 section, but this section has two excellent moderators, I do image processing, so locked "Voice video Processing" section, However, 6000 sections I will often go to see a lot of beginners in the question of getting started, some of the problem of comrade to describe the problem is not clear enough, perhaps more is to ask questions can not know how to mention it, I just learned the same time DSP, encountered problems do not know how to express the problem clearly, A mute eats the pain of coptis. Recently there is a time to learn the process of DSP, it is personal experience, I hope it is useful to everyone.

my experience.
Miss your first chance to learn

I entered the university in 2000, professional communications engineering. When I was in school, I got a good grade and had a scholarship and thought I was smart. At that time, our college has a technology association, referred to as the science and engineering, then the president is a senior school brother, bald, to impress, feel he is very powerful, into the association, the first lesson is to use 555 to do a running water lamp, science and engineering has to do the printed board, I only use the device welding up on the line, So I think of the principle of the circuit, at that time is a just enrolled in the boy, what do not understand, see that things do not understand, feel too difficult, and then slowly do not go to participate in activities, and then gave up.
Now think about that time too light to give up, including later in the university self-study 51 single-chip microcomputer, learning FPGA is only to taste, but not perseverance, so that later missed a lot of opportunities. So here to tell you, but also told me, learn technology must insist, no matter what difficulties encountered, must not give up, insist on there will be progress, like long-distance running, there are a few difficult points, adhere to the past is not so difficult, the level will be promoted.
use C51 for the first time
Speaking of this, I have to thank for my college roommate, is he brought me to get started C51, the first time to use Protel to draw printed boards, the first time to apply for free samples, the first time to write debugging procedures, the first use of oscilloscopes and so on, these are due to his guidance.
Time flies, a blink of an eye on the senior, think of their college games to play for three years, academic waste, graduation design This opportunity must seize, otherwise they do not have the capital to find work ah, so in the selection of the topic of a single-chip computer "signal generator design based on DDS." Although previously contacted 51, Protel, but that is to look at the book, actually do nothing, I decided to use C51 to control the AD9853 output the corresponding frequency waveform, of course, this can not be separated from the keyboard and LCD display, AD9853 is from the ad company to apply for samples, At that time I first know there is free lunch, big company really good, remember when TIDSP can apply, I applied for a piece of 6202, but later not so easy to apply, this time I insisted on down, step by step to do, and finally completed the graduation design.
I am fortunate, because there is a very good teacher, beginners mostly do not have such conditions, even so, beginners should fully tap the resources around them, they are used up so that you can be closer to success.
Contact DSP
2004 After graduation I went to a research institute to work, my department is to do video tracker, mainly with DSP+FPGA, for me into the fish water, because I am interested in these things. At that time my colleagues used or Ti c50dsp, this many people may not have heard of, TI DSP by time probably experienced these series, C25-C50-V33-2000-5000-6000,C50 function is limited, only the assembly development environment, because the function is simple, So it is relatively easy to learn, plus I have 51 of the basis, very soon to get started, 1.5 after the Department of device replacement directly replaced by the 64xx, due to the impact of C50, we develop or custom with the assembly, around May 2006, I took the lead in C development products, achieved good results.
I am exposed to a lot of this, because of my personal character reasons, learn what all want to learn fine, go a lot of detours. For example, the PCB has just started with Protel, later found that it is not convenient to draw complex board, then learn to use Allegro, and then learn SI;DSP is also, 6000 will be used to learn 2000, 5000, and then found himself very naïve, in fact, one to two proficient enough to learn what to pay attention to learning philosophy, Tool platform These are always from home Kung Fu, to be diligent in repairing internal strength.

Summary and Suggestions
1) Choose your own tools and platform to learn DSP of course, first of all to choose a DSP (here is mainly said Ti Dsp,ad Company's not familiar here). If it is a personal study of the main look at personal needs and applications, such as image processing that of course the TI6000, beginners do not have to be DSP ranked, each series no obvious advantages and disadvantages, but have a clear application field, 2000-interface control, 5000-voice, 6000 suitable for large data signal processing, such as image, radar and so on. Beginners better have a development board, or else it would be an armchair, 2000, 5000 of the Development Board is relatively inexpensive, 6000 is more expensive.
In terms of ease of use, I personally feel 6000 easier to use, 6000 of the structure of 2000, 5000 clear, the hardware on the less, you do not need to see a lot of hardware structure data can start programming, this is probably the progress of technology it. However, this sentence, the application of the decision of your choice.
2) Start with your own hands
Beginners if the C language grammar, after reading some information can begin to write their first program, if not written, look at TI's original class routines, complete their first program. I give our unit new colleagues to do 6000 training, give them the first topic is to write a program to keep the LED lights flashing, the lamp may be connected to the Gpio or through the EMIF decoding and FPGA with the control (the latter may be more meaningful), the further procedure is to control the frequency of flicker. I prefer to have them use Gpio and EMIF, which are probably the simplest and most used peripherals in 6000, and they are the first bastion that beginners will have to conquer.
Beginners often do not have the concept of hardware structure and software, on-chip storage space, on-chip storage space, on-chip peripherals These concepts do not have a real understanding, these concepts need their own repeated thinking, repeated experiments, repeated experience to finally find out, these understand you also get started.
Beginners more taboo to see too many and too complex routines, see too much of your thoughts will be more chaotic, see too complex you will impatient gas, complex routines generally it has a relatively complex programming structure, this beginner is very difficult to understand, so just start not to see, When you write 20 to 30 programs, try to look at a relatively complex routine.
3) more hands-on
This does not need to say more, light see not practice false bashi.
4) on-chip peripherals
Here take DM642, I put the common peripherals from simple to complex order: Gpio-timer-edma-emif-i2c-mcasp-videoport-emac, mdio,mcasp I have not used, but read the data feeling is not complicated, My advice to beginners is to first 4 to learn clearly, you can learn the Gpio is really simple, just start not to use CSL, the assembly or C write a program to let a gpio pin output waveform, this helps to understand the on-chip peripherals and related concepts. The previous 4 understand the specific use of the back to learn, this time you can see ti the corresponding routine, to use can.
5) assembly, C and linear assembly
Now the development of the standard process of 6000 is written in C, the benefits of C many here do not say, there are too many articles in the discussion, but for those who are prepared to optimize the comrades, the Assembly will not be able to use the assembly with C more help you understand the structure of the 6000, many beginners to C language with pointers to a space operation does The words written by sinks are relatively better understood.
You don't have to be afraid of the Assembly, in fact it is very simple, but it is more obscure, using it to develop the entire system of time spent too much, but the optimization of the key algorithm is sometimes inseparable from it, TI is also available in a linear assembly, it is the assembly and the C compromise, both assembly efficiency and C easy development.
Both the assembler and the C are just tools, the key is your understanding of the architecture and the programming concept, so choose which makes sense, through the tools to explore the architecture. I personally think that beginners should mainly learn C, after all, it is the mainstream, you can use sinks to write 4-5 small programs, familiar with its syntax on the line, in the future use it to do optimization will not know nothing, but also help the understanding of the hardware architecture.

End
Write so much, opinion, there is a lot of nonsense, I hope a little help to beginners, and also hope that the experts write more from the experience.

The optimization was put over here ~ ~ ~
My experience with optimization is this:
First, to consider the optimization from the system structure, such as minimizing the unnecessary removal of data to be processed, considering your DSP chip memory reserves and each processing data volume of the system structure optimization, this part of the optimization should be done first;
Second, from the algorithm level, to see whether the algorithm has a better and simpler calculation method, the algorithm has some symmetry, can be used more suitable data structure, etc., this optimization is more obvious than the program optimization;
Third, if the algorithm level temporarily no better optimization method to see whether the software structure optimization.
Like what:
1) Multilayer cycle structure can reduce the layer. I often see a program like this:
for (i = 0; i++; i< A)
for (j = 0; j + + j< B)
{
E[J] = c[j]-d[j];
}
This can be optimized as:
for (i = 0; i++; i<a*b)
{
E = c-d;
}
2) The conditions in the key loop structure, jump instructions should be avoided, even if the number of cycles will be increased, there is no conditional instruction optimizer in the loop is easier to optimize;
3) Key loops do not call child functions
Others, can look at the manual, the manual is very clear
Four, combining the DSP system hardware structure optimization
1) Look at the data you are dealing with on-chip or on-chip, if placed on the outside, this proposal will be divided into pieces of data on-chip processing, similar to the flow structure;
2) optimized for L2 cache for external data
V. Optimize with DSP optimizer, instruction system, etc.
This part can look at TI's Handbook in detail, probably have these several methods:
1) Optimization options,-o3-pm cancel-G and so on these options, if your software structure is very good, then their optimization effect is obvious;
2) plus some optimization indicators to guide optimization, this part of the manual, including storage address independence, SIMD (single instruction multi-data processing) and so on;
3) with some special instructions, such as 6000 to provide saturation plus, overflow minus instructions, you can not use conditions to judge;
4) If the effect is not good, use linear assembly to rewrite your program, your optimization ideas in a linear assembly to express, generally to the point can be;
5) If the Linear assembly optimization does not show your optimization idea, then compile it, the optimizer will not help you optimize, it is entirely your own control program, do your own software water it;
This part needs to have the more rich optimization experience and the solid optimization Foundation, accumulates many, sees the material more.
The final point is to say:
Optimization is no limit, in the program to the meticulous optimization of the program each part of the test time, to the very time-consuming part of the optimization, one but meet your requirements can, do not optimize for optimization, we should have more important things to learn, do not get bogged down in optimization and can't extricate themselves.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.