深圳幻海软件技术有限公司 欢迎您!

[DSP学习笔记]基于TMS320F28335的FIR滤波实现

2023-06-25

首先进入TI官网,搜索C2000wave,进行下载安装。安装完成后,在2000wave的安装目录下,进入以下目录:C2000Ware_4_02_00_00\libraries\dsp\FPU\c28以我本地的安装目录为例:E:\ti\c2000\C2000Ware_4_02_00_00\librar

首先进入TI官网,搜索C2000 wave,进行下载安装。

安装完成后,在2000 wave的安装目录下,进入以下目录:C2000Ware_4_02_00_00\libraries\dsp\FPU\c28

以我本地的安装目录为例:E:\ti\c2000\C2000Ware_4_02_00_00\libraries\dsp\FPU\c28

复制include、source文件夹到新建工程中。再根据选用的DSP型号对文件夹内容进行删减。如:我使用的是TMS320F28335,FPU是32位的,故仅保留include、source文件夹中的fpu32文件夹以及dsp.h头文件。

工程中,可以见有以下文件(仅进行滤波可删除FFT相关文件)

同时记得添加头文件路径

 至此,对于我们进行滤波所需的函数库已经移植完毕。

测试部分:

首先使用MATLAB生成输入信号。

 MATLAB函数式文件:

  1. %生成固定点数固定频率的正弦信号
  2. %fs为采样率
  3. %f为多频信号频率
  4. %N为采样点数
  5. %amp为信号幅值
  6. %phase为信号初相位
  7. function [input,t] = mult_freq_signal_test(fs,f,N,amp,phase)
  8. dt = 1/fs; %采样周期
  9. t = dt*N; %采样时间
  10. temp = (0:dt:(N-1)*dt)';
  11. y = amp.*sin(2*pi*f.*temp+phase/180*pi);
  12. Num = size(f,2); %获取f频率个数
  13. input = y*ones(Num,1);
  14. subplot(1,2,1);
  15. plot(temp/dt,input);
  16. title('信号时域');
  17. xlabel('点数 N');ylabel('幅值 A');
  18. subplot(1,2,2);
  19. Y = fftshift(fft(input));%做傅里叶变换并把零频点移到频谱中心
  20. F = (-N/2:N/2-1)*(fs/N);%设置横坐标
  21. plot(F,abs(Y)/max(abs(Y)));
  22. title('信号频域');
  23. xlabel('频率 f');ylabel('幅值 A')
  24. end

 MATLAB命令式文件:

  1. %与mult_freq_signal_test.m函数式文件配合使用,将生成的输出信号保存到本地
  2. fs=1e5; %设采样率为100K
  3. f = [1e3,5e3,1e4]; %频率矩阵(1*N)测试信号频率为1K,5K,10K
  4. phase = [0,0,0]; %初相位均为0
  5. amp = [0.3,1.0,0.5];
  6. N=512; %采样点数
  7. y=mult_freq_signal_test(fs,f,N,amp,phase);
  8. y=reshape(y,[4,N/4]);
  9. y=y';
  10. fileID = fopen('record.txt','w');
  11. for i=1:1:N/4
  12. fprintf(fileID,'%.6f,%.6f,%.6f,%.6f,\n',y(i,1),y(i,2),y(i,3),y(i,4));
  13. end
  14. fclose(fileID);%将生成的初始信号保存到.m文件路径下的record.txt

