AlazarFFTSetScalingAndSlicing#
Function Syntax#
-
RETURN_CODE AlazarFFTSetScalingAndSlicing(dsp_module_handle dspHandle, U8 slice_pos, float loge_ampl_mult)#
Sets internal scaling and slicing parameters in the FFT module.
This function modifies internal parameters used by the on-FPGA FFT module to convert the output of the FFT engine to the desired format. Please refer to the figure below for details as to where conversions happen.
- Remark
This function is only valid for on-FPGA FFT modules with version less than 5.
Standard FFT algorithms use floating point precision to obtain frequency domain data, which is not the case with the on-FPGA FFT module. A re-scaling of the standard FFT data must be done to obtain corresponding onFPGA data:
FPGA_LINEAR_AMP^2 = (REAL^2 + IMAG^2) / SLICE_FACTOR; FPGA_LOG = loge_ampl_mult * ln((REAL^2 + IMAG^2)/256); FPGA_REAL = REAL / 16; FPGA_IMAG = IMAG / 16;
Where REAL and IMAG are the real and imaginary parts of the standard FFT algorithm. loge_ampl_mult is the value passed as argument. The SLICE_FACTOR value depends on the output format such as:
U8 format: SLICE_FACTOR = 2^(slice_pos + 1);
U16 format: SLICE_FACTOR = 2^(slice_pos - 7);
U32 format: SLICE_FACTOR = 2^(slice_pos - 23);
Float format: SLICE_FACTOR = 256;
To use this function in your program, it is necessary to call it after AlazarFFTSetup(), because this is where default scaling and slicing values are set.
Warning
This function is intended for advanced users only. Calling it with the wrong parameters can prevent any meaningful data from being output by the FFT module.
Warning
This function should not be used with AlazarFFTSetGainAndOffset(). Using both will result in undefined behaviors.
- Parameters:
dspHandle – Handle to DSP module
slice_pos – This parameter indicates the position of the most significant bit of the output of slicing operations with respect to the input. Lowering this value by one has the effect of multiplying the output of the FFT module by 2. Default value is 7 for log outputs and 38 otherwise. On the block diagram, this parameter applies to all blocks marked ‘Slice’.
loge_ampl_mult – This controls a multiplicative factor used after the log conversion in the FFT module. Hence, it does not apply to ‘amplitude squared’ outputs. Default value is 4.3429446 for U8 log and float log outputs, and 1111.7938176 for U16 log output.