TI中文支持网
TI专业的中文技术问题搜集分享网站

用controlsuite里的FPU中的F2833X_RFFT_ADC的程序移植到F28M35中做ADC12位采样数据的128个点FFT变换,结果不对,请求帮助!

问题描述:

AD采样信号为电信号频率为50HZ,采样速率为6.4K,采样128个 点,做FFT变换,移植程序编译无问题,关键代码如下:

Uint16 RFFTin1Buff[RFFT_SIZE]; //Buffer alignment for the input array,
#pragma DATA_SECTION(RFFTin1Buff,"RFFTdata1");

#pragma DATA_SECTION(RFFToutBuff,"RFFTdata2");
float RFFToutBuff[RFFT_SIZE]; //Output of FFT here if RFFT_STAGES is EVEN

#pragma DATA_SECTION(RFFTmagBuff,"RFFTdata3");
float RFFTmagBuff[RFFT_SIZE/2+1]; //Additional Buffer used in Magnitude calc

#pragma DATA_SECTION(RFFTF32Coef,"RFFTdata4");
float RFFTF32Coef[RFFT_SIZE];

rfft_adc.Tail = &rfft.OutBuf; //Link the RFFT_ADC_F32_STRUCT to
//RFFT_F32_STRUCT. Tail pointer of
//RFFT_ADC_F32_STRUCT is passed to
//the OutBuf pointer of RFFT_F32_STRUCT
rfft.FFTSize = RFFT_SIZE; //Real FFT size
rfft.FFTStages = RFFT_STAGES; //Real FFT stages
rfft_adc.InBuf = &RFFTin1Buff[0]; //Input buffer
//rfft.InBuf = &nAdRxBuf[nType][nPhase][0]; //Input buffer
rfft.OutBuf = &RFFToutBuff[0]; //Output buffer
rfft.CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor
rfft.MagBuf = &RFFTmagBuff[0]; //Magnitude output buffer
//rfft.PhaseBuf =&RFFTphaBuff[0];

RFFT_f32_sincostable(&rfft); //Calculate twiddle factor

//Clean up output buffer
for (i=0; i < RFFT_SIZE; i++)
{
RFFToutBuff[i] = 0;
}

//Clean up magnitude buffer
for (i=0; i < RFFT_SIZE/2; i++)
{
RFFTmagBuff[i] = 0;
}

RFFT_adc_f32(&rfft_adc); 

RFFT_f32_mag(&rfft); // Calculate spectrum amplitude

内存分配如下:

RFFTdata1 : > M01SARAM PAGE = 1 ALIGN(256)
RFFTdata2 : > M01SARAM PAGE = 1
RFFTdata3 : > M01SARAM PAGE = 1
RFFTdata4 : > M01SARAM PAGE = 1

采样一组数据为:

[0] unsigned short 1479 0x00000400@Data [1] unsigned short 1487 0x00000401@Data [2] unsigned short 1523 0x00000402@Data [3] unsigned short 1553 0x00000403@Data [4] unsigned short 1587 0x00000404@Data [5] unsigned short 1621 0x00000405@Data [6] unsigned short 1655 0x00000406@Data [7] unsigned short 1711 0x00000407@Data [8] unsigned short 1760 0x00000408@Data [9] unsigned short 1784 0x00000409@Data [10] unsigned short 1814 0x0000040A@Data [11] unsigned short 1869 0x0000040B@Data [12] unsigned short 1890 0x0000040C@Data [13] unsigned short 1952 0x0000040D@Data [14] unsigned short 1984 0x0000040E@Data [15] unsigned short 2024 0x0000040F@Data [16] unsigned short 2072 0x00000410@Data [17] unsigned short 2104 0x00000411@Data [18] unsigned short 2148 0x00000412@Data [19] unsigned short 2173 0x00000413@Data [20] unsigned short 2206 0x00000414@Data [21] unsigned short 2245 0x00000415@Data [22] unsigned short 2308 0x00000416@Data [23] unsigned short 2348 0x00000417@Data [24] unsigned short 2367 0x00000418@Data [25] unsigned short 2429 0x00000419@Data [26] unsigned short 2434 0x0000041A@Data [27] unsigned short 2502 0x0000041B@Data [28] unsigned short 2536 0x0000041C@Data [29] unsigned short 2576 0x0000041D@Data [30] unsigned short 2603 0x0000041E@Data [31] unsigned short 2630 0x0000041F@Data [32] unsigned short 2687 0x00000420@Data [33] unsigned short 2712 0x00000421@Data [34] unsigned short 2699 0x00000422@Data [35] unsigned short 2739 0x00000423@Data [36] unsigned short 2752 0x00000424@Data [37] unsigned short 2789 0x00000425@Data [38] unsigned short 2816 0x00000426@Data [39] unsigned short 2845 0x00000427@Data [40] unsigned short 2854 0x00000428@Data [41] unsigned short 2884 0x00000429@Data [42] unsigned short 2890 0x0000042A@Data [43] unsigned short 2903 0x0000042B@Data [44] unsigned short 2901 0x0000042C@Data [45] unsigned short 2917 0x0000042D@Data [46] unsigned short 2942 0x0000042E@Data [47] unsigned short 2933 0x0000042F@Data [48] unsigned short 2917 0x00000430@Data [49] unsigned short 2914 0x00000431@Data [50] unsigned short 2919 0x00000432@Data [51] unsigned short 2919 0x00000433@Data [52] unsigned short 2929 0x00000434@Data [53] unsigned short 2924 0x00000435@Data [54] unsigned short 2901 0x00000436@Data [55] unsigned short 2895 0x00000437@Data [56] unsigned short 2881 0x00000438@Data [57] unsigned short 2872 0x00000439@Data [58] unsigned short 2858 0x0000043A@Data [59] unsigned short 2837 0x0000043B@Data [60] unsigned short 2816 0x0000043C@Data [61] unsigned short 2779 0x0000043D@Data [62] unsigned short 2744 0x0000043E@Data [63] unsigned short 2725 0x0000043F@Data [64] unsigned short 2699 0x00000440@Data [65] unsigned short 2670 0x00000441@Data [66] unsigned short 2633 0x00000442@Data [67] unsigned short 2612 0x00000443@Data [68] unsigned short 2561 0x00000444@Data [69] unsigned short 2553 0x00000445@Data [70] unsigned short 2515 0x00000446@Data [71] unsigned short 2485 0x00000447@Data [72] unsigned short 2451 0x00000448@Data [73] unsigned short 2415 0x00000449@Data [74] unsigned short 2365 0x0000044A@Data [75] unsigned short 2322 0x0000044B@Data [76] unsigned short 2296 0x0000044C@Data [77] unsigned short 2221 0x0000044D@Data [78] unsigned short 2191 0x0000044E@Data [79] unsigned short 2171 0x0000044F@Data [80] unsigned short 2129 0x00000450@Data [81] unsigned short 2066 0x00000451@Data [82] unsigned short 2019 0x00000452@Data [83] unsigned short 1989 0x00000453@Data [84] unsigned short 1953 0x00000454@Data [85] unsigned short 1912 0x00000455@Data [86] unsigned short 1890 0x00000456@Data [87] unsigned short 1855 0x00000457@Data [88] unsigned short 1809 0x00000458@Data [89] unsigned short 1772 0x00000459@Data [90] unsigned short 1728 0x0000045A@Data [91] unsigned short 1703 0x0000045B@Data [92] unsigned short 1645 0x0000045C@Data [93] unsigned short 1647 0x0000045D@Data [94] unsigned short 1594 0x0000045E@Data [95] unsigned short 1555 0x0000045F@Data [96] unsigned short 1524 0x00000460@Data [97] unsigned short 1497 0x00000461@Data [98] unsigned short 1465 0x00000462@Data [99] unsigned short 1451 0x00000463@Data [100] unsigned short 1395 0x00000464@Data [101] unsigned short 1402 0x00000465@Data [102] unsigned short 1373 0x00000466@Data [103] unsigned short 1349 0x00000467@Data [104] unsigned short 1323 0x00000468@Data [105] unsigned short 1301 0x00000469@Data [106] unsigned short 1280 0x0000046A@Data [107] unsigned short 1271 0x0000046B@Data [108] unsigned short 1259 0x0000046C@Data [109] unsigned short 1267 0x0000046D@Data [110] unsigned short 1251 0x0000046E@Data [111] unsigned short 1238 0x0000046F@Data [112] unsigned short 1231 0x00000470@Data [113] unsigned short 1229 0x00000471@Data [114] unsigned short 1248 0x00000472@Data [115] unsigned short 1265 0x00000473@Data [116] unsigned short 1255 0x00000474@Data [117] unsigned short 1273 0x00000475@Data [118] unsigned short 1286 0x00000476@Data [119] unsigned short 1287 0x00000477@Data [120] unsigned short 1316 0x00000478@Data [121] unsigned short 1321 0x00000479@Data [122] unsigned short 1346 0x0000047A@Data [123] unsigned short 1348 0x0000047B@Data [124] unsigned short 1377 0x0000047C@Data [125] unsigned short 1406 0x0000047D@Data [126] unsigned short 1421 0x0000047E@Data [127] unsigned short 1453 0x0000047F@Data

FFT变换输出数据为:

[0] float 65.34824 0x00000140@Data [1] float -9.631418 0x00000142@Data [2] float -0.02887861 0x00000144@Data [3] float 0.03526003 0x00000146@Data [4] float 0.0307181 0x00000148@Data [5] float -0.03100358 0x0000014A@Data [6] float -0.07209428 0x0000014C@Data [7] float -0.001066721 0x0000014E@Data [8] float -0.05202879 0x00000150@Data [9] float 0.05837662 0x00000152@Data [10] float -0.01612341 0x00000154@Data [11] float -0.007724344 0x00000156@Data [12] float 0.01002017 0x00000158@Data [13] float 0.01638556 0x0000015A@Data [14] float -0.002328807 0x0000015C@Data [15] float 0.009493084 0x0000015E@Data [16] float 0.03805744 0x00000160@Data [17] float -0.002856554 0x00000162@Data [18] float -0.01199929 0x00000164@Data [19] float 0.02020341 0x00000166@Data [20] float 0.01023416 0x00000168@Data [21] float -0.006184662 0x0000016A@Data [22] float 0.02308763 0x0000016C@Data [23] float -0.02422791 0x0000016E@Data [24] float -0.004411316 0x00000170@Data [25] float -0.03132496 0x00000172@Data [26] float -0.02338695 0x00000174@Data [27] float 0.01237797 0x00000176@Data [28] float 0.009625752 0x00000178@Data [29] float 0.006905713 0x0000017A@Data [30] float 0.004603505 0x0000017C@Data [31] float 0.0001732288 0x0000017E@Data [32] float 0.003417969 0x00000180@Data [33] float -0.01281227 0x00000182@Data [34] float 0.02575011 0x00000184@Data [35] float 0.007717508 0x00000186@Data [36] float 0.01370875 0x00000188@Data [37] float 0.02029963 0x0000018A@Data [38] float -0.01971427 0x0000018C@Data [39] float 0.01804638 0x0000018E@Data [40] float 0.01907975 0x00000190@Data [41] float -0.006784829 0x00000192@Data [42] float -0.008244671 0x00000194@Data [43] float -0.02216032 0x00000196@Data [44] float 0.01588557 0x00000198@Data [45] float -0.02002975 0x0000019A@Data [46] float 0.001720885 0x0000019C@Data [47] float 0.03543103 0x0000019E@Data [48] float 0.03080548 0x000001A0@Data [49] float 0.006362881 0x000001A2@Data [50] float -0.01243426 0x000001A4@Data [51] float 0.01023414 0x000001A6@Data [52] float 0.01674686 0x000001A8@Data [53] float -0.0265543 0x000001AA@Data [54] float -0.0277766 0x000001AC@Data [55] float -0.01059378 0x000001AE@Data [56] float 0.01489369 0x000001B0@Data [57] float 0.005655682 0x000001B2@Data [58] float 0.003807224 0x000001B4@Data [59] float 0.01579418 0x000001B6@Data [60] float -0.02879529 0x000001B8@Data [61] float 0.01726831 0x000001BA@Data [62] float 0.03507503 0x000001BC@Data [63] float 0.005178928 0x000001BE@Data [64] float -0.04908752 0x000001C0@Data [65] float -0.001641273 0x000001C2@Data [66] float -0.00107296 0x000001C4@Data [67] float -0.01294239 0x000001C6@Data [68] float -0.01283826 0x000001C8@Data [69] float 0.001250427 0x000001CA@Data [70] float -0.01993993 0x000001CC@Data [71] float 0.0005411981 0x000001CE@Data [72] float -0.0006272644 0x000001D0@Data [73] float 0.03577883 0x000001D2@Data [74] float -0.001234009 0x000001D4@Data [75] float 0.007307775 0x000001D6@Data [76] float -0.01245969 0x000001D8@Data [77] float -0.006627551 0x000001DA@Data [78] float 0.03216821 0x000001DC@Data [79] float 0.0215433 0x000001DE@Data [80] float -0.01269056 0x000001E0@Data [81] float -0.01031196 0x000001E2@Data [82] float 0.02048934 0x000001E4@Data [83] float 0.01857535 0x000001E6@Data [84] float 0.006955497 0x000001E8@Data [85] float -0.0007593818 0x000001EA@Data [86] float 0.007652639 0x000001EC@Data [87] float -0.001153965 0x000001EE@Data [88] float 0.01452125 0x000001F0@Data [89] float -0.008504745 0x000001F2@Data [90] float 0.02111603 0x000001F4@Data [91] float -0.03236639 0x000001F6@Data [92] float -0.02126778 0x000001F8@Data [93] float 0.02617272 0x000001FA@Data [94] float -0.01106206 0x000001FC@Data [95] float -0.01146177 0x000001FE@Data [96] float 0.004640579 0x00000200@Data [97] float 0.003388368 0x00000202@Data [98] float 0.03247364 0x00000204@Data [99] float -0.005977417 0x00000206@Data [100] float -0.01928991 0x00000208@Data [101] float 0.04808921 0x0000020A@Data [102] float 0.008062636 0x0000020C@Data [103] float -0.01837104 0x0000020E@Data [104] float -0.009296702 0x00000210@Data [105] float 0.001716282 0x00000212@Data [106] float 0.03442863 0x00000214@Data [107] float 0.01697574 0x00000216@Data [108] float -0.03104363 0x00000218@Data [109] float 0.02733755 0x0000021A@Data [110] float -0.05490025 0x0000021C@Data [111] float -0.01080309 0x0000021E@Data [112] float 0.03859232 0x00000220@Data [113] float 0.02467327 0x00000222@Data [114] float 0.02073797 0x00000224@Data [115] float -0.003341769 0x00000226@Data [116] float 0.01668616 0x00000228@Data [117] float 0.01998947 0x0000022A@Data [118] float -0.006949434 0x0000022C@Data [119] float -0.02624151 0x0000022E@Data [120] float 0.05565389 0x00000230@Data [121] float 0.02429936 0x00000232@Data [122] float 0.02009803 0x00000234@Data [123] float 0.03920547 0x00000236@Data [124] float 0.02698009 0x00000238@Data [125] float -0.04455571 0x0000023A@Data [126] float -0.01507789 0x0000023C@Data [127] float -8.929353 0x0000023E@Data

请帮我看看,问题出在哪?

sophia wei1:

用的是controlSUITE\libs\dsp\FPU\v1_40_00_00里面的程序

问题描述:

AD采样信号为电信号频率为50HZ,采样速率为6.4K,采样128个 点,做FFT变换,移植程序编译无问题,关键代码如下:

Uint16 RFFTin1Buff[RFFT_SIZE]; //Buffer alignment for the input array,
#pragma DATA_SECTION(RFFTin1Buff,"RFFTdata1");

#pragma DATA_SECTION(RFFToutBuff,"RFFTdata2");
float RFFToutBuff[RFFT_SIZE]; //Output of FFT here if RFFT_STAGES is EVEN

#pragma DATA_SECTION(RFFTmagBuff,"RFFTdata3");
float RFFTmagBuff[RFFT_SIZE/2+1]; //Additional Buffer used in Magnitude calc

#pragma DATA_SECTION(RFFTF32Coef,"RFFTdata4");
float RFFTF32Coef[RFFT_SIZE];

rfft_adc.Tail = &rfft.OutBuf; //Link the RFFT_ADC_F32_STRUCT to
//RFFT_F32_STRUCT. Tail pointer of
//RFFT_ADC_F32_STRUCT is passed to
//the OutBuf pointer of RFFT_F32_STRUCT
rfft.FFTSize = RFFT_SIZE; //Real FFT size
rfft.FFTStages = RFFT_STAGES; //Real FFT stages
rfft_adc.InBuf = &RFFTin1Buff[0]; //Input buffer
//rfft.InBuf = &nAdRxBuf[nType][nPhase][0]; //Input buffer
rfft.OutBuf = &RFFToutBuff[0]; //Output buffer
rfft.CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor
rfft.MagBuf = &RFFTmagBuff[0]; //Magnitude output buffer
//rfft.PhaseBuf =&RFFTphaBuff[0];

RFFT_f32_sincostable(&rfft); //Calculate twiddle factor

//Clean up output buffer
for (i=0; i < RFFT_SIZE; i++)
{
RFFToutBuff[i] = 0;
}