生成波形如下的输入信号:

 将record.txt文件内容复制到INPUT.c文件中,如下:

  1. //#############################################################################
  2. //! \file input.c
  3. //! \brief Input Vector (1024)
  4. //! \author Vishal Coelho
  5. //! \date 16-Sep-2016
  6. //!
  7. //
  8. // Group: C2000
  9. // Target Family: $DEVICE$
  10. //
  11. //#############################################################################
  12. //
  13. //
  14. // $Copyright: Copyright (C) 2022 Texas Instruments Incorporated -
  15. // http://www.ti.com/ ALL RIGHTS RESERVED $
  16. //#############################################################################
  17. float test_input[512] = {
  18. 0.000000,0.621747,1.100913,1.340760,
  19. 1.319556,1.092705,0.767601,0.461223,
  20. 0.256783,0.175872,0.176336,0.176103,
  21. 0.093107,-0.114798,-0.426010,-0.757295,
  22. -0.991651,-1.021653,-0.791865,-0.323977,
  23. 0.285317,0.893485,1.358000,1.582180,
  24. 1.544357,1.300000,0.956572,0.631123,
  25. 0.406943,0.305699,0.285317,0.263809,
  26. 0.159191,-0.070597,-0.403866,-0.757295,
  27. -1.013795,-1.065855,-0.857949,-0.411682,
  28. 0.176336,0.763658,1.207840,1.412279,
  29. 1.355387,1.092705,0.731771,0.389703,
  30. 0.149857,0.033962,0.000000,-0.033962,
  31. -0.149857,-0.389703,-0.731771,-1.092705,
  32. -1.355387,-1.412279,-1.207840,-0.763658,
  33. -0.176336,0.411682,0.857949,1.065855,
  34. 1.013795,0.757295,0.403866,0.070597,
  35. -0.159191,-0.263809,-0.285317,-0.305699,
  36. -0.406943,-0.631123,-0.956572,-1.300000,
  37. -1.544357,-1.582180,-1.358000,-0.893485,
  38. -0.285317,0.323977,0.791865,1.021653,
  39. 0.991651,0.757295,0.426010,0.114798,
  40. -0.093107,-0.176103,-0.176336,-0.175872,
  41. -0.256783,-0.461223,-0.767601,-1.092705,
  42. -1.319556,-1.340760,-1.100913,-0.621747,
  43. -0.000000,0.621747,1.100913,1.340760,
  44. 1.319556,1.092705,0.767601,0.461223,
  45. 0.256783,0.175872,0.176336,0.176103,
  46. 0.093107,-0.114798,-0.426010,-0.757295,
  47. -0.991651,-1.021653,-0.791865,-0.323977,
  48. 0.285317,0.893485,1.358000,1.582180,
  49. 1.544357,1.300000,0.956572,0.631123,
  50. 0.406943,0.305699,0.285317,0.263809,
  51. 0.159191,-0.070597,-0.403866,-0.757295,
  52. -1.013795,-1.065855,-0.857949,-0.411682,
  53. 0.176336,0.763658,1.207840,1.412279,
  54. 1.355387,1.092705,0.731771,0.389703,
  55. 0.149857,0.033962,0.000000,-0.033962,
  56. -0.149857,-0.389703,-0.731771,-1.092705,
  57. -1.355387,-1.412279,-1.207840,-0.763658,
  58. -0.176336,0.411682,0.857949,1.065855,
  59. 1.013795,0.757295,0.403866,0.070597,
  60. -0.159191,-0.263809,-0.285317,-0.305699,
  61. -0.406943,-0.631123,-0.956572,-1.300000,
  62. -1.544357,-1.582180,-1.358000,-0.893485,
  63. -0.285317,0.323977,0.791865,1.021653,
  64. 0.991651,0.757295,0.426010,0.114798,
  65. -0.093107,-0.176103,-0.176336,-0.175872,
  66. -0.256783,-0.461223,-0.767601,-1.092705,
  67. -1.319556,-1.340760,-1.100913,-0.621747,
  68. -0.000000,0.621747,1.100913,1.340760,
  69. 1.319556,1.092705,0.767601,0.461223,
  70. 0.256783,0.175872,0.176336,0.176103,
  71. 0.093107,-0.114798,-0.426010,-0.757295,
  72. -0.991651,-1.021653,-0.791865,-0.323977,
  73. 0.285317,0.893485,1.358000,1.582180,
  74. 1.544357,1.300000,0.956572,0.631123,
  75. 0.406943,0.305699,0.285317,0.263809,
  76. 0.159191,-0.070597,-0.403866,-0.757295,
  77. -1.013795,-1.065855,-0.857949,-0.411682,
  78. 0.176336,0.763658,1.207840,1.412279,
  79. 1.355387,1.092705,0.731771,0.389703,
  80. 0.149857,0.033962,0.000000,-0.033962,
  81. -0.149857,-0.389703,-0.731771,-1.092705,
  82. -1.355387,-1.412279,-1.207840,-0.763658,
  83. -0.176336,0.411682,0.857949,1.065855,
  84. 1.013795,0.757295,0.403866,0.070597,
  85. -0.159191,-0.263809,-0.285317,-0.305699,
  86. -0.406943,-0.631123,-0.956572,-1.300000,
  87. -1.544357,-1.582180,-1.358000,-0.893485,
  88. -0.285317,0.323977,0.791865,1.021653,
  89. 0.991651,0.757295,0.426010,0.114798,
  90. -0.093107,-0.176103,-0.176336,-0.175872,
  91. -0.256783,-0.461223,-0.767601,-1.092705,
  92. -1.319556,-1.340760,-1.100913,-0.621747,
  93. 0.000000,0.621747,1.100913,1.340760,
  94. 1.319556,1.092705,0.767601,0.461223,
  95. 0.256783,0.175872,0.176336,0.176103,
  96. 0.093107,-0.114798,-0.426010,-0.757295,
  97. -0.991651,-1.021653,-0.791865,-0.323977,
  98. 0.285317,0.893485,1.358000,1.582180,
  99. 1.544357,1.300000,0.956572,0.631123,
  100. 0.406943,0.305699,0.285317,0.263809,
  101. 0.159191,-0.070597,-0.403866,-0.757295,
  102. -1.013795,-1.065855,-0.857949,-0.411682,
  103. 0.176336,0.763658,1.207840,1.412279,
  104. 1.355387,1.092705,0.731771,0.389703,
  105. 0.149857,0.033962,-0.000000,-0.033962,
  106. -0.149857,-0.389703,-0.731771,-1.092705,
  107. -1.355387,-1.412279,-1.207840,-0.763658,
  108. -0.176336,0.411682,0.857949,1.065855,
  109. 1.013795,0.757295,0.403866,0.070597,
  110. -0.159191,-0.263809,-0.285317,-0.305699,
  111. -0.406943,-0.631123,-0.956572,-1.300000,
  112. -1.544357,-1.582180,-1.358000,-0.893485,
  113. -0.285317,0.323977,0.791865,1.021653,
  114. 0.991651,0.757295,0.426010,0.114798,
  115. -0.093107,-0.176103,-0.176336,-0.175872,
  116. -0.256783,-0.461223,-0.767601,-1.092705,
  117. -1.319556,-1.340760,-1.100913,-0.621747,
  118. 0.000000,0.621747,1.100913,1.340760,
  119. 1.319556,1.092705,0.767601,0.461223,
  120. 0.256783,0.175872,0.176336,0.176103,
  121. 0.093107,-0.114798,-0.426010,-0.757295,
  122. -0.991651,-1.021653,-0.791865,-0.323977,
  123. 0.285317,0.893485,1.358000,1.582180,
  124. 1.544357,1.300000,0.956572,0.631123,
  125. 0.406943,0.305699,0.285317,0.263809,
  126. 0.159191,-0.070597,-0.403866,-0.757295,
  127. -1.013795,-1.065855,-0.857949,-0.411682,
  128. 0.176336,0.763658,1.207840,1.412279,
  129. 1.355387,1.092705,0.731771,0.389703,
  130. 0.149857,0.033962,0.000000,-0.033962,
  131. -0.149857,-0.389703,-0.731771,-1.092705,
  132. -1.355387,-1.412279,-1.207840,-0.763658,
  133. -0.176336,0.411682,0.857949,1.065855,
  134. 1.013795,0.757295,0.403866,0.070597,
  135. -0.159191,-0.263809,-0.285317,-0.305699,
  136. -0.406943,-0.631123,-0.956572,-1.300000,
  137. -1.544357,-1.582180,-1.358000,-0.893485,
  138. -0.285317,0.323977,0.791865,1.021653,
  139. 0.991651,0.757295,0.426010,0.114798,
  140. -0.093107,-0.176103,-0.176336,-0.175872,
  141. -0.256783,-0.461223,-0.767601,-1.092705,
  142. -1.319556,-1.340760,-1.100913,-0.621747,
  143. 0.000000,0.621747,1.100913,1.340760,
  144. 1.319556,1.092705,0.767601,0.461223,
  145. 0.256783,0.175872,0.176336,0.176103,
  146. };
  147. // End of File

