Quantcast
Channel: Embedded Software (Read Only)
Viewing all articles
Browse latest Browse all 25965

Forum Post: RE: TMS3205535 RTA Tools - CPU Load

$
0
0

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


Viewing all articles
Browse latest Browse all 25965

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>