//Clean up magnitude buffer
for (i=0; i < RFFT_SIZE/2; i++)
{
RFFTmagBuff[i] = 0;
}

RFFT_adc_f32(&rfft_adc); 

RFFT_f32_mag(&rfft); // Calculate spectrum amplitude

内存分配如下:

RFFTdata1 : > M01SARAM PAGE = 1 ALIGN(256)
RFFTdata2 : > M01SARAM PAGE = 1
RFFTdata3 : > M01SARAM PAGE = 1
RFFTdata4 : > M01SARAM PAGE = 1

采样一组数据为:

[0] unsigned short 1479 0x00000400@Data [1] unsigned short 1487 0x00000401@Data [2] unsigned short 1523 0x00000402@Data [3] unsigned short 1553 0x00000403@Data [4] unsigned short 1587 0x00000404@Data [5] unsigned short 1621 0x00000405@Data [6] unsigned short 1655 0x00000406@Data [7] unsigned short 1711 0x00000407@Data [8] unsigned short 1760 0x00000408@Data [9] unsigned short 1784 0x00000409@Data [10] unsigned short 1814 0x0000040A@Data [11] unsigned short 1869 0x0000040B@Data [12] unsigned short 1890 0x0000040C@Data [13] unsigned short 1952 0x0000040D@Data [14] unsigned short 1984 0x0000040E@Data [15] unsigned short 2024 0x0000040F@Data [16] unsigned short 2072 0x00000410@Data [17] unsigned short 2104 0x00000411@Data [18] unsigned short 2148 0x00000412@Data [19] unsigned short 2173 0x00000413@Data [20] unsigned short 2206 0x00000414@Data [21] unsigned short 2245 0x00000415@Data [22] unsigned short 2308 0x00000416@Data [23] unsigned short 2348 0x00000417@Data [24] unsigned short 2367 0x00000418@Data [25] unsigned short 2429 0x00000419@Data [26] unsigned short 2434 0x0000041A@Data [27] unsigned short 2502 0x0000041B@Data [28] unsigned short 2536 0x0000041C@Data [29] unsigned short 2576 0x0000041D@Data [30] unsigned short 2603 0x0000041E@Data [31] unsigned short 2630 0x0000041F@Data [32] unsigned short 2687 0x00000420@Data [33] unsigned short 2712 0x00000421@Data [34] unsigned short 2699 0x00000422@Data [35] unsigned short 2739 0x00000423@Data [36] unsigned short 2752 0x00000424@Data [37] unsigned short 2789 0x00000425@Data [38] unsigned short 2816 0x00000426@Data [39] unsigned short 2845 0x00000427@Data [40] unsigned short 2854 0x00000428@Data [41] unsigned short 2884 0x00000429@Data [42] unsigned short 2890 0x0000042A@Data [43] unsigned short 2903 0x0000042B@Data [44] unsigned short 2901 0x0000042C@Data [45] unsigned short 2917 0x0000042D@Data [46] unsigned short 2942 0x0000042E@Data [47] unsigned short 2933 0x0000042F@Data [48] unsigned short 2917 0x00000430@Data [49] unsigned short 2914 0x00000431@Data [50] unsigned short 2919 0x00000432@Data [51] unsigned short 2919 0x00000433@Data [52] unsigned short 2929 0x00000434@Data [53] unsigned short 2924 0x00000435@Data [54] unsigned short 2901 0x00000436@Data [55] unsigned short 2895 0x00000437@Data [56] unsigned short 2881 0x00000438@Data [57] unsigned short 2872 0x00000439@Data [58] unsigned short 2858 0x0000043A@Data [59] unsigned short 2837 0x0000043B@Data [60] unsigned short 2816 0x0000043C@Data [61] unsigned short 2779 0x0000043D@Data [62] unsigned short 2744 0x0000043E@Data [63] unsigned short 2725 0x0000043F@Data [64] unsigned short 2699 0x00000440@Data [65] unsigned short 2670 0x00000441@Data [66] unsigned short 2633 0x00000442@Data [67] unsigned short 2612 0x00000443@Data [68] unsigned short 2561 0x00000444@Data [69] unsigned short 2553 0x00000445@Data [70] unsigned short 2515 0x00000446@Data [71] unsigned short 2485 0x00000447@Data [72] unsigned short 2451 0x00000448@Data [73] unsigned short 2415 0x00000449@Data [74] unsigned short 2365 0x0000044A@Data [75] unsigned short 2322 0x0000044B@Data [76] unsigned short 2296 0x0000044C@Data [77] unsigned short 2221 0x0000044D@Data [78] unsigned short 2191 0x0000044E@Data [79] unsigned short 2171 0x0000044F@Data [80] unsigned short 2129 0x00000450@Data [81] unsigned short 2066 0x00000451@Data [82] unsigned short 2019 0x00000452@Data [83] unsigned short 1989 0x00000453@Data [84] unsigned short 1953 0x00000454@Data [85] unsigned short 1912 0x00000455@Data [86] unsigned short 1890 0x00000456@Data [87] unsigned short 1855 0x00000457@Data [88] unsigned short 1809 0x00000458@Data [89] unsigned short 1772 0x00000459@Data [90] unsigned short 1728 0x0000045A@Data [91] unsigned short 1703 0x0000045B@Data [92] unsigned short 1645 0x0000045C@Data [93] unsigned short 1647 0x0000045D@Data [94] unsigned short 1594 0x0000045E@Data [95] unsigned short 1555 0x0000045F@Data [96] unsigned short 1524 0x00000460@Data [97] unsigned short 1497 0x00000461@Data [98] unsigned short 1465 0x00000462@Data [99] unsigned short 1451 0x00000463@Data [100] unsigned short 1395 0x00000464@Data [101] unsigned short 1402 0x00000465@Data [102] unsigned short 1373 0x00000466@Data [103] unsigned short 1349 0x00000467@Data [104] unsigned short 1323 0x00000468@Data [105] unsigned short 1301 0x00000469@Data [106] unsigned short 1280 0x0000046A@Data [107] unsigned short 1271 0x0000046B@Data [108] unsigned short 1259 0x0000046C@Data [109] unsigned short 1267 0x0000046D@Data [110] unsigned short 1251 0x0000046E@Data [111] unsigned short 1238 0x0000046F@Data [112] unsigned short 1231 0x00000470@Data [113] unsigned short 1229 0x00000471@Data [114] unsigned short 1248 0x00000472@Data [115] unsigned short 1265 0x00000473@Data [116] unsigned short 1255 0x00000474@Data [117] unsigned short 1273 0x00000475@Data [118] unsigned short 1286 0x00000476@Data [119] unsigned short 1287 0x00000477@Data [120] unsigned short 1316 0x00000478@Data [121] unsigned short 1321 0x00000479@Data [122] unsigned short 1346 0x0000047A@Data [123] unsigned short 1348 0x0000047B@Data [124] unsigned short 1377 0x0000047C@Data [125] unsigned short 1406 0x0000047D@Data [126] unsigned short 1421 0x0000047E@Data [127] unsigned short 1453 0x0000047F@Data