借助MATLAB自带的滤波器设计工具filter designer,生成滤波器系数(滤波器截止频率选择1500Hz,滤除高频噪声,指定阶数为80阶)。

 再点击目标,选择生成到CCS IDE中

28335FPU为32位,故选择单精度浮点型 

 

 点击生成到CCS新建工程中即可。

生成的fadcoefs.h如下:

  1. /*
  2. * Filter Coefficients (C Source) generated by the Filter Design and Analysis Tool
  3. * Generated by MATLAB(R) 9.11 and Signal Processing Toolbox 8.7.
  4. * Generated on: 13-Jan-2023 10:06:26
  5. */
  6. /*
  7. * 离散时间 FIR 滤波器(实数)
  8. * ----------------
  9. * 滤波器结构 : 直接型 FIR
  10. * 滤波器长度 : 81
  11. * 稳定 : 是
  12. * 线性相位 : 是 (Type 1)
  13. */
  14. /* General type conversion for MATLAB generated C-code */
  15. #include "tmwtypes.h"
  16. /*
  17. * Expected path to tmwtypes.h
  18. * E:\Program Files\MATLAB\R2021b\extern\include\tmwtypes.h
  19. */
  20. /*
  21. * Warning - Filter coefficients were truncated to fit specified data type.
  22. * The resulting response may not match generated theoretical response.
  23. * Use the Filter Design & Analysis Tool to design accurate
  24. * single-precision filter coefficients.
  25. */
  26. const int BL = 81;
  27. const float coeffs[81] = {
  28. -0,-7.111737887e-06,-2.438249976e-05,-4.471002831e-05,-5.97600847e-05,
  29. -6.013489474e-05,-3.557757736e-05,2.479158684e-05,0.0001322122553,0.0002980003483,
  30. 0.0005332503351, 0.000848530326, 0.001253577648, 0.001757002436, 0.002366006607,
  31. 0.003086125944, 0.003921000753, 0.004872185644, 0.005938995164, 0.007118403912,
  32. 0.008404986933, 0.009790921584, 0.01126603596, 0.01281791367, 0.01443205494,
  33. 0.01609207876, 0.01777997613, 0.01947640628, 0.02116102912, 0.02281285636,
  34. 0.02441063337, 0.0259332303, 0.02736003883, 0.02867136523, 0.02984880283,
  35. 0.03087559529, 0.0317369625, 0.03242038563, 0.03291586414, 0.03321611136,
  36. 0.03331669047, 0.03321611136, 0.03291586414, 0.03242038563, 0.0317369625,
  37. 0.03087559529, 0.02984880283, 0.02867136523, 0.02736003883, 0.0259332303,
  38. 0.02441063337, 0.02281285636, 0.02116102912, 0.01947640628, 0.01777997613,
  39. 0.01609207876, 0.01443205494, 0.01281791367, 0.01126603596, 0.009790921584,
  40. 0.008404986933, 0.007118403912, 0.005938995164, 0.004872185644, 0.003921000753,
  41. 0.003086125944, 0.002366006607, 0.001757002436, 0.001253577648, 0.000848530326,
  42. 0.0005332503351,0.0002980003483,0.0001322122553,2.479158684e-05,-3.557757736e-05,
  43. -6.013489474e-05,-5.97600847e-05,-4.471002831e-05,-2.438249976e-05,-7.111737887e-06,
  44. -0
  45. };

