Hello,
I am using the OMAP3530EVM by Mistral and I am familiarizing myself with DSPLINK and DSPLIB.
I have used the readwrite example and have modified it to get an input buffer from analog input pass it on to the DSP, fetch back unaltered and put it on the analog audio output. The ARM processor uses ALSA drivers for the audio i/o.
The readwrite example works fine when I have the DSP to do nothing on the received buffer.
Then I tried to do an FFT and immediately and IFFT on the DSP side just to check that I can compile correctly. And this is where the problems begin.
On the DSP side, the only modifications are on tskReadwrite.c
I have defined the necessary buffers and double-word aligned them as follows:
#define TIMEN 2048u
#define FREQN 4096u
#pragma DATA_ALIGN(forward_twiddle_factors,8);
short forward_twiddle_factors[FREQN];
#pragma DATA_ALIGN(reverse_twiddle_factors,8);
short reverse_twiddle_factors[FREQN];
#pragma DATA_ALIGN(fftBuf,8);
short fftBuf[FREQN];
#pragma DATA_ALIGN(cmplxBuf,8);
short cmplxBuf[FREQN];
#pragma DATA_ALIGN(invBuf,8);
short invBuf[FREQN];
Then in the TSR_Execute function I added the following code between the HAL_cacheInv functions that read/write between GPP/DSP
HAL_cacheInv ((Ptr) readBuf, size) ;
for(j=0;j<FREQN/2;j++) {
cmplxBuf[2*j]=readBuf[j];
cmplxBuf[2*j+1]=0;
}
DSP_fft16x16 (forward_twiddle_factors, FREQN, cmplxBuf, fftBuf);
DSP_ifft16x16(reverse_twiddle_factors, FREQN, fftBuf, cmplxBuf);
for (j=0;j<FREQN/2;j++) {
writeBuf[j]=cmplxBuf[2*j];
}
HAL_cacheWbInv ((Ptr)(msg->dspWriteAddr), size) ;
I have used different twiddle factors for FFT and IFFT. As you can see I am constructing a "fake" complex input for the FFT by setting all odd samples of cmplxBuf to zero and all even ones equal to my input buffer. The problem is that after the IFFT cmplxBuf contains mostly zeros and when I fetch it back with the GPP and put it to audio output there is almost no audio except some strange noise.
I also tried using a different array for the output of the IFFT as follows
DSP_fft16x16 (forward_twiddle_factors, FREQN, cmplxBuf, fftBuf);
DSP_ifft16x16(reverse_twiddle_factors, FREQN, fftBuf, invBuf);
for (j=0;j<FREQN/2;j++) {
writeBuf[j]=invBuf[2*j];
}