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 DSP - FFT / RFFT

Recently I've been trying to implement FFT provided in CMSIS-DSP libraries. And something strange happens
- some of output array elements have values below 0.

I am using arm_rfft_fast_f32. According to documentation (https://www.keil.com/pack/doc/CMSIS/DSP/html/arm__rfft__fast__f32_8c.html)
I need to give arguemnts like (pointer to instance, input array pointer, output array pointer).

My float input array looks like this (genereted for testing purpose with MATlab)

float32_t tab[1024] = {2252, 2264, 2277, 2289, 2302, 2315, 2327, 2340, 2352, 2365, 2377, 2390, 2402, 2415, 2427, 2440, 2452, 2465, 2477, 2490, 2502, 2515, 2527, 2540, 2552, 2565, 2577, 2589, 2602, 2614, 2627, 2639, 2651, 2664, 2676, 2688, 2700, 2713, 2725, 2737, 2749, 2761, 2774, 2786, 2798, 2810, 2822, 2834, 2846, 2858, 2870, 2882, 2894, 2906, 2918, 2930, 2942, 2953, 2965, 2977, 2989, 3000, 3012, 3024, 3035, 3047, 3058, 3070, 3081, 3093, 3104, 3116, 3127, 3139, 3150, 3161, 3172, 3184, 3195, 3206, 3217, 3228, 3239, 3250, 3261, 3272, 3283, 3294, 3304, 3315, 3326, 3337, 3347, 3358, 3368, 3379, 3389, 3400, 3410, 3420, 3431, 3441, 3451, 3461, 3471, 3482, 3492, 3502, 3511, 3521, 3531, 3541, 3551, 3560, 3570, 3580, 3589, 3599, 3608, 3617, 3627, 3636, 3645, 3654, 3664, 3673, 3682, 3691, 3700, 3708, 3717, 3726, 3735, 3743, 3752, 3760, 3769, 3777, 3786, 3794, 3802, 3810, 3818, 3826, 3834, 3842, 3850, 3858, 3866, 3874, 3881, 3889, 3896, 3904, 3911, 3918, 3926, 3933, 3940, 3947, 3954, 3961, 3968, 3975, 3982, 3988, 3995, 4001, 4008, 4014, 4021, 4027, 4033, 4039, 4046, 4052, 4057, 4063, 4069, 4075, 4081, 4086, 4092, 4097, 4103, 4108, 4113, 4118, 4124, 4129, 4134, 4139, 4143, 4148, 4153, 4157, 4162, 4167, 4171, 4175, 4180, 4184, 4188, 4192, 4196, 4200, 4204, 4207, 4211, 4215, 4218, 4222, 4225, 4228, 4232, 4235, 4238, 4241, 4244, 4247, 4250, 4252, 4255, 4257, 4260, 4262, 4265, 4267, 4269, 4271, 4273, 4275, 4277, 4279, 4281, 4282, 4284, 4285, 4287, 4288, 4289, 4291, 4292, 4293, 4294, 4295, 4295, 4296, 4297, 4297, 4298, 4298, 4299, 4299, 4299, 4299, 4299, 4299, 4299, 4299, 4299, 4298, 4298, 4297, 4297, 4296, 4295, 4295, 4294, 4293, 4292, 4291, 4289, 4288, 4287, 4285, 4284, 4282, 4281, 4279, 4277, 4275, 4273, 4271, 4269, 4267, 4265, 4262, 4260, 4257, 4255, 4252, 4250, 4247, 4244, 4241, 4238, 4235, 4232, 4228, 4225, 4222, 4218, 4215, 4211, 4207, 4204, 4200, 4196, 4192, 4188, 4184, 4180, 4175, 4171, 4167, 4162, 4157, 4153, 4148, 4143, 4139, 4134, 4129, 4124, 4118, 4113, 4108, 4103, 4097, 4092, 4086, 4081, 4075, 4069, 4063, 4057, 4052, 4046, 4039, 4033, 4027, 4021, 4014, 4008, 4001, 3995, 3988, 3982, 3975, 3968, 3961, 3954, 3947, 3940, 3933, 3926, 3918, 3911, 3904, 3896, 3889, 3881, 3874, 3866, 3858, 3850, 3842, 3834, 3826, 3818, 3810, 3802, 3794, 3786, 3777, 3769, 3760, 3752, 3743, 3735, 3726, 3717, 3708, 3700, 3691, 3682, 3673, 3664, 3654, 3645, 3636, 3627, 3617, 3608, 3599, 3589, 3580, 3570, 3560, 3551, 3541, 3531, 3521, 3511, 3502, 3492, 3482, 3471, 3461, 3451, 3441, 3431, 3420, 3410, 3400, 3389, 3379, 3368, 3358, 3347, 3337, 3326, 3315, 3304, 3294, 3283, 3272, 3261, 3250, 3239, 3228, 3217, 3206, 3195, 3184, 3172, 3161, 3150, 3139, 3127, 3116, 3104, 3093, 3081, 3070, 3058, 3047, 3035, 3024, 3012, 3000, 2989, 2977, 2965, 2953, 2942, 2930, 2918, 2906, 2894, 2882, 2870, 2858, 2846, 2834, 2822, 2810, 2798, 2786, 2774, 2761, 2749, 2737, 2725, 2713, 2700, 2688, 2676, 2664, 2651, 2639, 2627, 2614, 2602, 2589, 2577, 2565, 2552, 2540, 2527, 2515, 2502, 2490, 2477, 2465, 2452, 2440, 2427, 2415, 2402, 2390, 2377, 2365, 2352, 2340, 2327, 2315, 2302, 2289, 2277, 2264, 2252, 2239, 2227, 2214, 2202, 2189, 2176, 2164, 2151, 2139, 2126, 2114, 2101, 2089, 2076, 2064, 2051, 2039, 2026, 2014, 2001, 1989, 1976, 1964, 1951, 1939, 1926, 1914, 1902, 1889, 1877, 1865, 1852, 1840, 1828, 1815, 1803, 1791, 1779, 1766, 1754, 1742, 1730, 1718, 1706, 1694, 1681, 1669, 1657, 1645, 1633, 1621, 1609, 1598, 1586, 1574, 1562, 1550, 1538, 1527, 1515, 1503, 1491, 1480, 1468, 1457, 1445, 1434, 1422, 1411, 1399, 1388, 1376, 1365, 1354, 1342, 1331, 1320, 1309, 1298, 1287, 1276, 1264, 1253, 1243, 1232, 1221, 1210, 1199, 1188, 1178, 1167, 1156, 1146, 1135, 1125, 1114, 1104, 1093, 1083, 1073, 1063, 1052, 1042, 1032, 1022, 1012, 1002, 992, 982, 972, 963, 953, 943, 934, 924, 914, 905, 895, 886, 877, 867, 858, 849, 840, 831, 822, 813, 804, 795, 786, 778, 769, 760, 752, 743, 735, 726, 718, 710, 701, 693, 685, 677, 669, 661, 653, 645, 638, 630, 622, 615, 607, 600, 592, 585, 578, 571, 563, 556, 549, 542, 535, 529, 522, 515, 509, 502, 496, 489, 483, 476, 470, 464, 458, 452, 446, 440, 434, 429, 423, 417, 412, 406, 401, 395, 390, 385, 380, 375, 370, 365, 360, 355, 351, 346, 341, 337, 333, 328, 324, 320, 316, 312, 308, 304, 300, 296, 292, 289, 285, 282, 278, 275, 272, 269, 266, 263, 260, 257, 254, 251, 249, 246, 244, 241, 239, 237, 234, 232, 230, 228, 226, 225, 223, 221, 220, 218, 217, 215, 214, 213, 212, 211, 210, 209, 208, 207, 207, 206, 206, 205, 205, 205, 204, 204, 204, 204, 204, 205, 205, 205, 206, 206, 207, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 220, 221, 223, 225, 226, 228, 230, 232, 234, 237, 239, 241, 244, 246, 249, 251, 254, 257, 260, 263, 266, 269, 272, 275, 278, 282, 285, 289, 292, 296, 300, 304, 308, 312, 316, 320, 324, 328, 333, 337, 341, 346, 351, 355, 360, 365, 370, 375, 380, 385, 390, 395, 401, 406, 412, 417, 423, 429, 434, 440, 446, 452, 458, 464, 470, 476, 483, 489, 496, 502, 509, 515, 522, 529, 535, 542, 549, 556, 563, 571, 578, 585, 592, 600, 607, 615, 622, 630, 638, 645, 653, 661, 669, 677, 685, 693, 701, 710, 718, 726, 735, 743, 752, 760, 769, 778, 786, 795, 804, 813, 822, 831, 840, 849, 858, 867, 877, 886, 895, 905, 914, 924, 934, 943, 953, 963, 972, 982, 992, 1002, 1012, 1022, 1032, 1042, 1052, 1063, 1073, 1083, 1093, 1104, 1114, 1125, 1135, 1146, 1156, 1167, 1178, 1188, 1199, 1210, 1221, 1232, 1243, 1253, 1264, 1276, 1287, 1298, 1309, 1320, 1331, 1342, 1354, 1365, 1376, 1388, 1399, 1411, 1422, 1434, 1445, 1457, 1468, 1480, 1491, 1503, 1515, 1527, 1538, 1550, 1562, 1574, 1586, 1598, 1609, 1621, 1633, 1645, 1657, 1669, 1681, 1694, 1706, 1718, 1730, 1742, 1754, 1766, 1779, 1791, 1803, 1815, 1828, 1840, 1852, 1865, 1877, 1889, 1902, 1914, 1926, 1939, 1951, 1964, 1976, 1989, 2001, 2014, 2026, 2039, 2051, 2064, 2076, 2089, 2101, 2114, 2126, 2139, 2151, 2164, 2176, 2189, 2202, 2214, 2227, 2239};

and here are important parts of my code

union
{
	float32_t f[1024];
	uint8_t b[4*1024];
}data_mag;

arm_rfft_fast_instance_f32 S;
arm_rfft_fast_init_f32(&S, 1024);
arm_rfft_fast_f32(&S, tab, data_out.f, 0);

and what I recieve in output array are strange values that have nothing to do with frequency of prepared samples.
What is more some of them are below 0. So what is going on I ask?

Help please.

Parents Reply Children
No data