Professional Documents
Culture Documents
Digital Signal Processing Using Symbian C++ in Embedded Systems
Digital Signal Processing Using Symbian C++ in Embedded Systems
Table of Contents
1 Introduction................................................................................................................................... 6
2 Digital Signal Processing.............................................................................................................. 7
2.1 Sampling................................................................................................................................. 7
2.1.1 Sampling Theorem ........................................................................................................ 7
2.1.2 Aliasing ............................................................................................................................ 8
3 Discrete Fourier Transform (DFT) ............................................................................................... 10
3.1 Properties of the DFT........................................................................................................... 11
3.1.1 Linearity ......................................................................................................................... 11
3.1.2 Symmetry ...................................................................................................................... 11
3.1.3 Circular Time Shift ........................................................................................................ 11
3.1.4 Convolution.................................................................................................................. 12
3.1.5 Multiplication by exponential.................................................................................... 12
3.1.6 Modulation ................................................................................................................... 12
3.2 Leakage ............................................................................................................................... 12
3.3 Windowing ........................................................................................................................... 15
3.3.1 Rectangular Window .................................................................................................. 15
3.3.2 Triangular Window ....................................................................................................... 15
3.3.3 Hanning Window ......................................................................................................... 15
3.3.4 Hamming Window....................................................................................................... 15
4 Fast Fourier Transform................................................................................................................. 17
4.1 FFT Code............................................................................................................................... 21
5 Filtering ......................................................................................................................................... 23
5.1 Finite Impulse Response Filters .......................................................................................... 23
5.2 Infinite Impulse Response Filters........................................................................................ 24
6 Symbian OS ................................................................................................................................. 26
6.1 Hardware Architecture...................................................................................................... 26
6.2 C++ and Object Orientation ............................................................................................ 27
6.2.1 Fundamental Data Types........................................................................................... 27
6.2.2 Naming Conventions.................................................................................................. 28
6.2.2.1 Class Names.......................................................................................................... 28
6.2.2.1.1 T Classes............................................................................................................. 28
6.2.2.1.2 C Classes ........................................................................................................... 28
6.2.2.1.3 R Classes ............................................................................................................ 29
6.2.2.1.4 M Classes ........................................................................................................... 29
6.2.2.1.5 Static Classes .................................................................................................... 29
6.2.2.1.6 Structs................................................................................................................. 29
6.3 Symbian Software Structure in Nokia Devices ............................................................... 29
6.3.1 Application Class......................................................................................................... 30
6.3.2 Document Object....................................................................................................... 30
6.3.3 AppUi............................................................................................................................. 30
6.3.4 View Control................................................................................................................. 30
6.3.5 Model/Engine .............................................................................................................. 30
7 Development of the Application ............................................................................................ 31
7.1 Technical Specification of the Nokia 7710 ..................................................................... 31
7.2 Tools Used............................................................................................................................. 32
Table of Figures
Table of Tables
1 Introduction
Embedded Systems are present everywhere around the world, from small tiny applications
to high-end complex systems. An embedded system is a special-purpose system in which
the computer is completely encapsulated by the device it controls. Unlike a general-
purpose computer, such as a personal computer, an embedded system performs one or a
few pre-defined tasks, usually with very specific requirements. Since the system is
dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of
the product. (www.en.wikipedia.org, 2006/11/17).
The present document shows the results obtained in the development of an application
that collect information from a mobile device and process it using DSP techniques. The
system implemented runs on a mobile device that uses Symbian as operating system.
Hence, the application was developed win Symbian C++ using Microsoft Visual Studio.Net
2003, a Nokia SDK for the Nokia 7710 and a Nokia 7710 mobile device in which the
application was tested with satisfactory results. Consequently, this document will present
some basic concepts regarding to DSP technology, Symbian OS and the development
results.
Digital Signal Processing (DSP) is related to the numerical manipulation of signals and data
which are stored in sampled form (Lynn and Fuerst, 1999). It involves several steps which
are implemented from the acquisition of the analog input (using the analog-to-digital
conversion - ADC), which it can be the result of a sensor output (voltage, temperature,
pressure, and so on) to the generation of an analog output (using and digital-to-analog
conversion DAC) as a result of the processing. This scheme can be seen in Figure 1.
2.1 Sampling
As it was discussed above, one of the processes involved in DSP is the ADC (Analog-to-
Digital conversion) which consists in the conversion of an analog continuous signal into
discrete signal. This process is shown in Figure 2 where a 1 Hz sinusoidal input signal is
sampled at a sampling frequency, Fs = 16 samples/second, during 4 seconds.
As it was shown in the DSP scheme in Figure 1, the aim of an embedded system is to be
able to represent the signal which it is processing. Consequently, it must convert the
analog signal into a discrete sequence of numbers. The key point in this process is to define
how often the system must take a sample of the signal in order to have an accurate
representation of it.
This question was formulated and solved by Shannon and his conclusion is defined by the
Shannon’s theorem. This theorem states that an analog signal, containing components up
to a maximum frequency f1 Hz, is able to be reconstructed completely if it is sampled a
regularly-spaced time intervals with a frequency of at least 2f1 samples per second. This is
shown in Equation 1.
1
T=
2 f1
Equation 1: Sampling Interval
2.1.2 Aliasing
If the sampling condition establish by the sampling theorem, discussed previously, is not
satisfied then frequencies will overlap, which means that frequencies above the sampling
frequency will appear below half the sampling frequency. This condition can be seen in
Figure 3 where the system is designed to acquire a 1 Hz sinusoidal signal. However, a 7 Hz
sinusoidal signal may affect the sampling process.
¾ Sampling at least with a sampling frequency (Fs) equal to 2B, where B is the maximum
frequency of the input signal.
¾ Implementing a low pass filter, usually called anti-aliasing filter. The function of this filter
is to restrict the bandwidth of the signal in order to satisfy the sampling theorem.
The following section is related with Fourier Transform which is the heart of every digital
signal processing system.
Spectrum analysis is the basic step in digital signal processing and always has been a
matter of concern in different fields of the engineering. The Digital Fourier Transform (DFT) is
the straightforward method to obtain the frequency components of any digital sequence.
However, the DFT requires large number of computations, which means time and
processing power for embedded systems, and these resources are critical in real world
applications. Consequently, since 1965 — after the discovery of a procedure to reduce the
number of computations in the computation of the DFT (Cooley and Tukey, 1965) —, a
series of algorithms has been developed in order to reduce the amount of required
computations to obtain the frequency components, these are called, collectively, Fast
Fourier Transform (FFT) Algorithms. As it can be seen later in this document, they are a
mathematical procedure that give the same result as the DFT but more efficiently.
The use of discrete Fourier series is restricted to periodic signals, which make them
impossible to apply when the signal to analyse is a non-periodic one (Lai, 2004). However,
Discrete Fourier Transform (DFT) can be named as an additional Fourier representation,
which can be used to analyse any digital signal of finite length (Lynn and Fuerst, 1998).
The DFT is derived from the continuous Fourier Transform which is defined as below (Lyons,
R, 2004):
∞
X ( f ) = ∫ x(t )e − j 2πft dt
−∞
Equation 2: Continuous Fourier Transform
Where x(t) is the continuous time-domain signal. This equation is used to extract spectrum
information from the input signal, x(t), (McClellan, Schafer, Yoder, 2003). In fact, the result
of its application to any input signal is the frequency domain representation, X(f).
N −1
X (m) = ∑ x(n)e − j 2πnm / N
n =0
Equation 3: DFT Equation (exponential Form)
N −1
X (m) = ∑ x(n)[cos(2πnm / N ) − j sin(2πnm / N )]
n =0
Equation 4: DFT Equation (rectangular form)
x(n) = nth component of the input signal which is represented in discrete form.
X(m) = mth component of the output.
m = index of the DFT output in the frequency domain,
N = number of samples of the input signal.
The DFT can be seen as a mathematical transformation of any discrete input signal into its
spectral representation. In fact, it gives N distinct spectral coefficients X(m) for any given
discrete signal.
There are important DFT properties that make it useful in DSP processing. These properties
are demonstrated in several references (Cristi 2004), (Lynn and Fuerst, 1999). The following
gives a summary of some of them:
3.1.1 Linearity
If
x1[n] ↔ X 1[m] and X 2 [n] ↔ X 2 [m]
Then
Ax1[n] + BX 1[m] ↔ AX 2 [n] ↔ BX 2 [m]
Equation 5: Linearity property of DFT
3.1.2 Symmetry
If the input signal, denoted as x[n] with n= 0, 1, 2, 3,… N-1, is real then:
X ( m) = X * ( N − m) 1
Equation 6: Symmetry property of DFT
If
x[n] = X [m]
Then
x1[n − n0 ] ↔ X [m]e( − j 2πmn0 / N ) = X [m]Wnmn0
Equation 7: Time shifting property of DFT
3.1.4 Convolution
If
x1[n] ↔ X 1[m] and X 2 [n] ↔ X 2 [m]
Then
N −1
∑ x [ n ] x [ k − n ] ↔ X [ m] X
k =0
1 2 1 2 [ m]
Equation 8: Convolution property of the DFT
If
x[n] ↔ X [m]
Then
x[n]e j 2πnM / N ↔ X [(n − M ) N ]
Equation 9: Multiplication by exponential property of the DFT
3.1.6 Modulation
If
x1[n] ↔ X 1[m] and X 2 [n] ↔ X 2 [m]
Then
N −1
1
x1[n]x2 [n] ↔
N
∑ X [k ] X
k =0
1 2 [m − k ]
Equation 10: Modulation property of the DFT
3.2 Leakage
Because DFT output is just an approximation of the true spectra of the original input signal,
it is possible to find output values in the spectrum that do not match the real spectra
values of the input. This condition is called leakage.
In order to understand the leakage characteristic in the DFT it is necessary to see the
following examples. Figure 4 shows the DFT of the input signal denoted as sin(ωt) with f=1Hz.
The frequency sampling, Fs, has been established as 16 Samples per cycle. In this example
a four cycles signal is being analysed which means N = 64.
The DFT is applied to the input signal in order to determine the frequency components of it.
As can be seen in Figure 4, most of the output values of the DFT, denoted as |X(m)|, are
zero with exception of the frequency components with index m=4 and m=60, that is X(4) =
32 and X(60) = 32. As it was stated above each output value of |X(m)| represents the
magnitude of the frequency component determined by the index m. Moreover, to
determine which component represent m=4 and m=60 the following equation must be
applied:
mf s
f component (m) = , where m=0,1,2,…, N-1.
N
Equation 11: DFT frequency component
As a result of applying this equation, it is possible to obtain the frequency values of m=4
and m=64;
4 fs 60 f s
f component (4) = = 1hz and f component (60) = = 15hz
64 64
The importance of this result is that the frequency component, m=4, corresponds to 1hz
which is accordingly with the pure sinusoidal input signal, with frequency 1hz, that is being
analysed. The value found at m=60, corresponds to the symmetry property of the DFT as it
was discussed before.
However, the following example, shown in Figure 5, gives a different result. In this case, the
frequency of the input signal has been changed to 0.875 hz, note that The Sampling
Theorem is still enforced (Lynn and Fuerst, 1999). Consequently, under this new conditions
an input signal of 3.5 cycles is being analysed with the same Fs=16 samples per cycles and
with N=64.
As can be seen in the figure, the application of the DFT to the new signal gives a set of
different results. Applying Equation 11, to the first set of outputs, give the following results:
m Fcomponent(m) |X(m)|
0 0.00 Hz 5.76
1 0.25 Hz 6.28
2 0.50 Hz 8.59
3 0.75 Hz 21.88
4 1.00 Hz 19.07
5 1.25 Hz 5.65
6 1.50 Hz 3.06
7 1.75 Hz 2.00
8 2.00 Hz 1.44
Table 1: DFT Leakage effects
Table 1 shows the magnitude values for the first nine frequency components. It is noted
that there are values different from zero to frequencies that does not match this frequency
of the input signal. This is called leakage. Moreover, according to the results shown there is
a DC component in the input, which it is not true. Frequency component, m=0
corresponds to DC.
The previous results showed an undesired characteristic of the DFT, Leakage. And it is
caused due to the fact that the input signal does not have an integral number of cycles
over the period analysed, in this case N=64 samples. Consequently, the input energy of the
signal has leaked in the other frequency components (Lyons, 2004).
3.3 Windowing
Leakage is a common problem that is present in practical digital signal processing systems.
Because signals in the real world contain a mixture of frequencies and very few of them
behave in the way presented in Figure 4, where it was possible to capture an integer
number of cycles. In contrast, it is more common to find applications like the one shown in
Figure 5 (Lynn and Fuerst, 1999).
In order to reduce the leakage effect a common practice in digital signal processing
system is to multiply the input signal by a suitable window function before processing
(applying the DFT) (Lyons, 2004). The selection of the window to be applied to the input
signal depends of the application; the following mathematical expressions define the
coefficients of some window functions (Lyons, 2004).
n n
w(n) = , for n = 0, 1, 2, …, N/2 and w( n) = 2 − , for N/2+1, N/2+2,…, N-1
N /2 N /2
⎛ 2πn ⎞
w(n) = 0.5 − 0.5 cos⎜ ⎟ , for n = 0, 1, 2, …, N-1
⎝ N −1 ⎠
⎛ 2πn ⎞
w(n) = 0.54 − 0.46 cos⎜ ⎟ , for n = 0, 1, 2, … N-1
⎝ N −1⎠
Applying window functions to the input, shown in Figure 5, and then applying the DFT, give
the results shown in the following figures. For a better understanding, only the first 32 values
are plotted:
Figure 6: Comparison of the rectangular vs Hanning, Hamming and Triangular windows functions.
As can be seen in the figures above, the effect of applying the window function to the
input signal before processing improve the output and the magnitude of the frequency
components no related with the input are reduced considerably.
The DFT is the mathematical procedure that straightforward gives the frequency
components of a discrete-time input signal. However, its computation is very inefficient,
especially when the input sequence (N) is large. In fact, the complexity of the DFT is related
with the input sequence and it grows as N2.
The FFT is based on the DFT equation which it was described before. For instance, in order
to obtain the frequency components for any digital input sequence composed by N
points, the following DFT equation is applied.
N −1 N −1
X (m) = ∑ x(n)e − j 2πnm / N = ∑ x(n)WNmn , where WN = e − j 2π / N
n =0 n =0
Equation 12: Origin of the FFT
Note that the value WN = e − j 2π / N is calculated several times during the computation of the
DFT as WNnm . It is demonstrated (Lynn and Fuerst, 2004), (Lyons, 2004) that for an input
sequence of N=8 only eight different values of W8nm are calculated. These results can be
seen in the following table.
Value of n
0 1 2 3 4 5 6 7
0 1 1 1 1 1 1 1 1
(1 − j ) − (1 − j ) − (1 − j ) (1 − j)
1 1 2
-j 2
-1 2
j 2
2 1 -j -1 j 1 -j -1 j
− (1 − j ) (1 − j) (1 − j) − (1 − j )
Value 3 1 2
j 2 -1 2 -j 2
of m 4 1 -1 1 -1 1 -1 1 -1
− (1 − j ) (1 − j) (1 − j) − (1 − j )
5 1 2
-j 2 -1 2 j 2
6 1 j -1 -j 1 j -1 -j
(1 − j) − (1 − j ) − (1 − j ) (1 − j)
7 1 2 j 2
-1 2
-j 2
Table 3: Values of W8nm
The reason of this is because the periodicity of the WNnm term ( W Nm is often called twiddle
factor). Consequently, the computation of the DFT is slow and processing expensive.
Indeed, the FFT algorithms take the approach of reducing the number of redundant
computations. Lyons, 2004, shows how the Radix-2 FFT algorithm divide any N=2i sequence
input in two segments, even and odd components, as it is shown in the following equation.
( N / 2 )−1 ( N / 2 )−1
X ( m) = ∑ x(2n)WNnm/ 2 + WNm
n =0
∑ x(2n + 1)W
n =0
nm
N /2
and
( N / 2 )−1 ( N / 2 )−1
X (m + N / 2) = ∑ x(2n)WNnm/ 2 − WNm
n =0
∑ x(2n + 1)W
n =0
nm
N /2
Note that to obtain the second half of the FFT it is not necessary to calculate again those
values. In fact, only changing the sign of the twiddle factor ( WNm ) in the results of X(m) it is
possible to obtain X(m+N/2) values. The implementation of this FFT, for an input sequence
of N=8 values, is shown in Figure 7.
∑ x ( 2 n )W
0
4
nm
∑ x(2n +1)W
0
4
nm
Figure 7: FFT Implementation of an 8-point DFT using two-point DFT. (Lyons, 2004).
The previous results could be simplified in order to obtain four 2-point DFT. Consequently,
Equation 13 can be converted in the following one:
Where
It is possible to say that W N2 /nm2 = W Nnm/ 4 which gives the following result:
( N / 4 )−1 ( N / 4 )−1
A(m) = ∑ x(4n)WNnm/ 4 + WNm/ 2
n =0
∑ x(4n + 2)W
n =0
nm
N /4
Equation 14
Equation 14 is similar to Equation 13 and shows the possibility to reduce the number of
computations in the implementation of DFT. Similarly, it is possible to compute B(m):
( N / 4 )−1 ( N / 4 )−1
B ( m) = ∑ x(4n + 1)W
n =0
nm
N /4 + WNm/ 2 ∑ x(4n + 3)W
n =0
nm
N /4
Equation 15
The results obtained in Equation 14 and Equation 15 show the possibility of reducing the
number of mathematical multiplications in order to obtain an efficient way to calculate
the DFT for any given input sequence. In fact, Figure 8 shows the implementation of the FFT
for an 8-point input sequence. As in can be seen in the figure, the problem has been
simplified into four 2-point DFT computations.
The computation of the basic 2-point DFT is shown in the following figure. The flow signal is
similarly to a butterfly. It is the reason why this computation is also known as FFT butterfly.
x(r)
WN0
x(r+N/2) WNN/2
The definition of the twiddle factor is WNm = e − j 2πm / N which gives the following results for
WN0 = e − j 2π 0 / N = 1 and WNN / 2 = e − j 2πN /( 2 N ) = e − jπ = −1 . These results, give the full 8-point
implementation of the FFT, shown in Figure 10.
A(0)
x(0) X(0)
1 W40 W80
A(1)
x(4) -1 X(1)
W41 W81
A(2)
x(2) W42 X(2)
1 W82
A(3)
x(6) -1 W43 X(3)
W83
B(0)
x(1) W84 X(4)
1 W40
B(1)
x(5) -1 W85 X(5)
W41
B(2)
x(3) W42 W86 X(6)
1
B(3)
x(7) -1 W43 W87 X(7)
Figure 10: Full FFT Implementation for an 8-point input sequence.(Lynn and Fuerst, 2004)
Another important aspect to point out is the fact that the input sequence is bit reversed
before the FFT implementation. It is called bit reversal because the input data index is
obtained by reversing the bits of the binary representation of the normal input data index
order. This is better understood with the following table:
The code, exposed in Annex 1 – FFT Code, shows the implementation of the radix-2 FFT
algorithm. The code executes the bit reversal prior to calculate the FFT.
5 Filtering
Digital Filters can achieve theoretically any filtering effect if a mathematical algorithm can
express this characteristic. However, their main constrain is speed because they cannot
operate any faster that the embedded system that posses them.
Digital Filters can be found in two different forms: Finite Impulse Response (FIR) filters and
Infinite Impulse Response (IIR) filters.
Finite impulse response filters (FIR) are the most popular filters because of the simplicity in
their implementation. Basically, FIR filters use only current and past input samples without
using any previous output samples. This is one of the reasons why FIR filters are commonly
referred as nonrecursive filters.
FIR filter have useful properties that make them suitable for different applications:
The equation difference for the FIR filter is shown Equation 16.
A basic structure of a FIR filter can be seen in Figure 12 where it is possible to observe that
they use addition to calculate their outputs; b0, b1, … bN-1 are called the filter coefficients
and they are calculated as a result of the design of the filter. Additional literature, Lyons,
2004, shows deeply detail regarding to analysis and implementation of FIR filters.
The main difference between Infinite Impulse Response (IIR) filters and FIR filters is that the
former ones require feedback. In fact, each IIR filter output sample depends on previous
input samples and previous filter output samples. In contrast, FIR filter output samples
depend only on past input samples.
The feedback characteristic of IIR filters give to a DSP system a computational reduction in
the processing of signals that the system requires to filter. However, they may become
unstable (oscillating indefinitely) if the feedback coefficients are calculated improperly.
IIR filters structure can be seen in Figure 13. As it can be seen it is more complex that their
counterpart FIR filters because of the feedback loops. Additionally, this generates high
quantization error which they are implemented, in practice, as cascade first and second-
order rather that the straight structure shown here. Another aspect to have into account in
the implementation is that the coefficients should be taken as reals to avoid complex
calculations (Hussain, 2007).
The design of IIR filters is highly dependent in their analog counterparts because of the
great amount of resources available. Consequently, if the design of an IIR needs to be
carried out, first their analog version is designed (Chebyshev, Butterworth, Elliptic filters),
using common methods. Then, this design is converted to digital using either technique
Bilinear Transformation or Impulse Invariance which are commonly called as discretization
techniques.
6 Symbian OS
This section assumes that the reader has a basic knowledge on C++ in order to understand
the terminology used here. Many online resources exist to learn C++ from the basics
(www.cplusplus.com, 2007/08/01).
Symbian OS is a multitasking operating system which includes features like file system, a
graphical user interface framework, multimedia support, a TCP/IP stack and libraries for
different communication features (Babin, 2006).
Symbian OS was designed specifically for mobile devices, for that reason it has small
memory and lower power consumption. Additionally, there is a wide amount of resources
(see www.symbian.com, 2007/08/01) that allow third party entities to produce applications.
Thus, applications developed in Symbian can run in different platforms for years without
restarting the device (Nokia, 2004).
Symbian OS is object oriented which means that all system objects from applications to
interrupt handlers are defined as C++ classes. Additionally, the pre-defined APIs allow the
use of multitasking and efficient memory management (Nokia Forum, 2004).
As it was described before, some of the main key issues in the design of Symbian devices
are the lower power consumption, the limited memory resources and the quality of the
applications in order to avoid restarting the system. Consequently, the hardware designed
for these tasks must meet these constrains.
Inside a Symbian system there are two domains; one is related with the mobile radio
interface, referred commonly as Baseband processor or modem and the other domain is
related with the application processor which runs the user interface and the high-level
code under Symbian. This two domains solution can be seen in the Figure 14.
The two domains system operates independently from each other. The baseband
processor requires hard real-time software, periodic power management and security for
the network. Meanwhile, the application processor is able to operate in two modes; full
power when it is interacting with the user and sleep mode, running the basic software
routines when the system is in idle mode. The application processor code contains the
frameworks and libraries for build-in applications and third-party development (Sales, 2005).
ARM LCD
DSP DMA
CPU controller
System Bus
slow fast
Memory
Controller UART IR I/O USB Audio IPC NAND
The application processor is the core of the Symbian system that is contained in a single
piece of silicon commonly referred as System-on-chip ASICs (Application Specific
Integrated Circuits) or ASSP (Application Specific Semiconductor parts). It has CPU,
memory, display, audio interfaces, input/output interfaces and additional peripherals
according to the particular design. An example of the structure for a System-on-chip can
be seen in Figure 15.
Symbian OS makes use of C++ for system applications. However, the use of C++ in a
Symbian environment differs of its use on other system environments:
¾ C++ has private inheritance, but Symbian OS does not use it.
¾ C++ does not know anything about DLL, but Symbian OS does additionally, Symbian
OS define (explicitly) the number of bits to represent basic types.
¾ Symbian OS is focusing in error handling and cleanup in order to make a better
memory management.
Symbian OS define different classes and each of them has different characteristics. These
characteristics differ in the way how the objects are created (either in the heap or in the
stack) and specifically how they should be cleaned up. These classes have a particular set
of rules which are used to define the creation or destruction of instance of these classes
straightforward.
In order to distinguish the different types, Symbian OS use a simple naming convention
which gives a prefix to the class name (usually T, C, M or R). A design engineer easily can
determine the behaviour of the parent according to the basic types contained on it.
Consequently, there is no need to concern about cleaning and creation issues instead
there will be more space to give particular attention to the important factor, the role of the
class.
The initial character of the class indicates the basic properties of it. The following are the
main classes defined by Symbian OS.
6.2.2.1.1 T Classes
They behave in the same way as the build-in classes in C++, hence they are prefixed with
the same letter, “T”, which means type. They do not have destructor. Consequently, T
classes should not contain any member class that has a destructor.
6.2.2.1.2 C Classes
C classes are named with the prefix “C” which means that they are derived from the
CBase class (which is defined in e32base.h). They have two main characteristics:
First, CBase class has a virtual destructor which means that CBase derived classes may be
destroyed properly by simple deletion of the CBase pointer. Second, CBase oveloads the
zero operator which means that any instance of the derived CBase classes are initialized to
zero. The great advantage of this is that developer engineer does not have to initialize
manually the elements in the constructor.
6.2.2.1.3 R Classes
R Classes indicate the use of a resource; hence, “R” should be added as a prefix in the
name of the class. R classes are related with any class that owns a resource other than on
the default heap. R Classes use Close() or Reset() method to free the object.
6.2.2.1.4 M Classes
M Classes refer to those ones with pure virtual functions and with no member data. They
are the only one which use multiple inheritance and they are referred as ‘mixins’ hence
the use of “M”.
There is no more naming conventions in relation with the naming of classes. Symbian OS
has left some space to the creation of classes with no prefix letter; they are the static
member functions which cannot be instantiated.
6.2.2.1.6 Structs
The best way to understand the application structure inside a Symbian device is to observe
the UML class diagram in Figure 16 (forum.nokia.com 2007/08/01).
¾ Application Class
¾ Document Object
¾ AppUi
¾ View Control
The Application class is initiated as startup object and it defines the properties of the
application. Additionally, it creates a new blank document. This class inherits its properties
from the CEikApplication class defined in the application framework.
The document object is used to store the application’s persistent data. If the application is
file bases, this object is responsible for storing and retrieving application’s data. It is
compulsory from the system point of view to have an instance of the Document Class
(inherited from CEikDocument) even if the application does not handle persistent data.
6.3.3 AppUi
The AppUi is responsible for handling application events such as Options menu commands,
opening/closing files and the application losing focus. Additionally it creates an instance of
the view control which it posses. Its base class is CEikAppUi.
The view control is responsible for the interaction with the user because it displays data on
the screen in such a way that the user can operate. In Nokia devices, the term container is
used instead of view, but the functionality is the same. A view control is derived either from
CCoeControl or CEikDialog.
6.3.5 Model/Engine
The model engine is used to encapsulate the application functionality; it handle data,
persistence and algorithms.
This section shows the results obtained in the development of the application result of this
project. The name of the application was “originally named” DSP.
Figure 17: Application Running in Nokia Device used in the DSP application. Photo from the target device
The project was developed in a Nokia 7710 device that uses Symbian OS version 7.0 which
has the following specifications.
Characteristic Description
Series Series 90 1.1
Symbian OS 7.0s
Memory 90 Mb
Processor 32-bit RISC CPU based on ARM-9 series, ~150 Mhz
Battery Lithium Polymer, 1300 mAh
Network GSM 900/1800/1900
Datasupport (E)GPRS, HSCSD
Dimentions 128 x 69.5 x 19 mm, 142.5 cc,
Weight 189 g
Flashcards MMC
Screen 16 bit, 640 x 320 pixels
IR/bluetooth no/yes
Camera 0,99 Mp
Music support Stereo
Radio Yes
Voice support yes
Loudspeaker Yes
Table 6: Technical Specification of the Nokia 7710
The development system used in this project was Microsoft Visual C++ .NET version 2003 as
Nokia suggested it in the widely documentation offered for application development.
7.2.2 Nokia 7710 SDK for Symbian OS for C++ Supporting Microsoft Visual Studio .NET 2003
C++ and Borland C++BuilderX Mobile Edition
The software development kit used for the application is the Nokia 7710 which provides the
needed tools, application program interfaces (API), sample code, and documentation
used to develop C++ applications.
The SDK comes with an emulator which is used to test the applications prior to embedded
in the target device.
7.2.3 Emulator
An important tool in the development process is the emulator (EPOC) which is part of the
SDK supplied by Nokia. The emulator allows test the application in the development
process reducing the time to market in real world applications. However, it is the target
device which determines the real behaviour of the application.
In order to compile and install the application in the target device it is necessary to install
the version 5.6 of Active Perl.
The results of this development are shown in the UML diagram model which can be seen in
Annex 3 – Application UML Model and Annex 4 – Model/Engine UML Model. It is possible to
note that the structure of the DSP application follows the implementation rules established
by Symbian OS as it was point out in section 6.3 (Symbian Software Structure in Nokia
Devices). In fact, DSP Application contains the main classes; CTest2App, CTest2Document,
CTest2AppUi and CTest2Container. Additionally, it is observable that CTest2App inherits
from CEikApplication, CTest2Document inherits from CEikDocument and CTest2AppUi
inherits from CEikAppUi. Additionally, the model/engine class is represented by several
subclasses each one executing one role in the whole system.
The UseCase and the flow diagram of the application can be seen in Annex 5 – DSP
Application Use Case and Annex 2 – DSP Application Flow Diagram.
The several subclasses that compound the model/engine are enumerated as follows:
¾ CWavCreator
¾ CRecordTimed
¾ CWavReader
¾ CDSPProcessor
¾ TMatrix
¾ CWavWriter
¾ CSettingsDialog
¾ CSendAppUi
These classes are the heart of this project because they execute the main functions inside
the application:
7.3.1 CWavCreator
7.3.2 CRecordTimer
This is a Symbian C class derived from CActive which create thread to record a wav file
from the audio input, either embedded microphone or external handsfree device. It uses
CMdaAudioRecorderUtility to create the wav file.
7.3.3 CWavReader
This class is in charge to read the wav stored in the memory of the device and extract the
information related to it, like Frequency Sampling, Fs; Number of bits per samples, BPS; and
the length of data N.
7.3.4 CDSPProcessor
This class is one of the most important classes of the whole development. It is derived from
CBase and it is in charge of the calculation of the FFT and inverse FFT. Additionally, it filters
the signal according to the settings defined by the user. The filter used in this application is
a spectral filter, hence the system has access to spectral content of the signal.
The FFT algorithm used is a 2-radix FFT as it is shown in Annex 1 – FFT Code.
7.3.5 TMatrix
TMatrix is a T class which contains the information of the data being processed. It has
methods to write itself in a text file. The data contained in this class is complex. Additionally,
it has the CPlot methods that allow it to be plotted in the screen.
7.3.6 CWavWriter
This class creates a wav file as a final outcome of the processing of the data. The
information is taken from the TMatrix instance which is used as an input parameter for the
creator method.
7.3.7 CSettingsDialog
CSettingsDialog is a class derived from CEikDialog and it is used to allow the user to set up
the parameter of the application. These parameters are:
7.3.8 CSendAppUi
This is a API supplied by Nokia as part of their SDK and this class is used to execute
operations of sending messages through either Email, MMS and Bluetooth.
Annex 8 – Screen shots of DSP Application shows different screen shots taken from
emulator and from the nokia device. In order to start using DSP application, the user needs
select the DSP icon which appears in the desktop as it can be seen in Figure 21.
The code application can be obtained under the following links (wcastillo@isa.com.co,
s3143667@student.rmit.edu.au ).
Figure 21: Desktop Icon of DSP Application. (Photo from the target device)
8 Conclusions
The development of the present project clearly gave evidence that theory can be
followed in the practice in relation with the DSP processing techniques. In fact, the DSP
algorithms designed in theory for this project were implemented by softwares routines that
worked all of the time.
The development process of the Symbian C++ application took many working days
because of the set of rules that must be followed to develop for Symbian devices.
However, once, as developer engineer, I was used to them and obtained familiarity to the
development tools, this process was more enjoyable focusing in the main role of the
application.
The complexity of the DFT led to the development of algorithms in order to improve
efficiency in the calculations. It is widely demonstrated that the complexity of the
calculation of the DFT is reduced because of the cyclic redundancies in the twiddle factor
( WNm ).
One of the important key points in the FFT algorithm implemented is that the properties
and characteristics of the DFT apply straight forward to the FFT.
The outcome of the DSP project could be used as a starting point for another project
initiative that will have to process the signal obtained. Because the main job in process the
signal is already done, hence other future developments do not have to start from scratch.
9 References
Babin S., 2006, Developing Software for Symbian OS, An Introduction to Creating
Smartphone Applications in C++, Jhon Wiley & Sons, Ltd, West Sussex, England
Cooley J. W., Tukey J. W., 1965, An algorithm for the machine computation of complex
Fourier series. Mathematical computations, 19:297-301, April 1965.
‘cplusplus.com – The C++ Resources Network’, www.cplusplus.com, 2007/08/01.
Cristi R., 2004, Modern Digital Signal Processing, Thomson Learning, Pacific Grove, USA.
‘Designing C++ Applications For the Nokia 7710 device’, 2004, www.forum.nokia.com.
Harrison, R., 2004, Symbian OS C++ for Mobile Phones, John Wiley & Sons, Ltd, West Sussex,
England.
Hussain Z. M., 2007, Digital Signal Processing, Lecture Notes EEET2113, EEET1469, EEET1416,
EEET1123, RMIT University, School of Electrical and Computer Engineering, Melbourne,
Australia.
Ingle V.K., Proakis J. G., Digital Signal Processing Using Matlab, Second Edition, Thomson,
Toronto, Canada
Jones, D. L., 2006, Decimation in Time (DIT) Radix-2 FFT,
www.cnx.rice.edu/content/m12016/latest/
Lai, E., 2004, Practical Digital Signal Processing for Engineers and Technicians, Elsevier,
Burlington, USA.
Linn, P., Fuerst, W., 1999 Introductory Digital Signal Processing with Computer Applications,
Second Edition, John Wiley, New York, USA
Lockhart G. B., Cheetham B. M. G. 1989, Basic Digital Signal Processing, Butterworths,
Norwich, England.
Lyons, R. G., 2004, Understanding Digital Signal Processing, Second Edition, Prentice Hall,
New Jersey, USA.
‘Nokia 7710: Getting Started with C++ Application Development’, 2006
http://www.forum.nokia.com/main/resources/technologies/symbian/index.html, Nokia
Forum, 2007/08/01.
McClellan J. H., Schafer R. W., Yoder M. A., 2003, Signal Processing First, Prentice Hall, New
Jersey, USA.
Sales, J., 2005, Symbian OS Internals, Real-time kernel programming , John Wiley & Sons, Ltd.
West Sussex, England.
Symbian, Symbian Developer Network, http://www.symbian.com/developer/index.html,
2007/08/01.
The following code calculates the FFT for any input sequence with N values where n is a
power of 2i.(Jones, 1992, http://creativecommons.org/licenses/by/1.0).
[Start App
(DSP)]
Mobile DSP Processing
Using Symbian C++ on
Embedded Systems
Initial Conditions
[User Selection]
[OK Cancel]
New *wav File Filtering
[Output] [Filter] [Duration]
[File Created] [Data Filtered]
[User Selects
New File or
File Output Filtering Duration Change Settings]
Select Process Create FFT File
[FFT Calculated]
Open *.wav File Calculate Inverse FFT
[Data Plotted]
[Transmitted] [Transmitted]
[Exit]
CTest2Container
-iListBox : CEikTextListBox *
-iMessageList : CDesCArrayFlat *
-iMsgIndex : TInt
-iOutputText : HBufC16 *
-iAppUi : CTest2AppUi *
+NewL(inout aRect : const TRect, in aAppUi : CTest2AppUi*) : CTest2Container *
+NewLC(inout aRect : const TRect, in aAppUi : CTest2AppUi*) : CTest2Container *
+~CTest2Container()
+PrintLineL(inout aText : const TDesC)
+OfferKeyEventL(inout aKeyEvent : const TKeyEvent, in aType : TEventCode) : TKeyResponse
+Draw(inout aRect : const TRect)
+CountComponentControls() : TInt
+ComponentControl(in aIndex : TInt) : CCoeControl *
-ConstructL(inout aRect : const TRect)
-CTest2Container(in aAppUi : CTest2AppUi*)
-SizeChanged()
DSP Application
«uses» GetFs
«uses» «uses»
CaptureInformation ReadWavFile
GetBPS
«uses» «uses»
«uses»
Sensor
«uses» GetN
WriteWavFile
ProcessSignal «uses»
NewFile
«extends»
GetFFT
«uses»
«extends»
WriteFFTFile
«uses»
«uses»
Start FilterSignal
WriteDataFile
«extends» GetInverseFFT
SendInformation PlotSignal
User
TransmitSignal
Figure 26: ECG Circuit Used for testing. Device supplied by RMIT
Figure 27: ECG Circuit Supplied by RMIT. Its circuit drawing can be seen inFigure 26.
Figure 33: Signal Processed using ECG input. (Photo from the target device)
Figure 36: Selection to other device to transmit the signal using Bluetooth. (Photo from the target device)