I realize that I could be making some mistakes in my code, or missing something fundamental, but I seem to have found some errors in rfft(). I have included a link to a zipped project for Code Composer Studio 3 so that you can see what I'm doing and determine whether the problem is in my code or the DSPLib.
http://www.sounds.wa.com/K1/alias.zip
I am focused on 128-point real FFT results, and so I am using the sine table in the TMS320VC5506 to generate sine waves that are multiples of the sample rate. These are intended as test signals so I can understand the proper operation - from input to output - of the rfft() function provided as source with CCS3. Ignoring DC, there are 127 distinct frequencies which would fall into exactly one bin of the FFT results, and I am focusing on the 63 frequencies below Nyquist. My code steps through most of these, and then scans the results to summarize.
What I have noticed is that only a few frequencies produce pure results, falling into only one FFT result bin. More often than not, I get a complementary bin which looks like a negative frequency, but the problem is that I would only expect this to happen with frequencies above Nyquist. As a small side note, most bins seem to have a magnitude of at least 1, which I blame on my rectangular-to-polar conversion code or rounding errors.
Can anyone explain the ghosting? What's strange is that the power (magnitude) seems to be shared between the expected bin and the mirror. When only one bin has a magnitude (what I expect), the amplitude is near full (also expected), but when there is a second bin, the amplitude is shared so that the sum of the two would be approximately full. I'm guessing that this means there is some distortion in the sine waves that I create, but I cannot explain it myself, and have reviewed the code.
Take a look, and tell me what's up. Hopefully the source will explain everything I'm doing. The printf() output tries to skip over frequencies where only one bin has magnitude, but whenever more than one bin has something significant, the DSP code prints a report to CCS3 with the amplitude as a 4-digit hex value, followed by the bin number in hex. The last number on each line is the frequency number for the test signal, so you should expect the bin with the same number to be the only one with any amplitude. Follow up here if running the project results in further questions.
P.S. I realize that the code before and after rfft() is far from optimal. If this were production code, then I would optimize and potentially write many of those loops using assembly intrinsics. At the moment, though, I'm focused on the results from rfft() and not on full utilization of the DSP abilities.
Thanks in advance.