需注意,生成的fadcoefs.h文件需包含tmwtypes.h文件

在生成的fadcoefs.h中包含tmwtypes.h的文件路径,将其添加到工程头文件路径即可。

 至此已完成了大部分准备工作,接下来开始编写函数进行滤波操作。

仿照TI官方例程,完成了以下函数的编写。

  1. /*
  2. * FIR.h
  3. *
  4. * Created on: 2023年1月12日
  5. * Author: yang
  6. */
  7. #ifndef APP_FIR_H_
  8. #define APP_FIR_H_
  9. #include "DSP28x_Project.h"
  10. #include <stdio.h>
  11. #include <string.h>
  12. void FIR_Init(void);
  13. void FIR_filter_run(void);
  14. #endif /* APP_FIR_H_ */
  1. /*
  2. * FIR.c
  3. *
  4. * Created on: 2023年1月12日
  5. * Author: yang
  6. */
  7. #include <FIR.h>
  8. #include "dsp.h"
  9. #include "fpu_filter.h"
  10. #include <math.h>
  11. #include "complex.h"
  12. #include "fdacoefs.h"
  13. #define pi 3.14159
  14. #define FIR_SIZE (512U)
  15. #define FIR_ORDER (80U) // ORDER = NUM_TAPS - 1,ORDER为滤波器阶数
  16. #pragma DATA_SECTION(coeffs, "FIR_buffer0");
  17. #pragma DATA_SECTION(FIR_output, "FIR_buffer1");
  18. // FIR_f32 object
  19. FIR_f32 fir;
  20. // Handle to the FIR_f32 object
  21. FIR_f32_Handle hnd_fir = &fir;
  22. // The filter coefficients are tacked on to the end of the
  23. // MATLAB generated input
  24. // The delay line buffer
  25. float delayLine[FIR_ORDER+1];
  26. float FIR_output[FIR_SIZE];
  27. extern float test_input[];
  28. extern const float coeffs[];
  29. //*****************************************************************************
  30. // the function definitions
  31. //*****************************************************************************
  32. void FIR_Init(void)
  33. {
  34. // Configure the object
  35. FIR_f32_setCoefficientsPtr(hnd_fir, coeffs);
  36. FIR_f32_setDelayLinePtr(hnd_fir, delayLine);
  37. FIR_f32_setOrder(hnd_fir, FIR_ORDER);
  38. FIR_f32_setInitFunction(hnd_fir, (v_pfn_v)FIR_f32_init);
  39. FIR_f32_setCalcFunction(hnd_fir, (v_pfn_v)FIR_f32_calc);
  40. // Copy the coefficients from test input into the "coeffs" array
  41. //memcpy(&coeffs, &test_input[FIR_SIZE], (FIR_ORDER + 1U)*sizeof(float));
  42. // Run the initialization function
  43. hnd_fir->init(hnd_fir);
  44. }
  45. void FIR_filter_run(void)
  46. {
  47. // Locals
  48. uint16_t i;
  49. float32u_t in, out;
  50. for(i = 0U; i < FIR_SIZE; i++)
  51. {
  52. in.f32 = test_input[i];
  53. out.f32 = FLT_MAX;
  54. FIR_f32_setInput(hnd_fir, in.f32);
  55. FIR_f32_setOutput(hnd_fir, out.f32);
  56. // Call the calculation routine
  57. hnd_fir->calc(hnd_fir);
  58. out.f32 = FIR_f32_getOutput(hnd_fir);
  59. FIR_output[i] = out.f32;
  60. }
  61. }
  62. // End of File

