Question: Here is the task and below is the Reference Design CCS project code. Task: Make a Duplicate of the Reference Design CCS project and start

Here is the task and below is the Reference Design CCS project code.
Task: Make a Duplicate of the Reference Design CCS project and start modifying the duplicate.
Create MyFilter menu item in CCS project and implement the filter you designed => flash to the board.
Your filter should run in the DSP and be accessible through buttons S1 and S2.Place your filter first in the reference design menu system.
Test the design using the board and eg 3.5mm Y-cable (mic + speaker separated)
Input noisy signalOutput clear signal and test it with using the eg Android app called Spectroid.
Deliverables: two files (can be zipped together)
Report on the Texas Instruments DSP project implementation with Screenshots (min 2 pages, Screenshot from a Spectroid application from where we can see, that the noise "spike" has gone)
CCS code for implementing the filter
Code:
#include
#include "application.h"
// Define buffer size
#define BUFFER_SIZE 256
// Define pushbutton configurations
#define PUSHBUTTON1_PORT P1
#define PUSHBUTTON1_PIN BIT1
#define PUSHBUTTON1_IFG P1IFG
#define PUSHBUTTON2_PORT P2
#define PUSHBUTTON2_PIN BIT2
#define PUSHBUTTON2_IFG P2IFG
// Global variables
bool enableFilter = false; // Filter control flag
float audioBuffer[BUFFER_SIZE]; // Audio buffer for processing
float filterHistory[1]={0}; // History for low-pass filter
// Function prototypes
void initClock(void);
void initGpio(void);
void RunMyFilter(void);
// Low-pass filter implementation
float lowPassFilter(float input, float *history){
const float a0=0.8, a1=0.2; // Coefficients
float output = a0* input + a1* history[0];
history[0]= input; // Update history
return output;
}
// Run "MyFilter" function
void RunMyFilter(void){
for (int i =0; i < BUFFER_SIZE; i++){
if (enableFilter){
audioBuffer[i]= lowPassFilter(audioBuffer[i], filterHistory);
}
}
}
// Main function
int main(void){
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
initClock();
initGpio();
PM5CTL0 &= ~LOCKLPM5; // Clear lock bit
while (1){
RunMyFilter(); // Process audio
}
return 0;
}
// Initialize clock
void initClock(void){
PJSEL0|= BIT4| BIT5; // XT1
CSCTL0_H = CSKEY >>8; // Unlock CS registers
CSCTL1= DCOFSEL_6; // Set DCO to 8MHz
CSCTL2= SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3= DIVA__1| DIVS__1| DIVM__1; // Set dividers
CSCTL4 &= ~LFXTOFF;
do {
CSCTL5 &= ~LFXTOFFG; // Clear fault flags
SFRIFG1 &= ~OFIFG;
} while (SFRIFG1 & OFIFG); // Wait for stabilization
CSCTL0_H =0; // Lock CS registers
}
// Initialize GPIO
void initGpio(void){
P1OUT =0x00;
P1DIR =0xFF;
P2OUT =0x00;
P2DIR =0xFF;
// Configure pushbuttons
GPIO_setAsInputPinWithPullUpResistor(PUSHBUTTON1_PORT, PUSHBUTTON1_PIN);
GPIO_selectInterruptEdge(PUSHBUTTON1_PORT, PUSHBUTTON1_PIN, GPIO_HIGH_TO_LOW_TRANSITION);
GPIO_setAsInputPinWithPullUpResistor(PUSHBUTTON2_PORT, PUSHBUTTON2_PIN);
GPIO_selectInterruptEdge(PUSHBUTTON2_PORT, PUSHBUTTON2_PIN, GPIO_HIGH_TO_LOW_TRANSITION);
}
// Interrupt handlers for buttons
void PORT1_IRQHandler(void){
if (PUSHBUTTON1_IFG & PUSHBUTTON1_PIN){// Button S1 pressed
enableFilter = true; // Enable filter
GPIO_clearInterrupt(PUSHBUTTON1_PORT, PUSHBUTTON1_PIN);
}
if (PUSHBUTTON2_IFG & PUSHBUTTON2_PIN){// Button S2 pressed
enableFilter = false; // Disable filter
GPIO_clearInterrupt(PUSHBUTTON2_PORT, PUSHBUTTON2_PIN);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!