Open Journal of Applied Sciences, 2012, 2, 272-276
doi:10.4236/ojapps.2012.24040 Published Online December 2012 (http://www.SciRP.org/journal/ojapps)
Development of a Double-Channel Medical Signal
Generator Based on STM32 with High Performance
Longcong Chen1, Gaiqin Liu2, Bin Gao1, Ping Chen1, Xingliang Xiong1*
1Laboratory of Forensic Medicine and Biomedical Information, Chongqing Medical University, Chongqing, China
2School of Optoelectronic Information, Chongqing University of Technology, Chongqing, China
Email: *xxlsober@sina.com
Received September 25, 2012; revised October 26, 2012; accepted November 10, 2012
ABSTRACT
An open-ended and multifunctional double-channel signal generator, which based on a 32 bits monolithic integrated
microcomputer, highly integrated device and LCD, is introduced in this paper. The instrument is composed of micro-
computer STM32F103RD and some integrated chips (IC), which includes programmable waveform generators-
AD9833 with highly frequency and phase precision. As a result, this signal generator may output not only double chan-
nels accurate sine, square or triangle waveforms with digital-controlled frequency and phase at the same time, but also
many kinds of physiological signals that can be modified by USB connection with well open property. Therefore, it is
convenient to measure and teach about hearing, research and study on frequency characteristic of human ear and im-
pedance characteristic of human body in medical science. In addition, it is also very easy in experiment and research of
college and medical physics for using double channels sine signal to show synthesis of two simple harmonic vibrations
under different frequency, phase difference and direction, such as beat pattern and Lissajous figures. Thus it has many
merits, such as the small volume, stable property, simple operation, visual display and so on. Consequently, it can be
widely used in researching, teaching, debugging and maintaining.
Keywords: STM32F103RD; Digital-Controlled; AD9833; Signal Generator
1. Introduction
In many research, experiment, maintenance or debugging
of medical equipment and other equipment, classic or
abnormal physiologic signals, such as ECG, EEG, pulse
wave and respiratory wave signal, are often need to be
input. Besides, for studying and teaching of the human
ear frequency, human impedance characteristics and bio-
sensor, sine signal with high precision in frequency, pu-
rity and ability to drive heavy load, are also required. In
physics experiment and other related teaching of univer-
sities and colleges, to show synthesis of two simple har-
monic vibration under different frequency, phase diffe-
rence and directions, such as beat pattern and Lissajous
chart, two sine signals with controllable frequency and
difference of phase are demanded, and this contributes to
students, especially to medical students, for understand-
ing frequency spectrum, which is very important for sig-
nal analysis. At present many medical signal generator or
signal producing instruments can not meet the demands
[1,2]. Although, many medical signal generators may
output common physiological signals, the waveform sig-
nal generally is fixed, and commonly used signals, such
as sine, triangle and square-wave, are not offered. On the
contrary, some signal generators, which may output com-
monly signals, dose not supply physiological signals.
Based on above, authors developed an open-ended and
double-channel signal generator with USB interface and
high performance, which overcome the shortages and can
be widely used in scientific researching, experiment teach-
ing and medical instrument debugging and maintaining.
2. Instrument Struction
Design of the instrument includes two sides, hardware
and software. Hardware is divided into eleven units: mi-
crocontroller, double-channel signal generator, memory,
double-channel filter, and signal selector, gain regulator,
amplitude detector, power amplifier, keyboard, LCD mo-
nitor and power source unites. The instrument block dia-
gram is shown in Figure 1.
This instrument mainly based on microcontroller and
high-performance integrated chips, such as STM32-
F103RD, AD9833, K9W5608U1M, which not only can
increase its intelligence, precision, stability, but also re-
duce its power consumption and volume. The method for
this generator includes the following sides: on the one
hand, STM32F103RD, which has double on-chip DAC
*Corresponding author.
Copyright © 2012 SciRes. OJAppS
L. C. CHEN ET AL. 273
Figure 1. Block diagram of the instrument.
with 12 bit resolutions and may get data of signals from
external memory K9W5608U1M, can output physiologic
and special signals. Then, they are input to signal selector
after double-channel filters. Finally, we can obtain dou-
ble-channel physiologic and special signals that may be
modified, deleted and appended by USART or USB. On
the other hand, controlled by microcontroller, two pieces
AD9833, programmable waveform generators, may pro-
duce double-channel general signals, which are sine, tri-
angle and square-wave ones. And, they are also input to
signal selector, which choices two channel signals from
four ones to input gain regulator and power amplifiers in
sequence. As a result, the two channel signals which
meet user’s demand are generated. Microcontroller,
STM32F103RD, output all kinds of commands and data
signal to control relative chips for generating needed
signals. The gain regulator unit for adjusting amplitude
of signals, power amplifier unit for enhancing ability of
driving load, amplitude detector unit for measuring am-
plitude of real-time output signals, keyboard unit for
user’s imputing command, LCD monitor unit for display
all kinds of information with FM19264, and power
source unit for providing other parts with power to work
are designed in this instrument. Hardware of eleven parts
effectively ensures to realize the function of outputting
double-channel medical and general signals.
The software of this instrument was designed by Kiel
uVision3 for STM32F103RD.
The following below, we mainly describe six units of
hardware and software of this instrument in detail.
2.1. The Primary Hardware
The important and vital units for this instrument are mi-
crocontroller unit, double-channel signal generator unit,
memory unit, double-channel filter unit, signal selector
unit and power amplifier unit. Therefore, we only de-
scribe those six units in details.
1) Microcontroller unit
The microcontroller is composed of microprocessor
STM32F103RD [3] and its peripheral components. It is a
single-chip microcontroller that bases on a high-per-
formance ARM 32-bit Cortex™-M3 CPU and can work
in 72 MHz maximum frequency, has USB 2.0 full speed
and five USARTs interface, and has 12-channel DMA
controller, 3 × 12-bit and 1 μs A/D converters, 2 × 12-bit
D/A converters with 384 K bytes Flash program memory,
64 K bytes SRAM memory, a Watchdog Timer. Fur-
thermore, all sorts of physiologic and special signals are
generated by using the two 12-bit DACs integrated in
STM32F103RD and two 12-bit on-chip ADCs are used
to measure amplitude of outputting signals. In a word,
STM32F103RD play a major role and controls other
parts to realize data exchange and corresponding function
in this instrument.
2) Double-channel signal generator unit
The basic goal of this unit is to produce double-chan-
nel three type general signals with digital-controlled fre-
quency and phase difference. And this function is very
easy to show synthesis of two simple harmonic vibra-
tions under different frequency, phase difference and
direction, such as beat pattern and Lissajous chart. In this
unit, two pieces of AD9833, a programmable waveform
generator, are selected to generate single frequency sine
signal for measuring human impedance characteristics
and other functions. The AD9833 [4-6], whose function
block diagram is shown in Figure 2, is a low power,
programmable waveform generator capable of producing
sine, triangular, and square wave outputs. The frequency,
phase and waveform of outputting signal are software
programmable, allowing easy tuning and no external
components are needed.
The frequency registers are 28 bits wide. As a result,
the output signal frequency is
28
outputMCLK 2
f
fK
(1)
Copyright © 2012 SciRes. OJAppS
L. C. CHEN ET AL.
274
Figure 2. Function block diagram of AD9833.
where is the value loaded into the selected frequency
register, means input clock rate.
KfMCLK
Therefore, with a 12 MHz clock rate, the AD9833 can
be tuned to about 0.045 Hz resolution, and we can obtain
single frequency signal with enough high precision of
frequency.
The phase registers are 12 bits wide. Consequently, the
phase difference of two output signals is

