May
2006, Issue 190
ARM-Based
Modern Answering Machine
Philips
ARM Design Contest 2005 First Prize
VISUAL
SIMULATION
One
of my goals for this project was to experiment with
the implementation of DSP features in a generic RISC
processor. The starting point is a sample interrupt,
which is actually a timer interrupt in this case. If
higher accuracy and low jitter are required, the interrupt
should actually come from the ADC, and the ADC value
should be buffered until it’s read by the interrupt
routine. But this feature isn’t available on the LPC2138.
The same timer interrupt is also used to output samples
for voice playback and tone generation.
The
DSP functions are often tricky and difficult to debug.
Professionals use tools like MATLAB to develop and tune
their algorithms. Amateurs generally don’t have access
to such simulation tools. I tried a few different options.
One
problem with demodulation is that you might be trying
to catch a signal that shows itself and disappears quickly.
On the other hand, a simulator allows you to generate
millions of these furtive signals and verify that the
algorithm works well in the presence of noise or any
other hindrance. I developed and debugged the DTMF demodulator
using an old version of Microsoft Visual C/C++. Although
I couldn’t use that version to develop modern applications
to run on Windows XP, it was an excellent tool for developing
generic C code. It also has a step function that can
be used to track down nasty bugs. This was a nice feature
because I didn’t have a step function on my LPC2138
platform.
To
debug the DTMF detector, I generated some DTMF samples
and then sent them to my demodulation routine. Until
I got the routine to correctly extract the right DTMF
tones, I invested my time on the Windows platform rather
than the ARM-based platform. After the DTMF detector
was debugged in Windows, it worked the first time it
was ported to the LPC2138! You may download the Visual
C/C++ source code from the Circuit Cellar FTP
site.
Because
generic RISC processors like the LPC2138 don’t have
a saturation function, it’s also important to ensure
that the input values or the size of the variable are
correctly scaled to prevent saturation. Refer to the
“DP Versus RISC” sidebar for
more information on the subject.
I
started developing and debugging the FSK demodulator
in an Excel spreadsheet. Excel isn’t necessarily a perfect
DSP development tool, but it has a complete set of arithmetic
functions and graphics tools.