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.
Hi,
I'm trying to implement an FFT using code based on the example in 2837x_vcu2_cfft_1024.
As a starting point I have copied the main.c flow of execution but the results are suspicious, so I have a few questions:
1. During set-up of the CFFT descriptor, in your example pTwiddleFactors isn't set. If this should be set then how? (there is an extern reference to vcu2_twidddleFactors in vcu2_fft.h)
2. In documentation I can't find any reference to how to use the CFFT descriptor element twiddleSkipStep. It is declared as int16_t, but how do I choose a value for this?
3. I am using the same data_input.h and data_output.h files as per the example, and in Debug I can see this data appear in buffer1Q15, so it looks like it is available for the FFT to process.
4. initiSystemClocks() and initPie() are already called in the set-up before I call the FFT, and so is omitted here.
5. I am following the sequence:
a) initialise buffers
b) set up CFFT descriptor
c) execute the CFFT_init1024Pt(), CFFT_run1024Pt() and CFFT_unpack() functions in that order.
6. The output buffer (buffer2Q15) contains a repeated sequence of values such as 5,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0, ... (I suspect this may be a clue to what I'm doing wrong and/or not doing!)
Does any of this make sense to you? Does it suggest to you a particular problem and solution?
As a side-issue, Code Composer Studio complains about the code not being MISRA-compliant, so once this runs successfully I shall need to improve the code quality somewhat.
TIA for your help.
Sira,
As requested, I have pasted some of the MISRA violations below.
They are taken from my "fft.c" file using code from the "main.c" file in the TI example code.
>> The following warnings at lines 99, 102 and 105 of my fft.c file relate to the following statements in main.c in the TI example:
int16_t buffer1Q15[2u*NSAMPLES] = {
#include "data_input.h"
};
int16_t goldenOutputQ15[2u*NSAMPLES] = {
#include "data_output.h"
};
int16_t goldenfftOutputQ15[2u*NSAMPLES] = {
#include "data_input.h"
};
"../util/fft.c", line 99: warning #1425-D: (MISRA-C:2004 19.1/A) #include statements in a file should only be preceded by other preprocessor directives or comments
"..\util\data_input.h", line 269: warning #1504-D: (MISRA-C:2004 19.15/R) Precautions shall be taken in order to prevent the contents of a header file being included twice
"../util/fft.c", line 102: warning #1425-D: (MISRA-C:2004 19.1/A) #include statements in a file should only be preceded by other preprocessor directives or comments
"..\util\data_output.h", line 269: warning #1504-D: (MISRA-C:2004 19.15/R) Precautions shall be taken in order to prevent the contents of a header file being included twice
"../util/fft.c", line 105: warning #1425-D: (MISRA-C:2004 19.1/A) #include statements in a file should only be preceded by other preprocessor directives or comments
"..\util\data_input.h", line 269: warning #1504-D: (MISRA-C:2004 19.15/R) Precautions shall be taken in order to prevent the contents of a header file being included twice
>> The following warnings at line 771 of my fft.c file relate to the following statement in main.c in the TI example:
>> statement: CFFT.init = (void (*)(void *))CFFT_init1024Pt;
"../util/fft.c", line 721: warning #1472-D: (MISRA-C:2004 16.3/R) Identifiers shall be given for all of the parameters in a function prototype declaration
"../util/fft.c", line 721: warning #1422-D: (MISRA-C:2004 16.9/R) A function identifier shall only be used with either a preceding &, or with a parenthesised parameter list, which may be empty (function "CFFT_init1024Pt")
"../util/fft.c", line 721: warning #1398-D: (MISRA-C:2004 11.1/R) Conversions shall not be performed between a pointer to a function and any type other than an integral type
"../util/fft.c", line 721: warning #515-D: a value of type "void (*)(void *)" cannot be assigned to an entity of type "void (*)(void)"
>> The following warnings at line 772 of my fft.c file relate to the following statement in main.c in the TI example:
>> statement: CFFT.run = (void (*)(void *))CFFT_run1024Pt;
"../util/fft.c", line 722: warning #1472-D: (MISRA-C:2004 16.3/R) Identifiers shall be given for all of the parameters in a function prototype declaration
"../util/fft.c", line 722: warning #1422-D: (MISRA-C:2004 16.9/R) A function identifier shall only be used with either a preceding &, or with a parenthesised parameter list, which may be empty (function "CFFT_run1024Pt")
"../util/fft.c", line 722: warning #1398-D: (MISRA-C:2004 11.1/R) Conversions shall not be performed between a pointer to a function and any type other than an integral type
"../util/fft.c", line 722: warning #515-D: a value of type "void (*)(void *)" cannot be assigned to an entity of type "void (*)(void)"
Do you have answer yet to my main question?
Kind regards,
Ian
Sira,
Thanks for your reply. I shall try the FPU implementation this morning and let you know the result.
With regard to showing MISRA violations, the CCS8 install was from the TI CCS download (version 8.1.0.00011), so nothing too exotic there.
The MISRA settings were made in Project Properties (CCS Build -> C2000 Compiler -> Advanced Options -> MISRA-C:2004), with any violations appearing in the Console panel (along with any other errors or warnings) at the end of building the project. No plugs-ins were required.
My specific settings are below:
I hope this helps.
Kind regards,
Ian
Sira,
It looks like the FPU implementation is working for me now - the output looks sensible whereas the VCU implementation didn't.
Very many thanks for your excellent detailed help.
Kind regards,
Ian