Tool/software: Code Composer Studio
Hi,
I have some problems using DSPF_sp_cfftr2_dit function from DSPLIB (dsp67x.lib) in CCS v5.3 (DSK6713). If the following line is included in the code:
DSPF_sp_cfftr2_dit(fft_in, coeffs, wlen);
I am always getting the noise signal from the codec output (even if the fft result is not directed at the headphone output - please see the code below).
I am getting no errors or warnings while building my project. My configuration is:
linker search paths:
- path to dsplib/lib/dsp67x.lib
- path to rts6700.lib
include options:
- path to dsplib/include
#define CHIP_6713 1
#include <stdio.h>
#include <c6x.h>
#include <csl.h>
#include <csl_mcbsp.h>
#include <csl_irq.h>
#include <math.h>
#include "dsk6713.h"
#include "dsk6713_aic23.h"
#include "DSPF_sp_cfftr2_dit.h"
#include "utility.h"
DSK6713_AIC23_CodecHandle hCodec; // Codec handle
DSK6713_AIC23_Config config = DSK6713_AIC23_DEFAULTCONFIG; // Codec configuration with default settings
#define M_PI 3.14159265358979323846
#define wlen 1024
#define hop2 256
#define hop1 203
#pragma DATA_ALIGN(fft_in, 8)
#pragma DATA_ALIGN(coeffs, 8)
volatile float buffer_in[1280];
volatile Uint16 j=0;
volatile Uint8 frame_ready_flag=0;
float fft_in[2*wlen]; // Processing frame
float coeffs[wlen]={0};
interrupt void serialPortRcvISR(void);
void main()
{
DSK6713_init(); // Initialize the board support library, must be called first
hCodec = DSK6713_AIC23_openCodec(0, &config); // open codec and get handle
// Configure buffered serial ports for 32 bit operation
// This allows transfer of both right and left channels in one read/write
MCBSP_FSETS(SPCR1, RINTM, FRM);
MCBSP_FSETS(SPCR1, XINTM, FRM);
MCBSP_FSETS(RCR1, RWDLEN1, 32BIT);
MCBSP_FSETS(XCR1, XWDLEN1, 32BIT);
// set codec sampling frequency
DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_44KHZ);
// interrupt setup
IRQ_globalDisable(); // Globally disables interrupts
IRQ_nmiEnable(); // Enables the NMI interrupt
IRQ_map(IRQ_EVT_RINT1,15); // Maps an event to a physical interrupt
IRQ_enable(IRQ_EVT_RINT1); // Enables the event
IRQ_globalEnable(); // Globally enables interrupts
Uint8 frame_status = 0;
Uint16 pin=0, pout=0;
Uint16 i=0;
tw_genr2fft(coeffs, wlen);
bit_rev(coeffs, wlen>>1);
// Wait until the first frame will be ready to process
while(frame_status != 4){
frame_status += frame_ready_flag;
frame_ready_flag = 0;
}
while(1)
{
if (frame_ready_flag == 1){
frame_ready_flag = 0;
for (i=0; i<1024; i++){
fft_in[2*i] = buffer_in[(i+pin)%1280];
fft_in[2*i+1] = 0;
}
DSPF_sp_cfftr2_dit(fft_in, coeffs, wlen);
bit_rev(fft_in, wlen);
pin += 256;
}
}
}
interrupt void serialPortRcvISR()
{
union {Uint32 combo; short channel[2];} temp;
temp.combo = MCBSP_read(DSK6713_AIC23_DATAHANDLE);
buffer_in[j] = (float)temp.channel[0];
j++;
// Set frame_ready_flag to 1 if the next frame is ready
if (j%256 == 0){
frame_ready_flag = 1;
}
// Clear circular buffer index
if (j == 1280){
j = 0;
}
MCBSP_write(DSK6713_AIC23_DATAHANDLE, temp.combo);
}
Could you please point me what could be a reason of that?