This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS FFT

Hi All, My Question is related to CMSIS DSP Library. i'm working on ADuCM3029 EZ-KIT. I'm using IAR v7.8.1 to build the project. In my application i have an ADC interfaced with the controller, from which i acquire 60 samples and stores it into the buffer. I intend to do math operations (FFT to be specific) on the acquired buffer, I've enabled use CMSIS option and Checked DSP library in the project settings. but the size of my code increases horrendously as soon as I include FFT operation, and becomes ~83 KB from ~9 KB. Is there anything that i'm doing wrong over here? Is there a better way to add FFT functionality to the project without letting the size increase horrendously? 

 

Along with this, I can see that when FFT function is executed, the array realCoefBQ15 is getting overlapped into one of the SPI descriptor which is causing Bus Fault Error. Since I'm using 64 Point radix 2 FFT, that many twiddle factor coefficients are of no use. I understand it has been defined in that way so that the same array can  be used for upto 4096 points FFT.

Is there any way to avoid this? I'm using IAR v7.8.1

Any help will be deeply appreciated. 

  • Check the map file and see what has been added. Since the ADUC is an CM3, the linker might also pull in FPU library.
    And the overlap seems to be your fault, defining too small buffer.

  •  @42Bastian Yes,  you're right, I had checked on the map file, i could see that many arrays of twiddle factor coefficients of different points is getting linked, since i'm interested only in 64 point FFT, those arrays are redundant and space consuming, excerpts from the map file,

    twiddleCoef_1024_q15 0x000013d0 0xc00 Data Gb arm_common_tables.o [4]
    twiddleCoef_128_q15 0x00000950 0x180 Data Gb arm_common_tables.o [4]
    twiddleCoef_16_q15 0x00000800 0x30 Data Gb arm_common_tables.o [4]
    twiddleCoef_2048_q15 0x00001fd0 0x1800 Data Gb arm_common_tables.o [4]
    twiddleCoef_256_q15 0x00000ad0 0x300 Data Gb arm_common_tables.o [4]
    twiddleCoef_32_q15 0x00000830 0x60 Data Gb arm_common_tables.o [4]
    twiddleCoef_4096_q15 0x000037d0 0x3000 Data Gb arm_common_tables.o [4]
    twiddleCoef_512_q15 0x00000dd0 0x600 Data Gb arm_common_tables.o [4]
    twiddleCoef_64_q15 0x00000890 0xc0 Data Gb arm_common_tables.o [4]

    Also, 

    Two arrays realCoefAQ15[8192] and realCoefBQ15[8192] is been used by the initialization function of FFT and by the FFT computation function too, since these many twiddle factors coefficients are not needed as i'm computing 64 Point FFT, the memory overlapping is happening because of these two arrays. is there any way to resolve it?

  • Hi,

    Concerning CMSIS DSP FFT twiddle coeff array, in its original state, it takes 12kB of constant data but as you figured, you only need a really smaller set of consts in case of 64 points FFT (in fact, 96 Q15 const => 192 bytes).

    This would definittely improve your ROM usage but this does not explain the code size increase you noticed. In order to analyze properly, I do agree with 42Bastian Schick, look at you map file.

    If you want to "limit" cosntants to what is needed by your application, you would need to modify source code of CMSIS DSP FFT. This modification is not so difficult since you would only need to study the twiddle coeff addressing mechanism and simplify it to only work when FFT length is 64.

    I expect the whole FFT code+const to take less than 2kB on a cortex M3.

    Also, I took a look at latest CMSIS DSP sources (https://github.com/ARM-software/CMSIS/releases), it seems that they changed this in newer versions. Therefore I would recommend to switch to latest version !

    Best regards,