To Generate a sinewave using IIR Filter in TMS320C6745 DSP KIT.
There are several ways to implement the sine wave generator on DSP processor such as a lookup table, interpolation, polynomials, etc. One efficient technique is using an IIR filter, making it oscillating by locating its poles in the unit circle of the Argand diagram. A typical 2nd order IIR filter can be established as illustrated in Figure 1. Give this IIR two initial values as below based on the assumption of 40 samples to make up a complete sine wave, then disconnect the
Figure 1. 2nd Order filter for genarating since wave
x[n] from the input. At time interval n=2,
Properly choose filter coefficients A and B, so that this IIR will oscillate by itself. The formal proof can be found in the DSP related text book. You can take a short cut to find the value of A and B simply by solving the difference equations:
0.3090 = A ×0.1564 + B ×0,
0.4540 = A ×0.3090 + B ×0.1564,
therefore A=1.9754 and B=–1. Examining the behavior of this IIR filter by its transfer function as below:
y[n] = 1.9754•y[n–1] – y[n–2] + x[n]
Take a Z-transform:
Y[Z](1 – 1.9754Z–1 + Z–2) = X[Z].
The transfer function is
Its has two poles Z=0.9877+j0.1564 and Z=0.9877–j0.1564. The following program codes show how to program the TMS320C6x using C language to implement the IIR Sine wave generator. You can utilize the Probe point feature available in the Code Composer Studio by connecting the varying “output” of the sine wave to a graphical display.
1. Open Code Composer Studio v4 .
2. In WorkSpace Launcher.
3. FILE ⇒ NEW ⇒ CCS PROJECT
5. Paste the following board library files in workspace location.
6. Paste the Linker file in the project location.(linker file is available in cd)
Note: Those folders and linker file are availble at cd.
7. PROJECT ⇒ PROPERTIES ⇒ C/C++ BUILD → BASIC OPTION
8. FILE ⇒ NEW ⇒ TARGET CONFIGURATION FILE
9. In C/C++ Project window, Right click the project ⇒ REBUILD PROJECT.
11. TARGET ⇒ DEBUG ACTIVE PROJECT.
12. TARGET ⇒ RUN.(wait to generate samples)
13. TARGET ⇒ HALT.(Auto halt)
14. TOOLS ⇒ GRAPH ⇒ SINGLE TIME
Thus, the Sine waveform was generated using IIR Filter and the sine samples is stored & Displayed in graph.
we respect your privacy.