FFT变换输出数据为:

[0] float 65.34824 0x00000140@Data [1] float -9.631418 0x00000142@Data [2] float -0.02887861 0x00000144@Data [3] float 0.03526003 0x00000146@Data [4] float 0.0307181 0x00000148@Data [5] float -0.03100358 0x0000014A@Data [6] float -0.07209428 0x0000014C@Data [7] float -0.001066721 0x0000014E@Data [8] float -0.05202879 0x00000150@Data [9] float 0.05837662 0x00000152@Data [10] float -0.01612341 0x00000154@Data [11] float -0.007724344 0x00000156@Data [12] float 0.01002017 0x00000158@Data [13] float 0.01638556 0x0000015A@Data [14] float -0.002328807 0x0000015C@Data [15] float 0.009493084 0x0000015E@Data [16] float 0.03805744 0x00000160@Data [17] float -0.002856554 0x00000162@Data [18] float -0.01199929 0x00000164@Data [19] float 0.02020341 0x00000166@Data [20] float 0.01023416 0x00000168@Data [21] float -0.006184662 0x0000016A@Data [22] float 0.02308763 0x0000016C@Data [23] float -0.02422791 0x0000016E@Data [24] float -0.004411316 0x00000170@Data [25] float -0.03132496 0x00000172@Data [26] float -0.02338695 0x00000174@Data [27] float 0.01237797 0x00000176@Data [28] float 0.009625752 0x00000178@Data [29] float 0.006905713 0x0000017A@Data [30] float 0.004603505 0x0000017C@Data [31] float 0.0001732288 0x0000017E@Data [32] float 0.003417969 0x00000180@Data [33] float -0.01281227 0x00000182@Data [34] float 0.02575011 0x00000184@Data [35] float 0.007717508 0x00000186@Data [36] float 0.01370875 0x00000188@Data [37] float 0.02029963 0x0000018A@Data [38] float -0.01971427 0x0000018C@Data [39] float 0.01804638 0x0000018E@Data [40] float 0.01907975 0x00000190@Data [41] float -0.006784829 0x00000192@Data [42] float -0.008244671 0x00000194@Data [43] float -0.02216032 0x00000196@Data [44] float 0.01588557 0x00000198@Data [45] float -0.02002975 0x0000019A@Data [46] float 0.001720885 0x0000019C@Data [47] float 0.03543103 0x0000019E@Data [48] float 0.03080548 0x000001A0@Data [49] float 0.006362881 0x000001A2@Data [50] float -0.01243426 0x000001A4@Data [51] float 0.01023414 0x000001A6@Data [52] float 0.01674686 0x000001A8@Data [53] float -0.0265543 0x000001AA@Data [54] float -0.0277766 0x000001AC@Data [55] float -0.01059378 0x000001AE@Data [56] float 0.01489369 0x000001B0@Data [57] float 0.005655682 0x000001B2@Data [58] float 0.003807224 0x000001B4@Data [59] float 0.01579418 0x000001B6@Data [60] float -0.02879529 0x000001B8@Data [61] float 0.01726831 0x000001BA@Data [62] float 0.03507503 0x000001BC@Data [63] float 0.005178928 0x000001BE@Data [64] float -0.04908752 0x000001C0@Data [65] float -0.001641273 0x000001C2@Data [66] float -0.00107296 0x000001C4@Data [67] float -0.01294239 0x000001C6@Data [68] float -0.01283826 0x000001C8@Data [69] float 0.001250427 0x000001CA@Data [70] float -0.01993993 0x000001CC@Data [71] float 0.0005411981 0x000001CE@Data [72] float -0.0006272644 0x000001D0@Data [73] float 0.03577883 0x000001D2@Data [74] float -0.001234009 0x000001D4@Data [75] float 0.007307775 0x000001D6@Data [76] float -0.01245969 0x000001D8@Data [77] float -0.006627551 0x000001DA@Data [78] float 0.03216821 0x000001DC@Data [79] float 0.0215433 0x000001DE@Data [80] float -0.01269056 0x000001E0@Data [81] float -0.01031196 0x000001E2@Data [82] float 0.02048934 0x000001E4@Data [83] float 0.01857535 0x000001E6@Data [84] float 0.006955497 0x000001E8@Data [85] float -0.0007593818 0x000001EA@Data [86] float 0.007652639 0x000001EC@Data [87] float -0.001153965 0x000001EE@Data [88] float 0.01452125 0x000001F0@Data [89] float -0.008504745 0x000001F2@Data [90] float 0.02111603 0x000001F4@Data [91] float -0.03236639 0x000001F6@Data [92] float -0.02126778 0x000001F8@Data [93] float 0.02617272 0x000001FA@Data [94] float -0.01106206 0x000001FC@Data [95] float -0.01146177 0x000001FE@Data [96] float 0.004640579 0x00000200@Data [97] float 0.003388368 0x00000202@Data [98] float 0.03247364 0x00000204@Data [99] float -0.005977417 0x00000206@Data [100] float -0.01928991 0x00000208@Data [101] float 0.04808921 0x0000020A@Data [102] float 0.008062636 0x0000020C@Data [103] float -0.01837104 0x0000020E@Data [104] float -0.009296702 0x00000210@Data [105] float 0.001716282 0x00000212@Data [106] float 0.03442863 0x00000214@Data [107] float 0.01697574 0x00000216@Data [108] float -0.03104363 0x00000218@Data [109] float 0.02733755 0x0000021A@Data [110] float -0.05490025 0x0000021C@Data [111] float -0.01080309 0x0000021E@Data [112] float 0.03859232 0x00000220@Data [113] float 0.02467327 0x00000222@Data [114] float 0.02073797 0x00000224@Data [115] float -0.003341769 0x00000226@Data [116] float 0.01668616 0x00000228@Data [117] float 0.01998947 0x0000022A@Data [118] float -0.006949434 0x0000022C@Data [119] float -0.02624151 0x0000022E@Data [120] float 0.05565389 0x00000230@Data [121] float 0.02429936 0x00000232@Data [122] float 0.02009803 0x00000234@Data [123] float 0.03920547 0x00000236@Data [124] float 0.02698009 0x00000238@Data [125] float -0.04455571 0x0000023A@Data [126] float -0.01507789 0x0000023C@Data [127] float -8.929353 0x0000023E@Data

