Sie sind auf Seite 1von 5

1

A Survey of Techniques to Add Audio Module to Embedded Systems


Xiaohe Wu, Morrison Obeng, Jing Wang and Daniel Kulas, Student Memter, IEEE

Bethune-Cookman University, Daytona Beach, FL 32114 USA

In many embedded application systems, it is desirable to incorporate an audio module/functionality to the system such that the
system can utter meaningful audio messages in a controlled manner. An audio system in the embedded setting may consist of memory
module, Compression/Decompression (CODEC) module, Digital-to-Analog Converter (DAC) module, filter module, power amplifier
module; and also (if the function of voice recording is needed) the signal conditioning module, Automatic Gain Control (AGC), and
Analog-to-Digital Conversion (ADC) module. Depending on the different demands of various application scenarios, different
techniques can be used to implement the audio module. If no audio signal processing is required, the approach of using a dedicated,
off-the-shelf, voice chip is preferable. In other cases, individual circuits would have to be built for some or all of the peripheral modules
required in an audio system. The major advantage of this approach is increased level of flexibility; while the immediate disadvantage is
rising development cost and a higher level of system complexity. In this paper, we first outline the general operation principle of a
typical audio system module; then, a sample implementation that uses a dedicated voice chip is introduced and explained in great
detail so that it can be used by students and application engineers as a functional reference design.

Index Terms—Embedded system, audio module, stand-alone voice chip, programmable system on chip, I2C.

of communication link between the two.


I. INTRODUCTION In this paper, we first outline the general principle of an
An embedded system is a special purpose computer system audio module in an embedded system; then, we report an
designed to perform some specific tasks. In many embedded audio module implementation that uses a dedicated voice chip
application systems, it is desirable to incorporate an audio which is controlled by a MCU via I2C communication
module to record and/or playback audio messages. Such channel. The design and operation principles of the
applications can be found in communication devices implementation are explained in detail so that it can serve as a
(cellphone, walky-talky, two-way radio, etc.), electronic reference design for students and application engineers.
gadgets (MP3 player, voice recorder, GPS with voice
navigation, etc.), robotic applications (talking robots, etc.), and II. OPERATION PRINCIPLE
so on.
A. General Principle
At the heart of an embedded system is a Central Processing
Unit (CPU). Other peripheral modules such as memory, ADC,
DAC, timers, counters, signal conditioning, signal processing, Record
communication, interfacing, etc., are built around the CPU to
construct a functional system. Nowadays, especially at the
chip-level, it is not common to find a chip, off-the-shelf, that
just has a CPU in it; instead, the common practice is to MIC Signal ADC CODEC Memory
Condi
incorporate some popular peripheral modules, such as ADC,
DAC, Timers, Counters, Operational Amplifier (OPAMP),
Clocks, Communication, etc., in the same chip to form a DAC
device called Microcontroller Unit (MCU). Therefore, the MCU
majority of embedded systems found today are built around a
MCU.
An audio module consists of quite a few sub-modules. Such Signal
sub-modules may include Memory Module, CODEC Module,
Condi Playback
DAC Module, Signal Conditioning Module, and ADC
Module. For more complicated system, for example systems
with voice recognition feature, a Signal Processing Module Speaker
might also be needed.
Since inside a MCU there already are some peripheral
Figure 1. Operation Principle of Audio Module
modules built-in, it is a lot simpler to just use the modules
inside (if those modules meet the design specifications) and
The block diagram of a typical Audio Module is shown in
build modules that are not readily available. For applications
Figure 1. Two operation modes are depicted: record mode,
where no further signal processing is required, it is also
playback mode. The operation of the audio module is
possible to use an off-the-shelf voice chip to handle all the
explained by breaking the system into these two modes.
required functions (record, store, playback) of an audio system
and use a MCU to dictate what need to be done via some kind
1) Record mode

978-1-4673-1375-9/12/$31.00 ©2012 IEEE


2

In the record mode, voice signal is captured, digitized, voice chip


coded (if needed), and then stored in the memory module.
Microphone is usually used to convert air pressure variation
caused by the voice source into an electrical signal. This signal III. SAMPLE IMPLEMENTATION
is sent to the Signal Conditioning module where it is filtered In this section, a sample implementation that uses a
and amplified to an appropriated level. The conditioned signal dedicated voice chip is presented. First, the voice chip and the
is then sent to the ADC module to be digitized. Out from the MCU used are introduced; then, the circuit diagram is
ADC module, the signal is in the digital domain thereafter. It provided; finally, program flow block diagram is given.
is in the digital domain where the signal can be coded to
minimize the storage space required. It is worthwhile to note A. Voice Chip
that this coding process is optional in the audio system design.
In many applications where it is desirable to have a less
complicated and fast response system, it is common to bypass
this coding and later on the decoding stage.
Finally, the data is dumped in the memory module from
where the data can be retrieved for playback or further
processing by the application program.