output1 2
2π4096PPP  (2)
where 1 is the value loaded into the selected phase
register of one chip AD9833 and 1 is the other one,
output
PP
K
P means user needed phase difference of two
output signals.
Certainly, after STM32F103RD sends corresponding
data to selected frequency and phase registers for two
pieces of AD9833 at same time, we can get the needed
signals with frequency, phase or phase difference and type.
3) Memory unit
The primary aim of this unit is to save vast data of
physiologic and special signals. For this reason,
K9W5608U1M, flash memory, offered in 32Mx8bit with
spare 8 M bit capacity. Its NAND cell provides the most
cost-effective solution for the solid state mass storage
market. A program operation can be performed in typical
200 ms on the 528-byte page and an erase operation can
be performed in typical 2 ms on a 16 K-byte block. Data
in the page can be read out at 50 ns cycle time per word.
The I/O pins serve as the ports for address and data in-
put/output as well as command input. The on-chip write
control automates all program and erase functions in-
cluding pulse repetition, where required, and internal
verification and margining of data. Even the write-inten-
sive systems can take advantage of the its extended reli-
ability of 100 K program/erase cycles by providing ECC
(Error Correcting Code) with real time mapping-out al-
gorithm.
If every physiologic or special signal has 2 K bytes
data for DAC producing relevant signal, K9W5608U1M
has enough capacity to save 16,000 signals, which are
sufficient for us.
4) Double-channel filter unit
Filtering undesired and smooth signal for DAC output
is the fundamental target of this unit, which mainly in-
cludes one piece of ADG1439 and LT1362. ADG1439 is
a CMOS dual 4-channel matrix analog switch with a se-
rially controlled 3-wire interface and each switch is
turned on or off by a separate bit, these parts can also be
configured as a type of switch array, where any, all, or
none of the four switches can be closed at any time.
Hence, Controlled by microcontroller, ADG1439 can
select 16 kinds of different resistance for RC low pass
filter. We can change upper cut-off frequency through
STM32F103RD for all kinds of different frequency phy-
siologic and special signals. LT1362 acts as amplifier
and constitutes active filter with ADG1439, and is quad
low power high-speed operational amplifiers with out-
standing AC and DC performance, and has high slew rate
with 1 mV maximum input offset voltage and 1 μA max-
imum input bias current. Consequently, this double-
channel filter has high performance and may be changed
upper cut-off frequency by matrix analog switch.
5) Signal selector unit
The signal selector unit, which is compose of ADG1439,
Copyright © 2012 SciRes. OJAppS
L. C. CHEN ET AL. 275
is designed to choice two channel signals from four ones
to input gain regulator and power amplifier in sequence.
As a result, the two channel signals which meet user’s
demand are generated. ADG1439 is a dual 4-channel
matrix analog switch and each switch is turned on or off
by a separate bit. For this reason, it is very easy to realize
that each output channel signal can be choice from the
input four channel ones.
6) Power amplifier unit
The essential aim of this unit is to enhance this in-
strument’s ability of driving load. This power amplifier
unit includes THS6042, which is a high-speed line driver
ideal for driving signals. THS6042 can output double-
channel high current whose typical maximum is 350 mA
with thermal shutdown and short-circuit protection. This
performance meets the demanding needs that acts as
power amplifier of this instrument.
2.2. Design of Software
To realize the function, the software of this instrument
must be designed, and we completed it by Kiel uVision3
for STM32F103RD with C language. The software,
whose control flow is shown in Figure 3, is primarily
composed of one main program and eight subprograms,
which are memory control, AD9833 control, DAC con-
trol, signal selection and gain regulation control, ADC
control, filter control, display and read key subprograms.
Main program mainly calls read key subprogram to ob-
tain the user input information and calls the correspond-
ing subroutine to display frequency, amplitude and to
choose right signals and channels output. Read key sub-
program mainly gets the input keys’ value and informs
the main program. Display subprogram Controls LCD,
FM19264, to display relevant information, such as fre-
quency, amplitude, waveform type and so on. AD9833
control subroutine controls AD9833 to generate corre-
sponding frequency, phase and type signal or disable it.
DAC control one is to produce right physiologic and
special signals. Memory control subprogram completes
to read data from and write data to K9W5608U1M for
DAC. At the same time, filter control one controls filter
to realize filter interference signal. Signal selection and
regulation control subprogram control signal selector and
gain regulator unit to output user’s needed double-chan-
nel signals. ADC control subprogram realizes to meas-
ureing amplitude of output signals. Interface control sub-
program aims to communicate with external device and
output or input data. Finally, through all subprograms,
we can get our needed signals.
2.3. Operation Mode
This instrument has two operation modes. One is signal
extraction mode for physiologic or special signals. The
other is signal output mode. In each work mode, graphics
dot matrix LCD shows corresponding signal waveform
and related important information for information ex-
change with user. Two working modes can be directly
switched through the key “Operation Mode Choice”.
Figure 3. Software control flow.
Copyright © 2012 SciRes. OJAppS
L. C. CHEN ET AL.
276
(a)
(b)
(c)
(d)
Figure 4. Examples for application of this generator: (a) Shows two physiological signals; (b) Shows one physiological and one
triangular signals; (c) Shows synthesis of two simple harmonic vibrations with frequency ratio 3:1 and the same phase along
perpendicular direction; (d) Shows synthesis of two simple harmonic vibrations with frequency ratio 3:1 and phase difference
π/2 along perpendicular direction.
Under first mode, user can send data of physiologic or
special signal to STM32F103RD by USART or USB
interface, and microcontroller saves corresponding data
to flash memory K9W5608U1M. Of course, how to get
the data about our needed physiologic or special signals
is of great concern. However, it is very easy to gain the
data by using software author designed [7], which can
change the waveform figure to corresponding signal data.
Therefore, under this mode, we can get all kinds of phy-
siologic or special signals.
For second mode, needed double-channel signals, such
as ECG signal, physiological and special signals, user’s
own defined signal or commonly used square, sine, and
triangular signals, may be generated. Under this mode,
we can gain signals that meet our needs by input relevant
information to this instrument.
3. Discussions and Conclusions
This instrument adopts single-chip control and high-
performance signal waveform generators and 32-bit Cor-
tex™-M3 CPU. As a result, it can output double-channel
signals and applies LCD to display all kinds of informa-
tion. At same time, this instrument equipped with two
kinds of signal sources. One comes from double-channel
generator unit and other from double-channel filter unit.
In addition, all kinds of control and choices are applica-
tion of electronic switch without mechanical contact, by
using in practical, it not only is convenient to be operated,
but also has performance extremely high working stabi-
lity and reliability.
Using this instrument, many kinds of physiological
signals can be modified by USART and USB interface
that has well open property. Therefore, it is convenient to
append, delete and modify physiological and special sig-
nals. For example, physiological and triangular signals,
which generated by the instrument, are shown in Figures
4(a) and (b).
In addition, this instrument can be used as high-preci-
sion frequency and high drive sinusoidal signal source
for research and teaching in testing human impedance
haracteristics. And using this instrument, it is easy to
show synthesis of two simple harmonic vibrations under
different frequency, phase difference and direction, such
as beat pattern and Lissajous chart. For testing its sound-
ness, we show synthesis of two simple harmonic vibra-
tions under different frequency and same phase along
perpendicular direction as Figure 4(c) and at the same
time, show synthesis of two simple harmonic vibrations
under different frequency and phase difference π/2 along
perpendicular direction as Figure 4(d).
c
Therefore, with full confidence, we could draw a con-
clusion that this generator is very convenient to get
needed all kinds of physiological signals and common
signals. In general, this generator has many merits, such
as the small volume, stable property, simple operation,
visual display. And, it can be widely used in researching,
teaching, debugging and maintaining in medical field and
other fields.
REFERENCES
[1] E. Z. Gong and P. Gan, “Mmedical Physics,” 2nd Edition,
Science Press, Beijing, 2004.
[2] D. W. Kim, H. S. Kim, D. H. Lee, et al., “Importance of
Skin Resistance in the Reverse Iontophresis—Based Non-
Invasive Glucose Monitoring System,” Proceedings of
the 26th Annual International Conference of the IEEE
Engineering in Medicine and Biology Society, San Fran-
cisco, 1-5 September 2004, pp. 2434-2437.
[3] http://wvshare.com/datasheet/ST_PDF/STM32F103xC-x
D-xE.PDF
[4] http://www.analog.com/static/imported-files/data_sheets/
AD9833.pdf
[5] G. L. Liu, L. Q. Liao and J. P. Shi, “Programmable Wave-
form Generator AD9833 and Its Application,” Interna-
tional Ele ctron ic Elem ents, Vol. 14, No. 6, 2006, pp. 44-47.
[6] M. C. Lu, J. R. Sun and J. C. Wu, “Application and De-
sign of Signal Generator Based on DDS Chip,” Journal of
Tianjin Normal University (Natural Science Edition), Vol.
28, No. 4, 2008, pp. 66-68.
[7] L. C. Chen, G. Q. Liu and Y. T. Liu, “Design and Appli-
cation of System for Generating Physiological Signal
Data,” Chinese Journal of Medical Physics, Vol. 24, No.
2, 2007, pp. 143-146.
Copyright © 2012 SciRes. OJAppS