cmd文件如下

  1. /*
  2. // TI File $Revision: /main/3 $
  3. // Checkin $Date: July 9, 2008 14:12:45 $
  4. //###########################################################################
  5. //
  6. // FILE: 28335_RAM_lnk.cmd
  7. //
  8. // TITLE: Linker Command File For IQmath examples that run out of RAM
  9. //
  10. // NOTE; The example project uses memory protected by the
  11. // Code Security Module (CSM). Make sure the CSM is
  12. // unlocked before you load the project. One quick way
  13. // to do this on an erased device is to open a memory
  14. // window to the CSM password locations. If these locations
  15. // read back 0xFFFF (or non-zero), then the CSM is unlocked:
  16. //
  17. // Device Password locations
  18. // 28335: 0x33FFF8 - 0x33FFFF
  19. //
  20. //###########################################################################
  21. //
  22. //
  23. // $Copyright: Copyright (C) 2014-2022 Texas Instruments Incorporated -
  24. // http://www.ti.com/ ALL RIGHTS RESERVED $
  25. //###########################################################################
  26. */
  27. MEMORY
  28. {
  29. PAGE 0 :
  30. BEGIN : origin = 0x000000, length = 0x000002 /* Boot to M0 will go here */
  31. BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0, BOOT rom will use this for stack */
  32. RAML0 : origin = 0x008000, length = 0x000800
  33. RAML1L2 : origin = 0x008800, length = 0x004800
  34. ZONE7A : origin = 0x200000, length = 0x00FC00 /* XINTF zone 7 - program space */
  35. FLASHH : origin = 0x300000, length = 0x008000 /* on-chip FLASH */
  36. FLASHG : origin = 0x308000, length = 0x008000 /* on-chip FLASH */
  37. FLASHF : origin = 0x310000, length = 0x008000 /* on-chip FLASH */
  38. FLASHE : origin = 0x318000, length = 0x008000 /* on-chip FLASH */
  39. FLASHD : origin = 0x320000, length = 0x008000 /* on-chip FLASH */
  40. FLASHC : origin = 0x328000, length = 0x008000 /* on-chip FLASH */
  41. FLASHA : origin = 0x338000, length = 0x007F80 /* on-chip FLASH */
  42. CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
  43. CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
  44. OTP : origin = 0x380400, length = 0x000400 /* on-chip OTP */
  45. ADC_CAL : origin = 0x380080, length = 0x000009
  46. IQTABLES : origin = 0x3FE000, length = 0x000b50 /* IQ Math Tables in Boot ROM */
  47. IQTABLES2 : origin = 0x3FEB50, length = 0x00008c /* IQ Math Tables in Boot ROM */
  48. FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0 /* FPU Tables in Boot ROM */
  49. ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
  50. RESET : origin = 0x3FFFC0, length = 0x000002
  51. VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */
  52. PAGE 1 :
  53. BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0, BOOT rom will use this for stack */
  54. RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
  55. RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
  56. RAML3 : origin = 0x00D000, length = 0x001000
  57. RAML4 : origin = 0x00E000, length = 0x001000
  58. RAML5 : origin = 0x00F000, length = 0x001000
  59. ZONE7B : origin = 0x20FC00, length = 0x000400 /* XINTF zone 7 - data space */
  60. FLASHB : origin = 0x330000, length = 0x008000 /* on-chip FLASH */
  61. }
  62. SECTIONS
  63. {
  64. FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD
  65. /* Setup for "boot to SARAM" mode:
  66. The codestart section (found in DSP28_CodeStartBranch.asm)
  67. re-directs execution to the start of user code. */
  68. codestart : > BEGIN, PAGE = 0
  69. #ifdef __TI_COMPILER_VERSION__
  70. #if __TI_COMPILER_VERSION__ >= 15009000
  71. .TI.ramfunc : {} LOAD = RAML0,
  72. RUN = RAML0,
  73. LOAD_START(_RamfuncsLoadStart),
  74. LOAD_END(_RamfuncsLoadEnd),
  75. RUN_START(_RamfuncsRunStart),
  76. LOAD_SIZE(_RamfuncsLoadSize),
  77. PAGE = 0
  78. #else
  79. ramfuncs : LOAD = RAML0,
  80. RUN = RAML0,
  81. LOAD_START(_RamfuncsLoadStart),
  82. LOAD_END(_RamfuncsLoadEnd),
  83. RUN_START(_RamfuncsRunStart),
  84. LOAD_SIZE(_RamfuncsLoadSize),
  85. PAGE = 0
  86. #endif
  87. #endif
  88. .text : {*(.text)}>> RAML1L2|RAML0 PAGE = 0
  89. .cinit : > RAML0, PAGE = 0
  90. .pinit : > RAML0, PAGE = 0
  91. .switch : > RAML0, PAGE = 0
  92. .stack : > RAMM1, PAGE = 1
  93. .ebss : > RAML3, PAGE = 1
  94. .econst : > RAML3, PAGE = 1
  95. .sysmem : > RAML3, PAGE = 1
  96. .esysmem : > RAML3, PAGE = 1
  97. .sysmem : > RAML3, PAGE = 1
  98. FIR_buffer0: > RAML4, PAGE = 1
  99. FIR_buffer1: > RAML5, PAGE = 1
  100. .cio : > RAML3, PAGE = 1
  101. ZONE7DATA : > ZONE7B, PAGE = 1
  102. DMARAML4 : > RAML4, PAGE = 1
  103. DMARAML5 : > RAML5, PAGE = 1
  104. .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used */
  105. csm_rsvd : > CSM_RSVD PAGE = 0, TYPE = DSECT /* not used for SARAM examples */
  106. csmpasswds : > CSM_PWL PAGE = 0, TYPE = DSECT /* not used for SARAM examples */
  107. /* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
  108. .adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
  109. }
  110. /*
  111. //===========================================================================
  112. // End of file.
  113. //===========================================================================
  114. */

再在主函数中调用FIR_Init(); FIR_filter_run();函数即可完成滤波操作。

借助CCS的Graph画图工具测试滤波效果如下:

原始信号:

滤波后信号:

测试结束,完成了FIR滤波。

本人为TMS320F28335学习小白,如有错误,请大佬多多指正。

本文参考了以下文章:​​​​​​

[1]TMS320F28335调用官方库进行FFT频谱分析_PeepFuture橙子的博客-CSDN博客

[2]https://blog.csdn.net/weixin_42216236/article/details/127375580

文章知识点与官方知识档案匹配,可进一步学习相关知识
算法技能树首页概览48400 人正在系统学习中