This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR6889: Use of "DSPLib.h" library to measure FFT

Part Number: MSP430FR6889

Hello,

I am using MSP430 and BMI160 in a project. I am using the BMI160 accelerometer to measure vibration. The idea is to use the DSPLib's FFT function to determine the dominant frequency in a vibration event. Based on my current understanding of FFT analysis, I realized that I need the number of samples, which should be 2^n data points, and I will also need the sampling frequency. When I am using this function:

msp_status msp_fft_fixed_q15	(	const msp_fft_q15_params * 	params,
int16_t * 	src 
)	

I am passing the "params" and "src" parameters (source):

params: Pointer to the real FFT parameter structure. 
src: Pointer to the real data array to perform the FFT on.

And I think this is the parameter structure (source: DSPLib_transform.h):

typedef struct msp_fft_q15_params {
    //! \details
    //! Length of the source data, must be a power of two.
    uint16_t length;
    //! \details
    //! Perform bit-reversal of the input before transformation. This step is
    //! mandatory, this parameter only exists for applications that might handle
    //! bit reversal when storing the data samples to memory. If not this needs
    //! to be set to true.
    bool bitReverse;
    //! \details
    //! Pointer to the twiddle coefficient table with size greater than or equal
    //! to the source length. When using LEA this can be a NULL pointer.
    const _q15 *twiddleTable;
} msp_fft_q15_params;

When I am sending the "scr" parameter, I am sending the actual data points and their amplitude. So, for example, if I am taking 1024 samples from the z-axis of the accelerometer, I am storing the amplitudes of 1024 consecutive samples in that array.

But I am not sure how I am passing the sampling frequency of the samples to the FFT function. I would really appreciate it if someone could explain how this FFT function is doing the FFT analysis.

Thank you.

  • The FFT function does not care about the frequency. That is only used when you interpret the data. For example, the FFT for 1024 points taken at 1 Hz, is the came calculation as 1024 points at 1 MHz. The only difference is that for the first case the sample bins are 1Hz/1024 and the other 1MHz/1024.

  • Thank you for your response. So, for example, if I want to take 1024 samples with a frequency of 1 Hz, should I just add a delay of 1 second after reading each data? In that way, the sample bin would be 1Hz/1024. 

    Maybe I am not understanding the process completely. I have seen a few examples, but everywhere they are using an equation which is a combination of two sin waves and they are just taking the samples. Would it be possible to share a code example where the data is being received from a sensor and the FFT is being applied to it using the "msp_fft_fixed_q15()" function?

  • Yes, you are correct. The first thing to set is the sample rate, everything else follows that.

  • I don't believe TI has any examples to do exactly what you've described. However, you should be able to easily take an FFT example and use data from your  sensor.

    Regards,

    Evan

**Attention** This is a public forum