International Journal of Engineering Trends and Technology (IJETT) – Volume22 Number 5- April2015 Digital Signal Processing On Embedded Processors M.Sandeep Sarma Electronics & Instrumentation Department Gitam University Visakhapatnam, India K.V.Ravi Kumar EIE Dept. Gitam University Visakhapatnam B.Rajesh Kumar EIE Dept. Gitam University Visakhapatnam Abstract—This paper discusses how to effectively utilize the embedded processor by stretching it to the different applications and thereby obtaining the important qualities of digital electronics we strive for i.e. improving performance and power with cutting down the price. With the advent of System on Chip (SoC), we are able to integrate many functional blocks on a single chip, but by making the SoC to execute different applications also leads to the hardware optimization thereby meeting the above digital electronics requirements. In this paper we discuss how to run different filters to remove the electrical interferences, baseline wandering and algorithms to detect the QRS peak i.e. performing Digital Signal Processing applications on the Cortex M3 microcontroller, which is an embedded processor not designed mainly for signal processing applications. P.H.S.T.Murthy EIE Dept. Gitam University Visakhapatnam incorporating Digital Signal processing applications on Cortex M3 microcontroller in processing the ECG signal, the controller Cortex M3 can be further used to transmit the ECG processed data by using the core controller operations. Designing a notch filter helps to overcome the electrical line interference on the signal. High-frequency components which are produced by chest and extremity muscles can be removed by implementing a low pass FIR filter. Keywords— Embedded Systems; Digital Signal Processing; MATLAB; Cortex; ECG (Electrocardiogram). Introduction In this Digital world, every day in the process of improving the performance of the device we strive for optimizing the existing techniques, methods or technologies to reduce the software overhead and to reduce the hardware. Many different optimizing techniques are adopted while coding the software which can efficiently reduce the code length and thus resulting in the reduction of the overhead provided by the code. Reduction in the hardware can be obtained even by implementing more number of functions on the existing chip. Today the trend is to perform both the Digital Signal Processing (DSP) and the Microcontroller operations on the single embedded processor. The present practice is to have a Digital Signal Processor and the Microcontroller interfaced together to perform the functionality of an application, where the Digital signal processing and the core microcontroller operations are individually performed by respective controllers, but due to the interface between them we need to compromise on the performance. But with the recent advancements in the System on Chip technologies we can incorporate application-specific Digital Signal Processors with ARM cores on the die of SoCs to offload the data i.e. demanded from the CPU in order to optimize power consumption and performance. This technique of performing different operations like signal processing and core microcontroller operations on a single embedded processor (Cortex M3 in this paper) is best suitable to the applications where some basic signal processing is required with no need of stringent computations. Though this paper discusses only about ISSN: 2231-5381 http://www.ijettjournal.org ECG SIGNAL WITH AND WITHOUT NOISE Page 222 International Journal of Engineering Trends and Technology (IJETT) – Volume22 Number 5- April2015 I. MODELLING -1 -1 -1 -1 x(n) A. Step to run a DSP application on an Embedded Processor: Mathematical Coefficients. analysis: To find out the x Code Conversion techniques to the required Hardware. Compiling, Linking, Executing and Dumping using respective Integrated Development Environment In this paper, we observe the results of the low pass FIR filter step by step right from the mathematical analysis to the final ARM Cortex M3 compatible code. B. Why to Model a FIR filter: The powerful design algorithms existed has made FIR filters to be extensively used along with the inherent stability they obtained when implemented in non-recursive form. The other reasons are that we can attain linear phase with ease and their facile extensibility to multi-rate cases along with the ample hardware support existed for them. The amazing property of FIR filters is linear phase i.e. the phase is linear function of the frequency. The phase distortion can be eliminated by delaying signals of all frequencies with the same amount of time. In many audio signal processing applications the concept of linear phase is strictly adopted. II. IMPLEMENTATION A. Mathematical analysis: To find out the filter Coefficients and filter lenth Figure 1 shows the basic block diagram for a FIR filter of length N. To operate on the prior input samples we introduce the delays. The output y(n) at any time n is the summation of all the delayed samples multiplied by appropriate coefficients bk . ISSN: 2231-5381 z z b0 b1 b2 x + Performing Soft Computing: Using Signal Processing tools like MATLAB. Installing hardware packages: from Math works. z x + z x bN-1 + y(n) Figure 1 The process of selecting the filter's length and coefficients is called filter design. The goal is to set those parameters such that certain desired low pass band parameters will result from running the filter. We have considered 63 as the filter order in this paper and it varies depending on the desired processing on the signal. The differential equation for the finite impulse response is given as In the process of finding the system response if we replace x[n] with ẟ [n] then, . Finally, we find the coefficients to be b0 = h [0],b1 = h [1] and bk = h [k]. B. Performing soft computing using MATLAB: In the below pseudo code, we have added two sinusoidal signals of 1 kHz and 50Hz frequencies with a random noise signal and the resulted signal is processed through a FIR filtering function. NN = 2000; for k = 1:NN x2k = step(hsin1); % generate 2K Hz sine wave X50 = step(hsin2); % generate 50Hz sine wave n1 = randn(size(x1k),'single')*sqrt(.05); % generate noise signal u1 = x2k+x50+n1; y1 = ex_fircmsis_tut_ml(u1); step(hs,[u1,y1]); end FIR filter function ex_fircmsis_tut_ml(u1) order is set to 63 and wn to 0.33 and these values can be varied with our desired response. Below is the coding for the function function y1 = ex_fircmsis_tut_ml(u1) persistent h; if isempty(h) h=dsp.FIRFilter('Numerator',fir1(63,0.33); end y1 = step(h, u1); end http://www.ijettjournal.org Page 223 International Journal of Engineering Trends and Technology (IJETT) – Volume22 Number 5- April2015 FIGURE 3: TAB IN WHICH SPECIFICATIONS TO BE ENTERED IN CONVERTING THE CODE FIGURE 4: TAB IN WHICH THE CONVERTED CODE AVAILABLE WITH HEADER FILES. FIGURE 2: SPECTRUM ANALYZER PLOTTING INPUT SIGNALS ON CHANNEL 1 AND FILTERED OUTPUT ON CHANNEL 2 After running the code in MATLAB, the output can be observed on the spectrum analyzer as shown in figure 2 and the order of the filter can be modified until the desired response is observed on the spectrum analyzer. E. Final execution on an Embedded Hardware: The generated code can be compiled and executed on ARM Cortex-M target by using a user selected Integrated Development Environment, for example, ARM® KEIL™ uVision® IDE. III. C. Installing Hardware Packages from Math Works: DSP System Toolbox Support Package is available for ARM Cortex – M Processors and it provides Optimized C code generation for ARM Cortex–M processors from System objects with MATLAB Coder and Embedded Coder and supports fixed-point data type support for FIR filter, in ARM Cortex-M support package. D. Code conversion techniques to the required hardware: After once the desired response is obtained on the spectrum analyzer with the code, we can convert the code into the necessary format by modifying the hardware configurations shown in figure 3 that implies selecting type of the microcontroller on which the converted code is to be dumped. CONCLUSION We fail to effectively utilize the hardware in many real-time systems. But it would help us to achieve few digital electronics Constraints like performance and power. The theme of this paper concentrates on how to incorporate a Digital Signal Processing application on a core Microcontroller as it is required to process Digital signals in many applications. This paper discusses and makes it conspicuous with ECG signal processing application though it can be stretched to any applications where the Digital Signal Processing is required. REFERENCES [1] [2] [3] [4] ISSN: 2231-5381 IS IEEE Transactions on information technology In biomedicine, vol. 9, no. 1, march 2005. IEEE Transactions on information technology in biomedicine, vol. 14, no. 5, september 2010. IEEE Transactions on information technology in biomedicine, vol. 14, no. 3, may 2010. http://in.mathworks.com/. http://www.ijettjournal.org Page 224