Hi:
I am working on an AUDIO project which uses hwafft. I read SPRABB6A before implement my codes.
(1)Here is my codes:
#define FFT_LENGTH FFT_64PTS
// The Bit-Reverse destination buffer data_br_buf requires an address with
// at least 4+log2(FFT_LENGTH) least significant binary zeros
#pragma DATA_SECTION(data_br_buf, "data_br_buf");
Int32 data_br_buf[FFT_LENGTH];
fft_flag = FFT_FLAG;
scale_flag = NOSCALE_FLAG;
hwafft_br( In_buf, data_br, FFT_LENGTH); // bit-reverse zero-padded coefficients
out_sel = (*Hwafft_Func)(data_br, scratch_fft, fft_flag, scale_flag); // perform FFT
if(out_sel == OUT_SEL_DATA)
{
// buff_copy32(data_br, coeffs_fft, FFT_LENGTH);
}
(2)Here is my cmd file
-stack 0x0800 /* PRIMARY STACK SIZE */
-sysstack 0x0800 /* SECONDARY STACK SIZE */
-heap 0x0800 /* HEAP AREA SIZE */
MEMORY
{
PAGE 0:
VEC(RWX) : origin = 0000100h length = 000100h /* on-chip DARAM 1 */
DATA(RWX) : origin = 0000200h length = 004E00h
PROG(RX) : origin = 0005000h length = 010000h /* PROGRAM size 64K */
SARAM_3 (RWX) : origin = 0016000h length = 002000h /* on-chip SARAM 8K */
SARAM_4 (RWX) : origin = 0018000h length = 002000h /* on-chip SARAM 8K */
…………………………………………………………
SARAM_30 (RW) : origin = 004C000h length = 002000h /* on-chip SARAM 8K */
SARAM_31 (RW) : origin = 004E000h length = 002000h /* on-chip SARAM 8K */
}
SECTIONS
{
.intvec : > VEC ALIGN = 256
.text : > PROG
.data : > DATA
.cinit : > PROG
.switch : > PROG
.stack : > DATA
.sysstack : > DATA
.bss : > DATA
.sysmem : > DATA
.const : > PROG
.cio : > DATA
vectors (NOLOAD)
// The Bit-Reverse destination buffer data_br_buf requires an address with
// at least 4+log2(FFT_LENGTH) least significant binary zeros
data_br_buf : > DATA ALIGN = 1024
scratch_fft_buf : > SARAM_4
}
// VC5505 (PG1.4) HWAFFT Routines ROM Addresses:
_hwafft_br = 0x00ff6cd6;
_hwafft_8pts = 0x00ff6cea;
_hwafft_16pts = 0x00ff6dd9;
_hwafft_32pts = 0x00ff6f2f;
_hwafft_64pts = 0x00ff7238;
_hwafft_128pts = 0x00ff73cd;
_hwafft_256pts = 0x00ff75de;
_hwafft_512pts = 0x00ff77dc;
_hwafft_1024pts = 0x00ff7a56;
(3) Here is my problem:
3.1 First of all, Bit reverse function works. But after Hwafft_Func was called, all 64 values in buffer data_br and scratch_fft are all 0.
3.2 I set break point in Hwafft_Func and do “Assembly step into” then trace into Hwafft_Func. I trace assembly code step by step until exit the Hwafft_Func. The FFT result is correct.
3.3 I do 3.2 again. But I didn’t trace step by step. I let program free run somewhere in Hwafft_Func. Then, The FFT result is incorrect.
3.4 I suspect that “interrupt triggerred by 5515 DMA” might be the reason. Then, I modify codes to disable interrupt and … like followings
Void DMA_isr();
{
If ( this is DMA interrupt )
{
IRQ_globalDisable();
IRQ_clearAll();
IRQ_disableAll();
IRQ_clear(DMA_EVENT);
Call audio filter function which includes Hwafft_Func
IRQ_enable(DMA_EVENT);
IRQ_globalEnable();
}
}
But the result is incorrect and situation is the same as 3.1, 3.2 and 3.3
S.O.S!
I need help!
Daniel
2011-12-08 16:00