Hi.
I created the Getting Started Application ("Texas Instruments C5505 Teaching Materials CD-ROM", on chapter 1), using TMS320C5535 and CCS5. It's working fine to me. I'm using headphones and microphone on the DSP, and I can listen my own voice while I talking. This is the C code example by Texas:
#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( ); // Initialize BSL
pll_frequency_setup(100); //Initialize PLL
aic3204_hardware_init(); // Initialise 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);
asm(" bclr XF");
for ( i = 0 ; i < SAMPLES_PER_SECOND * 600L ;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; // Directly connect inputs to outputs.
right_output = right_input; //
aic3204_codec_write(left_output, right_output);
}
/* Disable I2S and put codec into reset */
aic3204_disable();
printf( "\n***Program has Terminated***\n" );
SW_BREAKPOINT;
}
I'd like measure MIPS on C5535. In this post there is an attached code example and an explanation how to do this (using Timer in C55xx device): http://e2e.ti.com/support/dsp/c5000/f/109/t/48231.aspx.
To use this code example, I need change my codec read/write code to an interrupt based routine. First, 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 works fine, too.
Then:
- I copied the Getting Started Application sources (Chapter 1) to my ezdsp5535 Hello Example.
- I copied the source files from http://processors.wiki.ti.com/index.php/Porting_C5000_Teaching_ROM_to_C5535_eZdsp.
- I deleted lnkx.cmd file.
- I deleted "main.c", and my "hello.c" like this:
#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 "csl_intc.h" // to use interrupt
#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 8000
unsigned long int i = 0;
/* Reference the start of the interrupt vector table */
/* This symbol is defined in file vectors.asm */
extern void VECSTART(void);
Void main()
{
// ========================= application init =====================
USBSTK5505_init( );
pll_frequency_setup(100);
aic3204_hardware_init();
aic3204_init();
set_sampling_frequency_and_gain(SAMPLES_PER_SECOND, 15);
// ===================================================================
IRQ_globalDisable(); // Disable interrupt
IRQ_clearAll(); // Clear any pending interrupts
IRQ_disableAll(); // Disable all the interrupts
IRQ_setVecs((Uint32)(&VECSTART)); // Initialize Interrupt Vector table
//IRQ_enable( .... ); // What interrupt ??????????
IRQ_globalEnable();
return;
}
// Is it correct ???
interrupt void my_interrupt(void)
{
// codec read
Int16 left_input;
Int16 right_input;
left_input = I2S2_W0_MSW_R; // Left intput
right_input = I2S2_W1_MSW_R; // Right intput
// codec write
I2S2_W0_MSW_W = left_input; // Left output
I2S2_W0_LSW_W = 0;
I2S2_W1_MSW_W = right_input; // Right output
I2S2_W1_LSW_W = 0;
}
In hello.tcf file, right click Scheduling->HWI, I can see several interrupts HWI:
What HWI should I use? Is this correct way to change my codec read/write code to an interrupt based routine ? Could anyone help me implement this routine, please? (Posting a example code, or indicating some material).
Thank you so much
Code Composer Studio Version: 5.5.0.00077
DSP/BIOS 5.42.1.09
TMS320C5535 eZDSP
(English isn’t my first language, so please excuse any mistakes)
