A Survey of Techniques To Add Audio Module To Embedded Systems
A Survey of Techniques To Add Audio Module To Embedded Systems
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.
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
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
13
on-Chip, the PSoC 5 from Cypress is selected to function as 4.7 uF
ACAP
Speaker
(8 ohm)
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.
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;
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);
while(CyPins_ReadPin(SW1_Record) == 0);
ISD_StopON();
LCD_Position(1,0);
LCD_PrintInt8(HiAddr);
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.