2) Playback Mode
In the Playback Mode, data is retrieved from the Memory
module, sent to the optional CODEC module to be decoded if
the data were coded; and then, passed to the DAC module
where the data are converted back to their analog form. The
analog data is then sent to a Signal Conditioning module Figure 3. ISD5116 Block Diagram
where it is amplified, filtered, and sent out to a speaker.
There are quite a few off-the-shelf voice chips available on
B. Implementation the market right now. The one that is used in this paper is
ISD5116 from Winbond Electronics Corporation. The block
For an audio system to be functional, all the modules shown
diagram for ISD5116 is shown in Figure 3 [1]. ISD5116 is a
in Figure 1, except for the optional ones, need to be
general purpose voice chip. It can be configured to perform
implemented. A common practice is to use a MCU as the core
various voice related functionalities. For example, it can be
of the system, and take advantage of the built-in modules in
configured to record and playback audio messages; it can be
the MCU to the fullest to implement other modules. One
used in communication devices, such as phones, to record and
possibility, as shown in Figure 1, is to make use of the
playback phone calls and/or memos, to manage and cueing
Memory module, ADC module, DAC module, and
messages, or just work in the feed through mode to channel
(optionally) CODEC module (either in hardware or software
signal to different outputs.
form of existence) inside a MCU chip; and use some external
components and circuitry to build other modules. The
1) What is inside ISD5116
advantage of this approach is increased level of flexibility. To
ISD5116 by itself is a complex integrated circuit chip. It
be specific, once the data is stored in memory, it can be easily
not only has its own CPU and instructions, but also peripheral
accessed and processed to perform tasks such as identification,
modules just designed to meet various audio application
enhancing, and modification. However, for some simpler
requirements. As shown in Figure 3, signal can be fed into the
applications, for example just “Record” and “Playback”
chip either from a microphone or two other auxiliary channels.
applications, this approach does not provide the easiest
There are amplification modules behind all these input
implementation.
channels. Particularly, there is an AGC module behind the
If to record and playback are the only requirements for an
microphone channel. There are also several output
audio system, the easiest implementation might be to use a
amplification module, a few multiplexer module, a couple
dedicated voice chip which is controlled by a MCU via a
summing module, a couple filter module, an internal clock
communication link. The block diagram of this approach is
module, and a storage module. Also, there are a device control
shown in Figure 2.
module and a power conditioning module, which are common
to almost all stand-alone application chips.
Voice MIC
MCU
Chip 2) How ISD 5116 works
Speaker ISD5116 has its own CPU inside the chip. Quite a few
instructions are designed specifically for audio related
functions. Examples of such instructions include RECORD
Figure 2. Audio Module implementation using a dedicated
ANALOG, RECORD ANNLOG @ ADDR, PLAY
3

ANALOG, PLAY ANALOG @ ADDR, READ STATUS, C. Implementation Circuit


and so on. Inside the chip, there is a communication module The circuit connection has two parts: the first part is the
that supports the I2C communication protocol. The operation ISD5116 chip connection; the second part is circuit
of ISD5116 can be controlled by other MCU via the I2C port. configuration inside the PSoC5 MCU.
The status or configuration of an ISD5116 chip can be
configured at any time by load different values to two of the 1) ISD5116 Connection
dedicated configuration registers: CFG0 and CFG1. It is easy to use ISD5116. Very few external components
The interaction between the MCU and ISD5116 goes like are needed. In Figure5, the schematic for ISD5116 circuit
this: first, by using command LOAD CFG0 and LOAD CFG1, connection is given. It is noticed that
the MCU configure ISD5116 to a desired state; then, the MCU  the input to the chip is from the MIC, while the
send “record”, “play”, “write” or “read” command to ISD5116 output is the Speaker;
to perform intended tasks.  communication with the MCU is accomplished by
SCL pin and SDA pin;
3) ISD5116 Features  through Pin 25, ISD5116 also sends out an interrupt
ISD5116 has some interesting features worth pointing out: signal to the MCU to mark that the end of a message
 No CODEC module has been reached.
 Up to 17 minutes and 28 second (4.0 kHz sample
rate) record time, or 8 minutes and 44 seconds at 1
VCCD
27 VCC
VCC SCL
3 28
8.0 kHz sample rate. 1.5 k
2
SDA
A1
VCCD
5 0.1uF
4 VSSD
 Fully addressable to handle multiple messages 26