请帮我看看,问题出在哪?

Victor Zheng:

回复 sophia wei1:

您好

您可以一步一步的来试一下。请您先做一个点数少的,比如说8点的FFT,以此来验证程序是否正常。输入的数据直接给一个固定的波形来验证。

问题描述:

AD采样信号为电信号频率为50HZ,采样速率为6.4K,采样128个 点,做FFT变换,移植程序编译无问题,关键代码如下:

Uint16 RFFTin1Buff[RFFT_SIZE]; //Buffer alignment for the input array,
#pragma DATA_SECTION(RFFTin1Buff,"RFFTdata1");

#pragma DATA_SECTION(RFFToutBuff,"RFFTdata2");
float RFFToutBuff[RFFT_SIZE]; //Output of FFT here if RFFT_STAGES is EVEN

#pragma DATA_SECTION(RFFTmagBuff,"RFFTdata3");
float RFFTmagBuff[RFFT_SIZE/2+1]; //Additional Buffer used in Magnitude calc

#pragma DATA_SECTION(RFFTF32Coef,"RFFTdata4");
float RFFTF32Coef[RFFT_SIZE];

rfft_adc.Tail = &rfft.OutBuf; //Link the RFFT_ADC_F32_STRUCT to
//RFFT_F32_STRUCT. Tail pointer of
//RFFT_ADC_F32_STRUCT is passed to
//the OutBuf pointer of RFFT_F32_STRUCT
rfft.FFTSize = RFFT_SIZE; //Real FFT size
rfft.FFTStages = RFFT_STAGES; //Real FFT stages
rfft_adc.InBuf = &RFFTin1Buff[0]; //Input buffer
//rfft.InBuf = &nAdRxBuf[nType][nPhase][0]; //Input buffer
rfft.OutBuf = &RFFToutBuff[0]; //Output buffer
rfft.CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor
rfft.MagBuf = &RFFTmagBuff[0]; //Magnitude output buffer
//rfft.PhaseBuf =&RFFTphaBuff[0];

RFFT_f32_sincostable(&rfft); //Calculate twiddle factor

//Clean up output buffer
for (i=0; i < RFFT_SIZE; i++)
{
RFFToutBuff[i] = 0;
}

//Clean up magnitude buffer
for (i=0; i < RFFT_SIZE/2; i++)
{
RFFTmagBuff[i] = 0;
}

RFFT_adc_f32(&rfft_adc); 

RFFT_f32_mag(&rfft); // Calculate spectrum amplitude

内存分配如下:

RFFTdata1 : > M01SARAM PAGE = 1 ALIGN(256)
RFFTdata2 : > M01SARAM PAGE = 1
RFFTdata3 : > M01SARAM PAGE = 1
RFFTdata4 : > M01SARAM PAGE = 1

采样一组数据为:

[0] unsigned short 1479 0x00000400@Data [1] unsigned short 1487 0x00000401@Data [2] unsigned short 1523 0x00000402@Data [3] unsigned short 1553 0x00000403@Data [4] unsigned short 1587 0x00000404@Data [5] unsigned short 1621 0x00000405@Data [6] unsigned short 1655 0x00000406@Data [7] unsigned short 1711 0x00000407@Data [8] unsigned short 1760 0x00000408@Data [9] unsigned short 1784 0x00000409@Data [10] unsigned short 1814 0x0000040A@Data [11] unsigned short 1869 0x0000040B@Data [12] unsigned short 1890 0x0000040C@Data [13] unsigned short 1952 0x0000040D@Data [14] unsigned short 1984 0x0000040E@Data [15] unsigned short 2024 0x0000040F@Data [16] unsigned short 2072 0x00000410@Data [17] unsigned short 2104 0x00000411@Data [18] unsigned short 2148 0x00000412@Data [19] unsigned short 2173 0x00000413@Data [20] unsigned short 2206 0x00000414@Data [21] unsigned short 2245 0x00000415@Data [22] unsigned short 2308 0x00000416@Data [23] unsigned short 2348 0x00000417@Data [24] unsigned short 2367 0x00000418@Data [25] unsigned short 2429 0x00000419@Data [26] unsigned short 2434 0x0000041A@Data [27] unsigned short 2502 0x0000041B@Data [28] unsigned short 2536 0x0000041C@Data [29] unsigned short 2576 0x0000041D@Data [30] unsigned short 2603 0x0000041E@Data [31] unsigned short 2630 0x0000041F@Data [32] unsigned short 2687 0x00000420@Data [33] unsigned short 2712 0x00000421@Data [34] unsigned short 2699 0x00000422@Data [35] unsigned short 2739 0x00000423@Data [36] unsigned short 2752 0x00000424@Data [37] unsigned short 2789 0x00000425@Data [38] unsigned short 2816 0x00000426@Data [39] unsigned short 2845 0x00000427@Data [40] unsigned short 2854 0x00000428@Data [41] unsigned short 2884 0x00000429@Data [42] unsigned short 2890 0x0000042A@Data [43] unsigned short 2903 0x0000042B@Data [44] unsigned short 2901 0x0000042C@Data [45] unsigned short 2917 0x0000042D@Data [46] unsigned short 2942 0x0000042E@Data [47] unsigned short 2933 0x0000042F@Data [48] unsigned short 2917 0x00000430@Data [49] unsigned short 2914 0x00000431@Data [50] unsigned short 2919 0x00000432@Data [51] unsigned short 2919 0x00000433@Data [52] unsigned short 2929 0x00000434@Data [53] unsigned short 2924 0x00000435@Data [54] unsigned short 2901 0x00000436@Data [55] unsigned short 2895 0x00000437@Data [56] unsigned short 2881 0x00000438@Data [57] unsigned short 2872 0x00000439@Data [58] unsigned short 2858 0x0000043A@Data [59] unsigned short 2837 0x0000043B@Data [60] unsigned short 2816 0x0000043C@Data [61] unsigned short 2779 0x0000043D@Data [62] unsigned short 2744 0x0000043E@Data [63] unsigned short 2725 0x0000043F@Data [64] unsigned short 2699 0x00000440@Data [65] unsigned short 2670 0x00000441@Data [66] unsigned short 2633 0x00000442@Data [67] unsigned short 2612 0x00000443@Data [68] unsigned short 2561 0x00000444@Data [69] unsigned short 2553 0x00000445@Data [70] unsigned short 2515 0x00000446@Data [71] unsigned short 2485 0x00000447@Data [72] unsigned short 2451 0x00000448@Data [73] unsigned short 2415 0x00000449@Data [74] unsigned short 2365 0x0000044A@Data [75] unsigned short 2322 0x0000044B@Data [76] unsigned short 2296 0x0000044C@Data [77] unsigned short 2221 0x0000044D@Data [78] unsigned short 2191 0x0000044E@Data [79] unsigned short 2171 0x0000044F@Data [80] unsigned short 2129 0x00000450@Data [81] unsigned short 2066 0x00000451@Data [82] unsigned short 2019 0x00000452@Data [83] unsigned short 1989 0x00000453@Data [84] unsigned short 1953 0x00000454@Data [85] unsigned short 1912 0x00000455@Data [86] unsigned short 1890 0x00000456@Data [87] unsigned short 1855 0x00000457@Data [88] unsigned short 1809 0x00000458@Data [89] unsigned short 1772 0x00000459@Data [90] unsigned short 1728 0x0000045A@Data [91] unsigned short 1703 0x0000045B@Data [92] unsigned short 1645 0x0000045C@Data [93] unsigned short 1647 0x0000045D@Data [94] unsigned short 1594 0x0000045E@Data [95] unsigned short 1555 0x0000045F@Data [96] unsigned short 1524 0x00000460@Data [97] unsigned short 1497 0x00000461@Data [98] unsigned short 1465 0x00000462@Data [99] unsigned short 1451 0x00000463@Data [100] unsigned short 1395 0x00000464@Data [101] unsigned short 1402 0x00000465@Data [102] unsigned short 1373 0x00000466@Data [103] unsigned short 1349 0x00000467@Data [104] unsigned short 1323 0x00000468@Data [105] unsigned short 1301 0x00000469@Data [106] unsigned short 1280 0x0000046A@Data [107] unsigned short 1271 0x0000046B@Data [108] unsigned short 1259 0x0000046C@Data [109] unsigned short 1267 0x0000046D@Data [110] unsigned short 1251 0x0000046E@Data [111] unsigned short 1238 0x0000046F@Data [112] unsigned short 1231 0x00000470@Data [113] unsigned short 1229 0x00000471@Data [114] unsigned short 1248 0x00000472@Data [115] unsigned short 1265 0x00000473@Data [116] unsigned short 1255 0x00000474@Data [117] unsigned short 1273 0x00000475@Data [118] unsigned short 1286 0x00000476@Data [119] unsigned short 1287 0x00000477@Data [120] unsigned short 1316 0x00000478@Data [121] unsigned short 1321 0x00000479@Data [122] unsigned short 1346 0x0000047A@Data [123] unsigned short 1348 0x0000047B@Data [124] unsigned short 1377 0x0000047C@Data [125] unsigned short 1406 0x0000047D@Data [126] unsigned short 1421 0x0000047E@Data [127] unsigned short 1453 0x0000047F@Data

FFT变换输出数据为:

[0] float 65.34824 0x00000140@Data [1] float -9.631418 0x00000142@Data [2] float -0.02887861 0x00000144@Data [3] float 0.03526003 0x00000146@Data [4] float 0.0307181 0x00000148@Data [5] float -0.03100358 0x0000014A@Data [6] float -0.07209428 0x0000014C@Data [7] float -0.001066721 0x0000014E@Data [8] float -0.05202879 0x00000150@Data [9] float 0.05837662 0x00000152@Data [10] float -0.01612341 0x00000154@Data [11] float -0.007724344 0x00000156@Data [12] float 0.01002017 0x00000158@Data [13] float 0.01638556 0x0000015A@Data [14] float -0.002328807 0x0000015C@Data [15] float 0.009493084 0x0000015E@Data [16] float 0.03805744 0x00000160@Data [17] float -0.002856554 0x00000162@Data [18] float -0.01199929 0x00000164@Data [19] float 0.02020341 0x00000166@Data [20] float 0.01023416 0x00000168@Data [21] float -0.006184662 0x0000016A@Data [22] float 0.02308763 0x0000016C@Data [23] float -0.02422791 0x0000016E@Data [24] float -0.004411316 0x00000170@Data [25] float -0.03132496 0x00000172@Data [26] float -0.02338695 0x00000174@Data [27] float 0.01237797 0x00000176@Data [28] float 0.009625752 0x00000178@Data [29] float 0.006905713 0x0000017A@Data [30] float 0.004603505 0x0000017C@Data [31] float 0.0001732288 0x0000017E@Data [32] float 0.003417969 0x00000180@Data [33] float -0.01281227 0x00000182@Data [34] float 0.02575011 0x00000184@Data [35] float 0.007717508 0x00000186@Data [36] float 0.01370875 0x00000188@Data [37] float 0.02029963 0x0000018A@Data [38] float -0.01971427 0x0000018C@Data [39] float 0.01804638 0x0000018E@Data [40] float 0.01907975 0x00000190@Data [41] float -0.006784829 0x00000192@Data [42] float -0.008244671 0x00000194@Data [43] float -0.02216032 0x00000196@Data [44] float 0.01588557 0x00000198@Data [45] float -0.02002975 0x0000019A@Data [46] float 0.001720885 0x0000019C@Data [47] float 0.03543103 0x0000019E@Data [48] float 0.03080548 0x000001A0@Data [49] float 0.006362881 0x000001A2@Data [50] float -0.01243426 0x000001A4@Data [51] float 0.01023414 0x000001A6@Data [52] float 0.01674686 0x000001A8@Data [53] float -0.0265543 0x000001AA@Data [54] float -0.0277766 0x000001AC@Data [55] float -0.01059378 0x000001AE@Data [56] float 0.01489369 0x000001B0@Data [57] float 0.005655682 0x000001B2@Data [58] float 0.003807224 0x000001B4@Data [59] float 0.01579418 0x000001B6@Data [60] float -0.02879529 0x000001B8@Data [61] float 0.01726831 0x000001BA@Data [62] float 0.03507503 0x000001BC@Data [63] float 0.005178928 0x000001BE@Data [64] float -0.04908752 0x000001C0@Data [65] float -0.001641273 0x000001C2@Data [66] float -0.00107296 0x000001C4@Data [67] float -0.01294239 0x000001C6@Data [68] float -0.01283826 0x000001C8@Data [69] float 0.001250427 0x000001CA@Data [70] float -0.01993993 0x000001CC@Data [71] float 0.0005411981 0x000001CE@Data [72] float -0.0006272644 0x000001D0@Data [73] float 0.03577883 0x000001D2@Data [74] float -0.001234009 0x000001D4@Data [75] float 0.007307775 0x000001D6@Data [76] float -0.01245969 0x000001D8@Data [77] float -0.006627551 0x000001DA@Data [78] float 0.03216821 0x000001DC@Data [79] float 0.0215433 0x000001DE@Data [80] float -0.01269056 0x000001E0@Data [81] float -0.01031196 0x000001E2@Data [82] float 0.02048934 0x000001E4@Data [83] float 0.01857535 0x000001E6@Data [84] float 0.006955497 0x000001E8@Data [85] float -0.0007593818 0x000001EA@Data [86] float 0.007652639 0x000001EC@Data [87] float -0.001153965 0x000001EE@Data [88] float 0.01452125 0x000001F0@Data [89] float -0.008504745 0x000001F2@Data [90] float 0.02111603 0x000001F4@Data [91] float -0.03236639 0x000001F6@Data [92] float -0.02126778 0x000001F8@Data [93] float 0.02617272 0x000001FA@Data [94] float -0.01106206 0x000001FC@Data [95] float -0.01146177 0x000001FE@Data [96] float 0.004640579 0x00000200@Data [97] float 0.003388368 0x00000202@Data [98] float 0.03247364 0x00000204@Data [99] float -0.005977417 0x00000206@Data [100] float -0.01928991 0x00000208@Data [101] float 0.04808921 0x0000020A@Data [102] float 0.008062636 0x0000020C@Data [103] float -0.01837104 0x0000020E@Data [104] float -0.009296702 0x00000210@Data [105] float 0.001716282 0x00000212@Data [106] float 0.03442863 0x00000214@Data [107] float 0.01697574 0x00000216@Data [108] float -0.03104363 0x00000218@Data [109] float 0.02733755 0x0000021A@Data [110] float -0.05490025 0x0000021C@Data [111] float -0.01080309 0x0000021E@Data [112] float 0.03859232 0x00000220@Data [113] float 0.02467327 0x00000222@Data [114] float 0.02073797 0x00000224@Data [115] float -0.003341769 0x00000226@Data [116] float 0.01668616 0x00000228@Data [117] float 0.01998947 0x0000022A@Data [118] float -0.006949434 0x0000022C@Data [119] float -0.02624151 0x0000022E@Data [120] float 0.05565389 0x00000230@Data [121] float 0.02429936 0x00000232@Data [122] float 0.02009803 0x00000234@Data [123] float 0.03920547 0x00000236@Data [124] float 0.02698009 0x00000238@Data [125] float -0.04455571 0x0000023A@Data [126] float -0.01507789 0x0000023C@Data [127] float -8.929353 0x0000023E@Data

请帮我看看,问题出在哪?

user5739360:请问您解决了吗?我用的fpu中v1_50_00_00的程序也不对

赞(0)
未经允许不得转载:TI中文支持网 » 用controlsuite里的FPU中的F2833X_RFFT_ADC的程序移植到F28M35中做ADC12位采样数据的128个点FFT变换,结果不对,请求帮助!
分享到: 更多 (0)