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.

Calculate phase with the C28x FFT-library?

Other Parts Discussed in Thread: TMS320F28035, CONTROLSUITE

Hi there, 

I'm using a TMS320F28035 together with the C28x FFT-library, currently the RFFT module. Calling "void mag(FFT128R_handle);" returns the magnitude squares of the spectral bins. 

Is there any way to also calculate the corresponding phase? The CFFT module doesn't seen to have this possibility either... Or is there another library for this controller with that option? I know that the controller isn't very powerful, but I would still need this functionality. 

Thanks.

  • I believe the phase is given by:

    phase = atan(IM/RE)

    where IM and RE are the imaginary and real parts of the FFT result.

    You should be able to use the IQmath library (in ControlSuite).  You'll first need to do the division (IQNdiv function), and then call the IQNatan() function.  You'll need to be careful with the IQ format.  IQmath lib supports Q1 to Q30 formats.  I believe the C28x fixed-point FFT library you are using supports Q0 to Q31.  So, be careful to use the correct format (e.g., Q1 to Q30 for IQmath).  You will also need to be careful that the complex results array is in the proper format (i.e., RE, IM, RE, IM, ..., or whatever order the IQmath library expects).

    Regards,

    David

  • Hi David, 

    thanks a lot for the quick reply, I'll try to solve my problem with the IQmath library.

    Best regards,

    Andreas

  • Hi there, 

    I have two further question regarding this topic:

    1) I'm currently using the 2002 release of the C28x FFT library. Browsing through the Control Suite with the TI Resource Explorer I just recognized that the current version is v1.01 and the version from May 2002 is said to be Beta 1. Looking through the documentation of v1.01 (which is much shorter than the one from Beta 1) I just saw that the "split function" is missing in the new release. Was the "split function" for RFFT merged with the "calc function"?

    2) Data in the "ipcb" (in place computation buffer) is in the Q31 format. Is my assumption right that I just have to bit-shift this data to the right to get Q30 data? Will the sign still be correct?

    Q31>>1 = Q30 ???

    Regards,

    Andreas

  • Andreas,

    ASP said:

    1) I'm currently using the 2002 release of the C28x FFT library. Browsing through the Control Suite with the TI Resource Explorer I just recognized that the current version is v1.01 and the version from May 2002 is said to be Beta 1. Looking through the documentation of v1.01 (which is much shorter than the one from Beta 1) I just saw that the "split function" is missing in the new release. Was the "split function" for RFFT merged with the "calc function"?

    I'm not sure.  Someone from the SW applications team will need to comment.  Hopefully they'll pick this question up on the forum.

    ASP said:

    2) Data in the "ipcb" (in place computation buffer) is in the Q31 format. Is my assumption right that I just have to bit-shift this data to the right to get Q30 data? Will the sign still be correct?

    Q31>>1 = Q30 ???

    You are correct!  The sign will be correct since the data type is signed.  Therefore, the compiler will generate an arithmetic shift with sign-extension enabled.  The compiler will know what to do.

    Regards,

    David