A0
XCLK
VSSD
6

17
 Direct support for digital data 220 uF 1.5 k
VCCA
VSSA
9 0.1uF
15
 Fast mode I2C (400 kHz) serial interface 8
MIC+
ISD5116
VSSA
VSSA
23 1.5 k

MIC
10 25
MIC- INT
EOM_INT

B. MCU of choice 1.5 k


SP+
16

In this sample design, a Programmable embedded System- SP-


14

13
on-Chip, the PSoC 5 from Cypress is selected to function as 4.7 uF
ACAP
Speaker
(8 ohm)

the application control MCU. PSoC 5 integrates configurable


analog and digital peripheral functions, memory and a
controller on a single chip [2]. Figure 5. ISD5116 Circuit Connection

The Cypress PSoC 5 provides unrivalled level of flexibility 2) Circuit Connection Inside PSoC 5
and excellent performance. Best of all, the develop The circuit connection in side PSoC 5 is shown in Figure 6.
environment, PSoC Creator, and the full function C compiler It is obvious that this schematic is quite different from a
can all be obtained, free of charge, from the vendor. For traditional circuit schematic. In the diagram, the LCD module
completeness, a simplified version of the PSoC 5 block is optional. The I2C functionality is obtained by dropping an
diagram is given in Figure 4. I2C module in the schematic and connects “sda” and “scl” to
selected PSoC5 port pins. These port pins are then connected
to the “SCL” (Pin 1) and the “SDA” (Pin 3) in the ISD5116
circuit. It is important to point out that since the PSoC5 port
pins assigned to “sda” and “scl” are configured at pull-up type
of pins, therefore it is not necessary to install pull-up resistors
for the SCL pin and SDA pin in the ISD5116 circuit.
Two switches, SW1 and SW2; and two LEDs, SW1_LED
and SW2_LED are also implemented around the MCU circuit.
The event of pressing and holding SW1 will enable recording,
this action is indicated by the lighting of SW1_LED.
SW1_LED goes off when SW1 is released. After the messages
have been recorded, a press of SW2 will make the system to
playback recorded messages. SW2_LED is light when the
system is in the playback mode, and it is off when all recorded
messages have been played.

Figure 4. Simplified PSoC5 Block Diagram


4

IV. CONCLUSION
In this paper, the general operation principle of an audio
module in an embedded system is explained. Various
implementation techniques are introduced. A sample
implementation is provided. Detailed circuit diagram and key
part of the code are also made available. The sample
implementation can be used as reference design by students
and application engineers.

APPENDIX
#define PowerUp 0x80
#define PowerDown 0x00
#define Stop_ON 0x80
#define Stop_OFF 0x00
#define Load_Address 0x81
Figure 6. Circuit Connection Inside PSoC 5 #define Load_CFG0 0x82
#define Load_CFG1 0x83
#define Record 0x90
#define Record_Addr 0x91
D. Program Flow Block Diagram #define Play 0xA8
#define Play_Addr 0xA9
#define ISD_Address 0x40
Initializtion
uint8 ISD_Mem_Addr_Hi;
uint8 ISD_Mem_Addr_Lo;
Record uint8 ISD_Status;
Done ?
void Read_Status()
N {
Start_Status = I2C_M_MasterSendStart(ISD_Address,
7 Message
Y I2C_M_READ_XFER_MODE);
Recorded ? ISD_Status = I2C_M_MasterReadByte(I2C_M_ACK_DATA);
ISD_Mem_Addr_Hi = I2C_M_MasterReadByte(I2C_M_ACK_DATA);
N Record Done ISD_Mem_Addr_Lo = I2C_M_MasterReadByte(I2C_M_NAK_DATA);
Record @ Addr In Play Mode I2C_M_MasterSendStop();
Inc. Addr }

void ISD_PowerUp()
{
Played all Y Start_Status = I2C_M_MasterSendStart(ISD_Address,
message ? End
I2C_M_WRITE_XFER_MODE);
I2C_M_MasterWriteByte(PowerUp);
N I2C_M_MasterSendStop();
Play @ Addr CyDelay(100);
Inc. Addr }

