
1. Re: FFT in Cortex M0
userc_40792 Jun 25, 2013 7:40 PM (in response to ashag_)Hi, Interesting procedure. 0.6m.sec is very fast, Maybe have use integer FFT. I had been made by PSoC5 floating point that is takes 15m.sec 128points. Someday, the module could completed, I'll be upload it. Regards. 
2. Re: FFT in Cortex M0
userc_41385 Jan 13, 2015 11:23 AM (in response to ashag_)Does this FFT work? Or has anybody fixed it?
I had to fix several things to make it compile without warnings.
The input array tries to initialize 128 locations but the array is only [64].
Twiddlereal and twiddleimg are [32], second stage tries to access [32] which is out of bounds.
Seventh stage accesses several arrays out of bounds. I believe this stage isn't used for 64 point FFT.
Stage 1 code makes no sense at all. It gets inputs beyond the array bounds.
Mike

3. Re: FFT in Cortex M0
DaKn_263916 Jan 13, 2015 4:12 PM (in response to ashag_)Asha, is the performance a reflection you used the HW multiplier in
PSOC 4 ?
Regards, Dana.


5. Re: FFT in Cortex M0
DaKn_263916 Jan 27, 2015 2:18 PM (in response to ashag_)Consider filing a CASE and asking Cypress support to contact
Asha to see if it can get updated.
To create a technical case at Cypress 
“Support”
“Technical Support”
“Create a Case”
You have to be registered on Cypress web site first.
Regards, Dana.

6. Re: FFT in Cortex M0
senthilnathanl_ Jan 29, 2015 3:45 AM (in response to ashag_)Hi All,
I'm attaching the PSoC 4 project (PSoC creator 3.2) for 64point FFT computation.
It uses about ~1900 bytes of SRAM. In this example, a 64 pt array is initialized and used as data input for FFT. It completes the calculations in 484usec, when the compiler optimization is set to speed.
Senthilnathan

FFT_64_Point.cyprj.Archive01.zip 629.3 K


7. Re: FFT in Cortex M0
senthilnathanl_ Jan 29, 2015 6:30 AM (in response to ashag_)In the attached project(in my previous response), for the 64point FFT, we need to comment out the lines after line 234 (seventh stage of fft computation, which is needed only for 128 point FFT calculations).
As mentioned in the comment (line 234), that part of the code is for 128point FFT computation. We need to change the parameter NUM_FFT to 128, when using the 128point FFT (by changing line 6  '#define NUM_FFT 128').
For 64point FFT, that is not needed. And if it is there, memory location will be corrupted (overwritten) and will not be correct./Senthilnathan

8. Re: FFT in Cortex M0
content.librarian May 28, 2015 7:39 AM (in response to ashag_)Hello Isen,
Thank you for posting code for FFT in PSoC 4. I have few questions:
1. You mentioned that code can be used with 128point FFT. Does in mean that to try it, the samplep[NUM_FFT] array needs to be initialized with 128 values instead of 64?
2. My understanding is that the output of the calculations will be stored in two arrays  one that contains real values, and another one with imaginary. Can you explain why there are two pairs of arrays, not one? (real0/img0 + real1/img1). What is the difference between the two? Also, what information does twiddlereal and twiddleimg aray contain and do I need them to show FFT magnitude in a plot?
3. I am working on vibration detection project. I can generate more samples than 64/128 in the project if needed. How scalable this algorithm beyond 128point is, and what if anything needs to be changed to go to higher number of points? Also, does it make sense going beyond 128point FFT? I am doing desing on PRoC 4 BLE module so I don't have much resources to begin with.
Thank you for your help.

9. Re: FFT in Cortex M0
DaKn_263916 May 28, 2015 8:08 AM (in response to ashag_)@isen, did you use the internal single cycle 32 bit multiplier in PSO C 4 ?
Regards, Dana.

10. Re: FFT in Cortex M0
content.librarian May 29, 2015 9:30 AM (in response to ashag_)Hello Isen,
I have attached an Excel spreadsheet. It has two tabs.
"Using Cypress Results"  For input, I have 64 values that were used in array initialization. I plotted them vs time and I do see a sine wave. I then added two tables. One has results of Real 0 and Img 0 array, and another has Real 1 and Img 1 arrays. I then calculated magnitude of each pair and plotted them. Neither of the plots shows the expected frequency at ~ 780Hz.
"Excel Method"  I used the same input. I then used Excel builtin FFT calculator. I obtained complex part for every value and calculatued magnitude from there. I plotted, and I did see one spike around 853Hz (not quite 780Hz but close). Then, for some reason after 5KHz, the frequency floor went up and I saw another spike at 7.19KHz. Not sure why this happens but I think If I disregard for a moment frequencies over ~4KHz, the plot looks more like what I would expect than what I see when I plotted results obtained from running routine on PSoC 4.
Would you please comment on my results, and also reply to my questions posted in the previous post?Thanks,

11. Re: FFT in Cortex M0
content.librarian May 29, 2015 10:28 AM (in response to ashag_)Hello Isen,
I just revisited the results obtained for img0/real0, img1/real1 and I ran the code again and noticed that results are different this time from what I have recorded yesterday. I put new numbers in my spreadsheet (see attached spreadsheet with words REVISED DATA at the end of the file name). The plot looks very different but still doesn't make sense.

12. Re: FFT in Cortex M0
maku_1180581 May 30, 2016 2:10 AM (in response to content.librarian)Dear Starik,
concerning the Excel Method:
From a 64 pt. analog signal that goes into an FFT you'll get 32 frequency values. The frequency value at the begin of the graph is the DC offset. Than you can see 31 frequencies. From 33 on the frequency values are just mirrored.
Concering the worksheet Cypress results:
I can't see a spectrum there.
What does Cypress tells us about that?
Is the FFT function working propperly or not?

13. Re: FFT in Cortex M0
MuKa_284621 Jun 21, 2016 5:43 AM (in response to ashag_)Hi everyone,
I just wanted to share Isen's project that I modified for my application. I kept the algorithm at 64points although I had targeted 16points. I added some more libraries to work with an OLED screen using I2C. I attach in a separate zip file some images and a short 5sec video of the thing working.
It bugs me tho that a static sample gives different results every calculation cycle. Is it due to calculation error? If so, it could tally with Starik's observation.
Feel free to comment and try things out (if you have the screen: http://www.cytron.com.my/pdsoledmod, looks like an Adafruit stuff).
Hazique,

FFT_Images.zip 7.1 MB

FFT.cywrk_.Archive01.zip 3.0 MB


14. Re: FFT in Cortex M0
MuKa_284621 Jun 21, 2016 6:41 AM (in response to MuKa_284621)And btw, I haven't used the whole hardware chain just yet, cause I wanted to try out different algorithms for the Fourier transform.