We call the built-in library function of CCS (DSPF_sp_fftSPxSP (2048, left_Winout_buffer, twidle_buffer, fft_out, brew, 2, 0, 2048);), The result was found to be incorrect.
The input data is as follows, and the calculation results are shown in the result.xlsx table.
Is the calling method of this function correct? Or is there something wrong with the settings? Is there a document that can provide us with instructions for using this function?
unsigned char brev[64] = {
0x0, 0x20, 0x10, 0x30, 0x8, 0x28, 0x18, 0x38,
0x4, 0x24, 0x14, 0x34, 0xc, 0x2c, 0x1c, 0x3c,
0x2, 0x22, 0x12, 0x32, 0xa, 0x2a, 0x1a, 0x3a,
0x6, 0x26, 0x16, 0x36, 0xe, 0x2e, 0x1e, 0x3e,
0x1, 0x21, 0x11, 0x31, 0x9, 0x29, 0x19, 0x39,
0x5, 0x25, 0x15, 0x35, 0xd, 0x2d, 0x1d, 0x3d,
0x3, 0x23, 0x13, 0x33, 0xb, 0x2b, 0x1b, 0x3b,
0x7, 0x27, 0x17, 0x37, 0xf, 0x2f, 0x1f, 0x3f
};
void gen_twiddle_fft_sp(void)
{
int i, j, k;
int n = 2048;
double x_t, y_t, theta1, theta2, theta3;
for (j = 0; j <= 2*n; j++)
{
twiddle_buffer[j] = 0;
}
for (j = 1, k = 0; j <= n >> 2; j = j << 2)
{
for (i = 0; i < n >> 2; i += j)
{
theta1 = 2 * PI * i / n;
x_t = cos (theta1);
y_t = sin (theta1);
twiddle_buffer[k] = (float) x_t;
twiddle_buffer[k + 1] = (float) y_t;
theta2 = 4 * PI * i / n;
x_t = cos (theta2);
y_t = sin (theta2);
twiddle_buffer[k + 2] = (float) x_t;
twiddle_buffer[k + 3] = (float) y_t;
theta3 = 6 * PI * i / n;
x_t = cos (theta3);
y_t = sin (theta3);
twiddle_buffer[k + 4] = (float) x_t;
twiddle_buffer[k + 5] = (float) y_t;
k += 6;
}
}
Sine wave 1000Hz generation:
for (j = 0; j < FFT_length / 2; j++) {
left_Winout_buffer[2 * j] = sinf(0.13089969389957471826927680763665 * j);
left_Winout_buffer[2 * j + 1] = 0.0;
}