This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS3205535 RTA Tools - CPU Load

Other Parts Discussed in Thread: TMS320C5535

Hi!
I'd like to know how to use the RTA tools to measure CPU % (percent) usage in TMS320C5535 (real time).
(English isn’t my first language, so please excuse any mistakes)

I'm new on DSP, and I'm studying the "Texas Instruments C5505 Teaching Materials CD-ROM". I'm created the Getting Started Application (audio loopback, on chapter 1), using CCS5, configuring --ptrdiff_size = 32, --memory_Model = huge and applying http://processors.wiki.ti.com/index.php/Porting_C5000_Teaching_ROM_to_C5535_eZdsp.
It's working fine to me!


Following, I converted my application in a DSP/BIOS application:
File->New->CCS Project
Family: C5500
Device: TMS320C5535
From the project templates and examples: DSP/BIOS v5.xx Examples->ezdsp5535 Examples->hello example
Finish and Build Project
In hello.tcf file, right click System->Global Settings
Memory Model= HUGE, Apply, OK, then File->Save
In the project Properties: --ptrdiff_size = 32, --memory_Model = huge
OK, Build Project, and it's work fine, too.


Then, I copied the Getting Started Application sources (audio loopback) to my ezdsp5535 Hello Example.
I deleted "main.c", and my "hello.c" like this:

#include "stdio.h"
#include "usbstk5505.h"
#include "aic3204.h"
#include "PLL.h"
#include "stereo.h"

Int16 left_input;
Int16 right_input;
Int16 left_output;
Int16 right_output;
Int16 mono_input;

#define SAMPLES_PER_SECOND 48000

unsigned long int i = 0;

void main(void)
{
USBSTK5505_init( );
pll_frequency_setup(100);
aic3204_hardware_init();
aic3204_init();

set_sampling_frequency_and_gain(SAMPLES_PER_SECOND, 30);

for ( i = 0 ; i < SAMPLES_PER_SECOND * 20L ;i++ )
{

aic3204_codec_read(&left_input, &right_input); // Configured for one interrupt per two channels.

mono_input = stereo_to_mono(left_input, right_input);

left_output = left_input; // Very simple processing. Replace with your own code!
right_output = right_input; // Directly connect inputs to outputs.

aic3204_codec_write(left_output, right_output);

}
aic3204_disable();
}

It's work fine too.
Then I click in Tools->RTO Analyser->RTA (legacy)->CPU Load, and I can't see the CPU Load graph in real time. After ending the "for" loop (hello.c), the "CPU Load" window shows a constant zero line.
I'd like to know how to use the RTA tools to measure CPU % (percent) usage in real time (TMS320C5535).

Can you help me, please?
Is it possible measure the MIPS and memory usage, too?
Thank you so much.

  • Hi Antonoio,

    What version of BIOS and CCS are you using ?

    Best,

    Ashish

  • Hi Ashish, thank you for your attention.

    Code Composer Studio Version: 5.5.0.00077

    DSP BIOS v5.xx

    Thank you so much.

  • Hi Antonio,

    I wanted to know the majot & minor version number of your DSP/BIOS install. You can get it by going to CCS "Windows"->"Preferences" and opening the RTSC tab. Here's a screenshot showing where to find the installed BIOS versions:

    Best,

    Ashish

  • Sorry.

    DSP/BIOS 5.42.1.09

    Thank you.

  • Hi Antonio,

    Looking at the code you shared in your original post, it looks like RTA->CPU Load is correctly being reported as 0. Your application is doing all the work in main(). DSP/BIOS starts only after main returns and therefore in this case, DSP/BIOS has not yet started. Once DSP/BIOS does start, it will only run the idle loop because there is no work to do and hence report a CPU load of 0.

    In order to fix this application,  you should move the codec read/write code into a DSP/BIOS task. It looks like the code is polling based which is not good as the idle function is not called (Idle function updated the load figures). You will need to change it to an interrupt based routine that blocks on a semaphore posted by the interrupt handler. Once you make these changes, the RTA->CPU Load should report some meaningful numbers.

    Best,

    Ashish

  • Hi Ashish, once again, thank you very much for your help.

    I understood the problem. I moved the codec read/wirte code into a DSP/BIOS task. This is the code:

    #include <std.h>
    #include <clk.h>
    #include <idl.h>
    #include <log.h>
    #include <sem.h>
    #include <swi.h>
    #include <tsk.h>
    #include "hellocfg.h"
    
    #include "stdio.h"
    #include "usbstk5505.h"
    #include "aic3204.h"
    #include "PLL.h"
    #include "stereo.h"
    
    Int16 left_input;
    Int16 right_input;
    Int16 left_output;
    Int16 right_output;
    Int16 mono_input;
    
    #define SAMPLES_PER_SECOND 48000
    
    unsigned long int i = 0;
    
    Void main()
    {
    	// ========================= audio loopback init =====================
        USBSTK5505_init( ); // Initialize BSL
     	pll_frequency_setup(100); // Initialize PLL
        aic3204_hardware_init(); // nitialise hardware interface and I2C for code
     	aic3204_init(); // Initialise the AIC3204 codec
    
     	//Setup sampling frequency and 30dB gain for microphone
        set_sampling_frequency_and_gain(SAMPLES_PER_SECOND, 30);
        // ===================================================================
    }
    
    
    Void funTSK0(){
    
    	LOG_printf(&trace, "TSK0-init");
    
    	for ( i = 0  ; i < SAMPLES_PER_SECOND * 20  ;i++  ){
    		aic3204_codec_read(&left_input, &right_input); // Configured for one interrupt per two channels.
    
    		mono_input = stereo_to_mono(left_input, right_input);
    
    		left_output =  left_input;
    		right_output = right_input;
    
    		aic3204_codec_write(left_output, right_output);
    
    		TSK_disable();
    		IDL_run();
    		TSK_enable();
    	}
    	LOG_printf(&trace, "TSK0-end");
    }

    Now, RTA->CPU Load works in real time:

    I put this codes in my task function funTSK0() to call the idle function and updated the load figures:

    TSK_disable();
    IDL_run();
    TSK_enable();
    (inside the "for" loop)

    RTA->CPU Load works fine now, but is my code correct?

    You told me to change my code to an interrupt based routine that blocks on a semaphore posted by the interrupt handler. I'm new on DSP, and I'm still trying to understand how to code this rotine. The Rulph Chassaing book named "DSP Applications Using C and the TMS320C6x DSK" shows some code snippets like this:

    interrupt void c_int11(){

    ...

    }

    void main() {

    ...
    while(1); //infinite loop

    }

    And some comments saying that the c_int11() is a callback function for interrupt # 11, which occurs every time a new sample is ready for processing. Is it the way to implement a interrupt routine? Is there some material about this to TMS320C5535? 

    Thank you so much

    Antonio