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

Real Time Digital Signal Processing and its performance analysis

FFT / DFT program : program it in C, compile it, debug it and download it to eval board to test

2. Let the eval boad take input signal for your fft/dft program to process it

3. Analyse the microprocessor performance accordingly such as response time, cpu load, latency time,

My project involves real time digital signal processing and its performance analysis.
I previously wrote my quote in code composer studio, however I faced the output problems and some debugging issues.
I would like to check with the community forum experts, to see if anyone can help me out with my project. I have written the codes, I can compile and build it in code composer but when I run in debug mode it fail.
Some friends suggested to me to use keil as it has a performance analyser, is better as I will be able to see my output.
I will be attaching my codes here, if I can get help from experts, I will be very happy.
If anyone is able to help me identify what actually went wrong in my codes, I will be very happy.
HARDWARE: LM3S8962 EVALUATION BOARD
COMPILER: KEIL UVISION 454, (CURRENT ATTACH CODES DONE IN CODE COMPOSER STUDIO AND WILL WANT IT TO BE DONE IN KEIL UVISION)

/* * main.c */
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/sysctl.h"
#include "driverlib/adc.h"
#include "driverlib/interrupt.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "grlib/grLib.h"
#include "grlib/grLibDriver.h"

short sample[8];

#pragma vector=unused_interrupts
interrupt void user_trap_function(void) //ISR to handle the end of sampling interrup, being the only enabled interrupt
{ int df = 15625; //fs/N = 125000/8 int Re[8]; int Im[8]; int Ampl[8]; int fr[8]; int N = 8; //number of samples x[N] = (short)sample; // convert sample values to short integers for computation int out[2] = {0,0}; //init Re and Im results int j=0; for (j = 0; j < N; j++){ dft(x,j,out); //call DFT function Re[j] = out[0]; Im[j] = out[1]; //collect real and imaginary parts Ampl[j] = ((Re[j]^2)+(Im[j]^2))^(1/2); fr[j] = df*j;

long lX1 = (long)Ampl[j]; long lX2 = (long)Ampl[j]+1; long lY = (long)fr[j]; long ulValue = 128;

void LineDrawH (pvDisplayData, lX1, , lX1, lY, ulValue);

}

}

int M = 0;
unsigned long sample[8]

void LineDrawH (void *pvDisplayData, long lX1, long lX2, long lY, unsigned long ulValue);

void ADC_init( void ) { SYSCTL_RCGC0_R |= SYSCTL_RCGC0_ADC; // Enable the clock to the ADC module SYSCTL_RCGC0_R |= SYSCTL_RCGC0_ADCSPD125K; // Configure the ADC to sample at 125KS/s ADCSequenceDisable(ADC_BASE, 0); // Disable sample sequences 0 ADCSequenceConfigure(ADC_BASE, 0, ADC_TRIGGER_PROCESSOR, 1); // Configure sample sequence 0: processor trigger, priority = 1 IntPrioritySet(INT_ADC0SS0,0); // Set SS0 interrupt priority to 0 ADCSequenceStepConfigure(ADC_BASE, 0, 0, ADC_CTL_CH0); // Configure sample sequence 0 to sample external input ADCSequenceStepConfigure(ADC_BASE, 0, 1, ADC_CTL_CH0); ADCSequenceStepConfigure(ADC_BASE, 0, 2, ADC_CTL_CH0); ADCSequenceStepConfigure(ADC_BASE, 0, 3, ADC_CTL_CH0); ADCSequenceStepConfigure(ADC_BASE, 0, 4, ADC_CTL_CH0); ADCSequenceStepConfigure(ADC_BASE, 0, 5, ADC_CTL_CH0); ADCSequenceStepConfigure(ADC_BASE, 0, 6, ADC_CTL_CH0); ADCSequenceStepConfigure(ADC_BASE, 0, 7, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END); //set interrupt flag after the seventh step ADCIntEnable(ADC_BASE, 0); // Enable the interrupt for sample sequence 0 IntEnable(INT_ADC0SS0); // Enable SS0 Interupt in NVIC M+=M; // integer to detect if ADC is initialized
}

unsigned long getADC0(void)
{

ADCProcessorTrigger(ADC0_BASE, 0); //initiate sampling while(!ADCIntStatus(ADC0_BASE, 0, false)); //monitor interrupt flag for completion of sampling ADCSequenceDataGet(ADC0_BASE, 0, sample); //assign samples to global variable, sample

return sample; //return sample to calling function
}

int dft(long *x, short k, int *out) //DFT function { int sumRe = 0; //init real component int sumIm = 0; //init imaginary component int i = 0; int N = 8; float pi = 3.1416 ; float cs = 0; //init cosine component float sn = 0; //init sine component for (i = 0; i < N; i++) //for N-point DFT { cs = cos(2*pi*(k)*i/N); //real component sn = sin(2*pi*(k)*i/N); //imaginary component sumRe += x[i]*cs; //sum of real components sumIm -= x[i]*sn; //sum of imaginary components } out[0] = sumRe; //sum of real components out[1] = sumIm; //sum of imaginary components

return(out); }
int main(void) { if (M>0){ ADC_init(); //initialize ADC module if not already initialized } getADC0(); //start conversion. Interrupt flag will be set after sampling and this functioned called again after ISR executes

return 0;
}

//My codes are written in code composer studio, now I want to write these c algorithm in keil. If anyone knows of any perfect examples, that I can use it for my project, please help me out. really appreciate.
// parkerxj99@gmail.com