Forums

Real Time Implementation Help Needed

Started by bharath_imp April 25, 2008
Hi friends,

I'm pretty new to the group and to CCS also.I have got
some basic doubt.I have one algorithm which is working on my TI320C6713
DSK processor. But right now I'm doing it by using the text data input
that i have.

My problem is to implement it in real time environment.
I don't have any further data. But i guess i can generate the data
repeatedly and i will give it to my algo..

So,anybody has got ideas on this issue please let me
know it is possible by means of simulation or some other mode

Is there any option in CCS that will make my static
or non-real time algo into real time one.

Thanks in advance for answering.

Regards
Bharath.
Bharath-

> I'm pretty new to the group and to CCS also.I have got
> some basic doubt.I have one algorithm which is working on my TI320C6713
> DSK processor. But right now I'm doing it by using the text data input
> that i have.
>
> My problem is to implement it in real time environment.
> I don't have any further data. But i guess i can generate the data
> repeatedly and i will give it to my algo..
>
> So,anybody has got ideas on this issue please let me
> know it is possible by means of simulation or some other mode
>
> Is there any option in CCS that will make my static
> or non-real time algo into real time one.

Unfortunately there is not yet a "single button" that converts static implementation (as is typically used in MATLAB)
into real-time implementation (as is typically used in embedded system). So this is work you have to do, as a DSP
engineer. Here are some general guidelines:

1) First verify you can get your C/C++ code to compile. There may be many issues in porting code from MATLAB, Visual
Studio, etc.

2) Organize your c/C++ code as frame-based. This means your code will process incoming data as small 'chunks' of
data. Chooose the frame size so it has a meaningful relationship with input data. Some examples of frame length:

speech, 10 to 20 msec
video, 33 msec (30 frames per sec)
radar, from low usec to low msec

Many times -- especially if FFT or other frequency domain techniques will be used -- the frame size is chosen as the
amount of time the input data can be more or less assumed to be stationary ("quasi-stationary").

3) Use the CCS simulator to figure out if your code is running in real-time. Measure the number of cycles used, and
especialy the leftover (unused) cycles for each frame. Maintaining at least a 20% "overhead" is a good idea, in case
some frames take more work.

4) Use file I/O during simulations. At the start of each frame, the code can read another chunk of file data.

5) Carefully and thoughtfully move to real-time operation. Replace file I/O with actual analog I/O (e.g. audio or
video A/D converter, high-speed digital interface, etc.). Use DMA to "acquire" frames into DSP memory. Use a
step-by-step approach -- always include a "loopback" option where your code doesn't do any processing, to isolate I/O
and hardware related issues.

6) Address real-time performance issues -- cache usage, specific sections of code that should be optimized, etc.

-Jeff
Bharath-

> I am implementing an algorithm in real time environment on C6713.I am giving a analog signal as input.My
> algorithm take two samples of it every time and will do further calculations.I have the code and input every
> thing.
>
> My doubt is, it takes analog values and digitize it and fed to the algorithm.But in
> algorithm the constants are defined as numerical values.
>
> So,will it work properly with digital inputs and numeric values which are different
> in type??Can the dsp is able to do the calculations??
>
> Thanks in advance for answering

Please post to the group, not to me.

-Jeff

> Jeff Brower wrote: Bharath-
>
>> I'm pretty new to the group and to CCS also.I have got
>> some basic doubt.I have one algorithm which is working on my TI320C6713
>> DSK processor. But right now I'm doing it by using the text data input
>> that i have.
>>
>> My problem is to implement it in real time environment.
>> I don't have any further data. But i guess i can generate the data
>> repeatedly and i will give it to my algo..
>>
>> So,anybody has got ideas on this issue please let me
>> know it is possible by means of simulation or some other mode
>>
>> Is there any option in CCS that will make my static
>> or non-real time algo into real time one.
>
> Unfortunately there is not yet a "single button" that converts static implementation (as is typically used in MATLAB)
> into real-time implementation (as is typically used in embedded system). So this is work you have to do, as a DSP
> engineer. Here are some general guidelines:
>
> 1) First verify you can get your C/C++ code to compile. There may be many issues in porting code from MATLAB, Visual
> Studio, etc.
>
> 2) Organize your c/C++ code as frame-based. This means your code will process incoming data as small 'chunks' of
> data. Chooose the frame size so it has a meaningful relationship with input data. Some examples of frame length:
>
> speech, 10 to 20 msec
> video, 33 msec (30 frames per sec)
> radar, from low usec to low msec
>
> Many times -- especially if FFT or other frequency domain techniques will be used -- the frame size is chosen as the
> amount of time the input data can be more or less assumed to be stationary ("quasi-stationary").
>
> 3) Use the CCS simulator to figure out if your code is running in real-time. Measure the number of cycles used, and
> especialy the leftover (unused) cycles for each frame. Maintaining at least a 20% "overhead" is a good idea, in case
> some frames take more work.
>
> 4) Use file I/O during simulations. At the start of each frame, the code can read another chunk of file data.
>
> 5) Carefully and thoughtfully move to real-time operation. Replace file I/O with actual analog I/O (e.g. audio or
> video A/D converter, high-speed digital interface, etc.). Use DMA to "acquire" frames into DSP memory. Use a
> step-by-step approach -- always include a "loopback" option where your code doesn't do any processing, to isolate I/O
> and hardware related issues.
>
> 6) Address real-time performance issues -- cache usage, specific sections of code that should be optimized, etc.
>
> -Jeff
> ---------------------------------
> Download prohibited? No problem. CHAT from any browser, without download.