I have been experimenting with fixed point vs floating point and DIT vs single block FFTs on the M4 of a Psoc 6. I have come across some behavior that looks strange to me, but hopefully the symptom points to something obvious to someone with more experience. Any response would be greatly appreciated.
With the fixed point version I can get a good output, but only if I declare the input and output buffers locally within my FIR/FFT function along with another buffer of the same size that isn't even used. This function just casts my 16 bit TWF into the q31 input buffer, applies a low pass FIR filter, computes FFT, complex to magnitude, and lastly casts q31 FFT into a 16 bit output. The third buffer was normally commented out when I was trying the fixed point version, but I accidentally left it in and was surprised when I saw the good output.
I am using the arm_math library, specifically the 8192 block size arm_rfft_q31. Here is the good output. I get this if I declare the q31 input and output buffers locally along with a float32 buffer that is only used superficially so it doesn't get optimized out. (Input is 60Hz sine wave @ .4g's)
Here is the output I get no matter how else I declare the buffers. I can declare them all globally or any combination of global and local that isn't the case above. (Input is 60Hz sine wave @ .4g's). The output is half band and has what look like harmonics, but they are 113Hz apart, so they don't appear to be harmonics of the input signal.
I tried modifying the linker file to create a section in memory specifically for the input and output buffers. I have also tried increasing the size of the input and output buffers and this actually slightly changes the result (moves around the "harmonics"), but no matter how much I increase the size I still get what looks like a half band with some harmonics.
I can get a good output with the global buffers if I do DIT on two 4096 FFTs, but it crushes my efficiency and the output looks more noisy so I'd rather not do that. Declaring these large buffers locally means they are assigned each time the function is called. This is ~100KB of memory that is reassigned over and over. Is this a problem? Does this point to what might be happening?
I have limited experience working with microprocessors, so please let me know what info I can provide to help solve this. Thank you for reading.