void ISD_StopON()
{
I2C_M_MasterSendStart(ISD_Address, I2C_M_WRITE_XFER_MODE);
Figure 7. Program Flow Block Diagram I2C_M_MasterWriteByte(Stop_ON);
I2C_M_MasterSendStop();
The sample system is designed to record seven messages }

and then playback in sequence when button SW2 is pressed. void Write_Config(uint8 CFG0_Hi, uint8 CFG0_Lo, uint8 CFG1_Hi, uint8 CFG1_Lo)
The recording of each message is initiated by pressing and {
I2C_M_MasterSendStart(ISD_Address, I2C_M_WRITE_XFER_MODE);
holding button SW1. The maximum length of each message is I2C_M_MasterWriteByte(Load_CFG0);
6 seconds. The audio system is initialized to sample the input I2C_M_MasterWriteByte(CFG0_Hi);
I2C_M_MasterWriteByte(CFG0_Lo);
audio signal at a rate of 8 kHz. I2C_M_MasterSendRestart(ISD_Address,
The program flow block diagram for the above-mention I2C_M_WRITE_XFER_MODE);
sample system is given in Figure 7. The key part of the code is I2C_M_MasterWriteByte(Load_CFG1);
I2C_M_MasterWriteByte(CFG1_Hi);
given in the following section. I2C_M_MasterWriteByte(CFG1_Lo);
I2C_M_MasterSendStop();
}
E. Key Part of the Code
The key part of the code in the sample system is given in the void main()
{
APPENDIX section. The code is especially helpful to student int8 i, HiAddr, RecordDone, PlayMode;
and people who are new to embedded system design and LCD_Start();
implementation. I2C_M_Start();
I2C_M_EnableInt();
ISD_PowerUp();
CyDelay(100);
CYGlobalIntEnable;

Write_Config(0x24, 0x27, 0x01, 0x40); // MIC to MEM record configuration

Read_Status();
5

LCD_Position(0,0);
LCD_PrintString("StReg: ");
LCD_PrintInt8(ISD_Status);
LCD_PrintString(" ");
LCD_PrintInt8(ISD_Mem_Addr_Hi);
LCD_PrintInt8(ISD_Mem_Addr_Lo);

RecordDone = 0;
PlayMode = 0;

for(;;)
{
if(RecordDone == 0)
{
HiAddr = 0x00;
for(i=0; i<7; i++)
{
while(CyPins_ReadPin(SW1_Record) != 0);

CyDelay(500); // Wait a brief moment for button to settle down


CyPins_SetPin(SW1_LED_0);
I2C_M_MasterSendStart(ISD_Address,I2C_M_WRITE_XFER_MODE);
I2C_M_MasterWriteByte(Record_Addr);
I2C_M_MasterWriteByte(HiAddr);
I2C_M_MasterWriteByte(0x00);
I2C_M_MasterSendStop();

while(CyPins_ReadPin(SW1_Record) == 0);
ISD_StopON();

LCD_Position(1,0);
LCD_PrintInt8(HiAddr);

HiAddr = HiAddr + 0x04;


CyPins_ClearPin(SW1_LED_0);
}
RecordDone = 1;
}
else
{
if(PlayMode == 0)
{
Write_Config(0x24,0x22,0x79,0xD1);
PlayMode = 1;
}

if(CyPins_ReadPin(SW2_Play) == 0)
{
CyDelay(500);
CyPins_SetPin(SW2_LED_0);

CyDelay(100);

HiAddr = 0x00;
for(i=0; i<7; i++)
{
I2C_M_MasterSendStart(ISD_Address,
I2C_M_WRITE_XFER_MODE);
I2C_M_MasterWriteByte(Play_Addr);
I2C_M_MasterWriteByte(HiAddr);
I2C_M_MasterWriteByte(0x00);
I2C_M_MasterSendStop();
while(CyPins_ReadPin(EOM_INT_0) !=0);
Read_Status();
LCD_Position(1,4);
LCD_PrintInt8(HiAddr);
HiAddr = HiAddr + 0x04;
CyDelay(500);
}
CyPins_ClearPin(SW2_LED_0);
}
}
}
}

REFERENCES
[1] Winbond, “ISD5116 datasheet.”
[2] Cypress Semiconductor Corporation, PSoC5 datasheet,
www.cypress.com.

Das könnte Ihnen auch gefallen