Hi Your mail was chopped off a bit, so I needed to make some guesses. What follows is not 100% working but you should be able to get going from here. Here are some things to keep in mind. - When you say 'Trouble' or 'Cant run' this can be a bit vague. Did it sound bad, or did the program totally crash? - You seemed to jump directly to the filter program. A simple IN->OUT loop should be tried first. There is an AIC loopback example written in C (LOOP_C3K.C) given with the DSK materials. This will show you some ways to use the stereo codec. There is also a stereo FIR examples (FIR_C3K.C) that also has an FIR filter generator built in. - You wrapped the function 'AICSET_I()' around 'InitPCM3003()'. In it I noticed that you cleared the IF register. Generally you dont want to do this as a serial port underrun could stop the flag setting mechanism. - The linker command was not given. Where did the linker put your code and data? Generate a MAP file to see where things have been placed. Also, looking at the map file you may find a section or two that have not been given allocation information. In these cases those sections are placed sequentially beginning at address 0x0, and that wont work. - Some functions like UPDATE_SAMPLE() appear before a prototype has been defined. In these cases the compiler assumes the inputs and outputs are integer. Your function is int in/out so you should be OK in this case, but be warned. - If you place a line or two of code within the ISR or main loop that toggles an external pin (like an IOF line) you can use this to see if the loop is running. To get something working... - There was no interrupt branch table so your interrupts where going nowhere - You dont need TWAIT (something was wrong here) - The AIC receive data is left justified, while transmit is right justified - This is a stereo codec. You will need to poll the LRCIN bit either from CPLD status or as INT1 flag after setting the enable bit. As is, a simple loopback will maintain L/R matching but you could see the L/R channels cross over once in awhile. When you add the filter, things wont work. The reason is that you are pumping both L and R through one filter and outputing one output to both L and R. IE it sounds strange. Hope this helps Best regards Keith Larson DSP and Analog Consulting home.comcast.net/~klarsondsp /*FIRDMOVE.C - FIR FILTER MOVING THE DATA AND NOT POINTERS*/ #include "pcm3003.h" #include "pcm3003c.c" /*include AIC com routines */ //#include "bp45coef.h" /*include coefficient file */ #include "C3MMR.H" #define BP0 asm(" .global BREAKPOINT_0"); asm("BREAKPOINT_0: nop"); #define BP1 asm(" .global BREAKPOINT_1"); asm("BREAKPOINT_1: nop"); #define N 16 int UPDATE_SAMPLE(int output); void AICSET_I(void); float DLY[N]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // delay samples float H[N]={0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0}; // avg of 5 samples volatile int data_in, data_out; void filt(float *h,float *dly,volatile int *IO_input,volatile int *IO_output,int n) { int i, t; float acc; for (t = 0; t < n; t++) { asm(" idle"); /*wait for interrupt */ acc = 0.0; dly[0] = *IO_input; /*newest input sample*/ for (i = 0; i < n; i++) acc += h[i] * dly[i]; for (i = n-1; i > 0; i--) dly[i] = dly[i-1]; /*update samples */ *IO_output = acc; } } void c_int05(void) // function to update sample { *S0_xdata = data_out; // output sample data_in = *S0_rdata>>12; // input sample } #define IDLE asm(" idle"); void main(void) { volatile int *IO_INPUT, *IO_OUTPUT; int ramp =0; IO_INPUT = &data_in; IO_OUTPUT = &data_out; InitPCM3003(3); asm(" or 10h,IE"); for(;;) { IDLE //*IO_OUTPUT = *IO_INPUT; // simple loop back filt((float *)H,(float *)DLY,IO_INPUT,IO_OUTPUT,N); } } /*=================================================================== Install the XINT/RINT ISR branch vectors ====================================================================*/ asm(" .global _c_int05 "); asm(" .sect \"BRTBL\""); /* secondary branch table */ asm(" br _c_int05 "); /* XINT0 */ asm(" br _c_int05 "); /* RINT0 */ asm(" .text "); |