FFT Evaluation Guide*
Overview*
fft_evaluation is a test App for benchmarking FFT/IFFT performance of the CSKY DSP library. It generates test data and measures the execution time of FFT and IFFT operations on the target platform, helping developers evaluate the chip's audio signal processing capability.
Two operation modes are supported:
- Real FFT (float): uses
csky_rfft_fast_f32, single-precision floating-point - Fixed-point FFT: uses
csky_rfft_q15, Q15 fixed-point
APP Usage*
Build Configuration*
Reference config for fixed-point FFT evaluation:
cp ./configs/release/nationalchip/grus_gx8002b_dev_1v_use_fixed_fft.config .config
Alternatively, configure manually via menuconfig:
LVP Application Settings→ selectFFT Evaluation App- Select operation type (under
real or fixed choice):use real fft— float FFT evaluationuse fixed fft— fixed-point FFT evaluation
Firmware Build*
make menuconfig
make clean; make
Flash output/mcu_nor.bin to the board and check the serial output.
Output*
The App runs FFT+IFFT once during initialization and prints:
fft_input: constructed test data (512-point sawtooth wave)fft time: X us: FFT duration in microsecondsfft_output: frequency-domain data after FFTifft time: X us: IFFT duration in microsecondsifft_output: time-domain data after IFFT
App Working Principle*
Test Data Generation*
A 512-point sawtooth wave is generated in AppInit:
for (int i = 0; i < 512; i++) {
fft_input[i] = (i * 32767) / 511;
}
FFT*
// float: 512-point real FFT
csky_rfft_fast_f32(&csky_rfft_sR_f32_len512, fft_input, fft_output, 0);
// fixed-point: 512-point real FFT
csky_rfft_q15(&csky_rfft_sR_q15_len512, fft_input, fft_output);
IFFT*
// float: IFFT reconstruction
csky_rfft_fast_f32(&csky_rfft_sR_f32_len512, fft_output, fft_input, 1);
// fixed-point: IFFT reconstruction
csky_rfft_q15(&csky_inv_rfft_sR_q15_len512, fft_output, fft_input);
Timing*
Timestamps are captured via gx_get_time_us() before and after the operation:
int start = gx_get_time_us();
// FFT operation
int end = gx_get_time_us();
printf("fft time: %d us\n", end - start);
Key API Reference*
| API | Description |
|---|---|
csky_rfft_fast_f32(instance, input, output, inverse) |
Float real FFT/IFFT; inverse=0 for forward, =1 for inverse |
csky_rfft_q15(instance, input, output) |
Q15 fixed-point real FFT |
csky_inv_rfft_q15(instance, input, output) |
Q15 fixed-point real IFFT (via csky_rfft_q15 with inverse instance) |
gx_get_time_us() |
Get current system time in microseconds, used for performance measurement |
FFT Instance Reference*
| Instance | Type | Description |
|---|---|---|
csky_rfft_sR_f32_len512 |
float | 512-point float real FFT instance |
csky_rfft_sR_q15_len512 |
Q15 | 512-point fixed-point real FFT instance |
csky_inv_rfft_sR_q15_len512 |
Q15 | 512-point fixed-point real IFFT instance |
Notes*
- FFT runs once in
AppInit; re-initialize to trigger again - Input data is fixed to 512 points; modify array size and FFT instance for other sizes (256/1024)
- Float mode demands more MCU compute; fixed-point is more efficient — choose based on use case
- Results are affected by MCU frequency; use dynamic frequency scaling to evaluate performance at different speeds
Reference*
- Dynamic Frequency Adjustment Demo Introduction — how to adjust MCU frequency
- CSKY DSP Library documentation — more FFT APIs and instance configuration