fft test software using cmsis DSP library FRDM k22f

Dependencies:   mbed-dsp mbed

Files at this revision

API Documentation at this revision

Comitter:
cpm219
Date:
Fri Sep 30 16:05:16 2016 +0000
Parent:
0:015ecf1bac06
Commit message:
latest version test software on frdm k22f

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 015ecf1bac06 -r 6b7e5eae3a55 main.cpp
--- a/main.cpp	Fri Sep 30 14:51:31 2016 +0000
+++ b/main.cpp	Fri Sep 30 16:05:16 2016 +0000
@@ -12,7 +12,7 @@
 DigitalOut led_g(PTA2);
 DigitalOut led_b(PTD5);
 
-const int FFT_LEN   = 64;
+const int FFT_LEN   = 1024;
 const int bins      = 32;
 
 
@@ -31,7 +31,10 @@
     
     
     int32_t i = 0;
-    
+    printf("\r\n\r\nFFT test program!\r\n");
+    printf("by Curtis Mattull\r\n\r\n\r\n");
+
+
         // Init arm_ccft_32
     switch (FFT_LEN)
     {
@@ -68,23 +71,34 @@
     for(i = 0; i< FFT_LEN*2; i+=2)
     {
         //fast math sine table[512+1]
-        samples[i]      = sinTable_f32[i*4];
+        samples[i]      = sinTable_f32[i/4];
         samples[i+1]    = 0;
     }
     
+    /*multiply the dummy data with more dummy data*/
+//    for(i = 0; i< FFT_LEN*2; i+=2)
+//    {
+//        //fast math sine table[512+1]
+//        samples[i]     +=sinTable_f32[i/2] ;
+//        samples[i+1]    = 0;
+//    }
+    
     // Run FFT on sample data.
     arm_cfft_f32(S, samples, 0, 1);
     // Calculate magnitude of complex numbers output by the FFT.
     arm_cmplx_mag_f32(samples, magnitudes, FFT_LEN);
     
-    for(i = 0; i< FFT_LEN; i++)
+    printf("\r\nThe first 20 bins:\r\n");
+    
+    for(i = 0; i< 20; i++)
     {
-        printf("magnitudes[%f]: %f\r\n",i,magnitudes[i]);
+        printf("magnitudes[%i]: %f\r\n",i,magnitudes[i]);
     }
     
-    
-    printf("test complete");
+    led_g.write(led_on);
 
+    printf("test complete\r\n");
+    wait(1);
     while(1) 
     {