October 1996 NSAM266SP CompactSPEECH TM Digital Speech Processor with Full-Duplex Speakerphone General Description The NSAM266SP is a member of National Semiconductor’s CompactSPEECH Digital Speech Processor family. This processor provides Digital Answering Machine (DAM) functionality to embedded systems. The CompactSPEECH interfaces with National Semiconductor’s NM29A040 and NM29A080 Serial Flash memory devices to provide a cost-effective solution for DAM and Cordless DAM (CDAM) applications. The CompactSPEECH processor integrates the functions of a traditional Digital Signal Processing (DSP) chip and the CR16A, a 16-bit general-purpose RISC core implementation of the CompactRISCTM architecture. It contains system support functions such as Interrupt Control Unit, Codec interface, MICROWIRETM interfaces to a microcontroller and Serial Flash, WATCHDOGTM timer, and a Clock Generator. The CompactSPEECH processor operates as a slave peripheral that is controlled by an external microcontroller via a serial MICROWIRE interface. In a typical DAM environment, the microcontroller controls the analog circuits, buttons and display, and activates the CompactSPEECH by sending it commands. The CompactSPEECH processor executes the commands and returns status information to the microcontroller. The CompactSPEECH firmware implements voice compression and decompression, tone detection and generation, message storage management, speech synthesis for timeand-day stamp, and supports user-defined voice prompts in various languages. The CompactSPEECH implements a digital full-duplex speakerphone, which utilizes acoustic echo-cancellation techniques to enable simultaneous talking and listening during hands free conversation. Minimum microcontroller intervention (launch-and-forget) is required during speakerphone sessions. The speakerphone monitors its performance in real-time, and continually updates its internal state and filters to enable high-quality hands-free conversation. The CompactSPEECH implements echo-cancellation techniques to support high-quality DTMF tone detection during message playback. The CompactSPEECH can synthesize messages in various languages via the International Vocabulary Support (IVS) mechanism. The NSAM266SP can store vocabularies on either Serial Flash, or Expansion ROM memories. DAM manufacturers can thus create machines that ‘‘speak’’ in different languages, simply by using other vocabularies. For more details about IVS, refer to the IVS User’s Manual. Block Diagram NSAM266SP Basic Configuration TL/EE/12868 – 1 TRI-STATEÉ is a registered trademark of National Semiconductor Corporation. CompactSPEECHTM , CompactRISCTM , COPSTM Microcontrollers, HPCTM , MICROWIRETM , MICROWIRE/PLUSTM and WATCHDOGTM are trademarks of National Semiconductor Corporation. C1996 National Semiconductor Corporation TL/EE12868 RRD-B30M116/Printed in U. S. A. http://www.national.com NSAM266SP CompactSPEECH Digital Speech Processor with Full-Duplex Speakerphone PRELIMINARY Features Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Designed around the CR16A, a 16-bit general-purpose RISC core implementation of the CompactRISC architecture 16-bit architecture and implementation 20.48 MHz operation On-chip DSP Module (DSPM) for high-speed DSP operations On-chip codec clock generation and interface Power-down mode Digital full-duplex speakerphone Acoustic-echo cancellation Line echo cancellation Digital volume control for the speaker Microphone MUTE mode with smooth switching between normal and mute modes Continuous on-the-fly monitoring of external (acoustic and line) and internal conditions provides high-quality hands-free conversation in a changing environment No microcontroller control needed for the speakerphone operation No need for a special signal to train the echo cancelers No need for special hardware circuits Selectable speech compression rate of 5.2 kbit/s or 7.3 kbit/s with silence compression Up to 16 minutes recording on a 4-Mbit Serial Flash (more than 1 hour total recording time on four devices) The number of messages that can be stored is limited only by memory size Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y http://www.national.com 2 MICROWIRE slave interface to an external microcontroller MICROWIRE master interface to Serial Flash memory devices Storage and management of messages Programmable message tag for message categorization, e.g., Mailboxes, InComing Messages (ICM), OutGoing Messages (OGM) Skip forward or backward during message playback Variable speed playback Supports external vocabularies, using Serial Flash or expansion ROM Multi-lingual speech synthesis using International Vocabulary Support (IVS) Vocabularies available in: English, Japanese, Mandarin, German, French and Spanish DTMF generation and detection DTMF detection during OutGoing Message playback Single tone generation Telephone line functions, including busy and dial tone detection Real-time clock Direct access to message memory Supports long-frame and short-frame codecs Call screening (input signal echoed to codec output) Supports up to four 4-Mbit, or two 8-Mbit, Serial Flash devices Supports prerecorded vocabularies on Serial Flash Available in PLCC 68-pin, and PQFP 100-pin packages Table of Contents 2.2 CompactSPEECH CommandsÐQuick Reference Table 1.0 HARDWARE 1.1 Pin Assignment 2.3 The State Machine 1.1.1 PinÐSignal Assignment 1.1.2 Pin Assignment in the 68-PLCC Package 1.1.3 Pin Assignment in the 100-PQFP Package 2.4 Command Execution 2.5 Tunable Parameters 2.6 Messages 1.2 Functional Description 2.6.1 Message Tag 1.2.1 Resetting 1.2.2 Clocking 1.2.3 Power-down Mode 1.2.4 Power and Grounding 1.2.5 Memory Interface 1.2.6 Codec Interface 2.7 Speech Compression 2.8 Tone and No-Energy Detection 2.9 Full-Duplex Speakerphone 2.9.1 Speakerphone Modes of Operation 2.9.2 Speakerphone Terminology 1.3 Specifications 2.10 Speech Synthesis 1.3.1 Absolute Maximum Ratings 1.3.2 Electrical Characteristics 1.3.3 Switching Characteristics 1.3.4 Synchronous Timing Tables 1.3.5 Timing Diagrams 2.10.1 International Vocabulary Support (IVS) 2.10.2 Vocabulary Design 2.10.3 IVS Vocabulary Components 2.10.4 The IVS Tool 2.10.5 How to Use the IVS Tool with the CompactSPEECH 2.0 SOFTWARE 2.1 Overview 2.11 Initialization 2.1.1 DSP-based Algorithms 2.1.2 System Support 2.1.3 Peripherals Support 2.12 Microwire Serial Interface 2.13 Signal Description 2.13.1 Signal Use in the Interface Protocol 2.13.2 Interface Protocol Error Handling 2.14 The Master Microwire Interface 2.14.1 Master MICROWIRE Data Transfer 2.15 Command Description APPENDIX A SCHEMATIC DIAGRAMS 3 http://www.national.com 1.0 Hardware 1.2 PIN ASSIGNMENT 1.2.1 PinÐSignal Assignment The following sections detail the pins of the NSAM266SP processor. Slashes separate the names of signals that share the same pin. Table 1-1 shows all the pins, and the signals that use them in different configurations. It also shows the type and direction of each signal. TABLE 1-1. CompactSPEECH PinÐSignal Assignment Pin Name Type Signal Name I/O A(0:15) TTL A(0:15) Output CCLK TTL CCLK Output CDIN TTL CDIN Input CDOUT TTL CDOUT Output CFS0 TTL CFS0 Output Output CFS1 TTL CFS1 D(0:7) TTL D(0:7) I/O MWCS TTL (Note A) MWCS Input TST TTL TST Input I/O MWRDY TTL MWRDY MWRQST TTL MWRQST I/O MWDOUT TTL MWDOUT Output PB(0:2) (Note B) TTL EA(16:18) Output PB(3:6) (Note C) TTL CS(0:3) Output EMCS/ ENV0 TTL1 (Note D) CMOS (Note E) EMCS ENV0 Output Input MWCLK TTL MWCLK Input MWDIN TTL MWDIN Input MMCLK TTL1 (Note D) MMCLK Output MMDIN TTL MMDIN Input MMDOUT TTL1 (Note D) MMDOUT Output RESET Schmitt (Note A) RESET Input VCC Power VCC VSS Power VSS X1 XTAL X1 OSC X2/CLKIN XTAL TTL X2 CLKIN OSC Input Note A: Schmitt trigger input. Note B: Virtual address lines for IVS ROM. Note C: Chip select lines for Serial Flash devices. Note D: TTL1 output signals provide CMOS levels in the steady state, for small loads. Note E: Input during reset, CMOS level input. http://www.national.com 4 1.0 Hardware (Continued) 1.1.2 Pin Assignment in the 68-PLCC Package TL/EE/12868 – 2 Note: Pins marked NC should not be connected. FIGURE 1-1. 68-PLCC Package Connection Diagram 5 http://www.national.com 1.0 Hardware (Continued) 1.1.3 Pin Assignment in the 100-PQFP Package TL/EE/12868 – 3 Note: Pins marked NC should not be connected. FIGURE 1-2. 100-PQFP Package Connection Diagram http://www.national.com 6 1.0 Hardware (Continued) External Single-Phase Clock Signal 1.2 FUNCTIONAL DESCRIPTION This section provides details of the functional characteristics of the CompactSPEECH processor. It is divided into the following sections: Resetting Clocking Power-down Mode Power and Grounding Memory Interface Codec Interface If an external single-phase clock source is used, it should be connected to the CLKIN signal as shown in Figure 1-4 , and should conform to the voltage-level requirements for CLKIN stated in Section 1.3.2. 1.2.1 Resetting The RESET pin is used to reset the CompactSPEECH processor. On application of power, RESET must be held low for at least tpwr after VCC is stable. This ensures that all on-chip voltages are completely stable before operation. Whenever RESET is applied, it must also remain active for not less than tRST. During this period, and for 100 ms after, the TST signal must be high. This can be done with a pull-up resistor on the TST pin. The value of MWRDY is undefined during the reset period, and for 100 ms after. The microcontroller should either wait before polling the signal for the first time, or the signal should be pulled high during this period. Upon reset, the ENV0 signal is sampled to determine the operating environment. During reset, the EMCS/ENV0 pin is used for the ENV0 input signals. An internal pull-up resistor sets ENV0 to 1. After reset, the same pin is used for EMCS. TL/EE/12868 – 5 FIGURE 1-4. External Clock Source Crystal Oscillator A crystal oscillator is connected to the on-chip oscillator circuit via the X1 and X2 signals, as shown in Figure 1-5 . TL/EE/12868 – 6 FIGURE 1-5. Connections for an External Crystal Oscillator Keep stray capacitance and inductance, in the oscillator circuit, as low as possible. The crystal resonator, and the external components, should be as close to the X1 and X2/CLKIN pins as possible, to keep the trace lengths in the printed circuit to an absolute minimum. You can use crystal resonators with maximum load capacitance of 20 pF, although the oscillation frequency may differ from the crystal’s specified value. Table 1-2 lists the components in the crystal oscillator circuit. System Load on ENV0 For any load on the ENV0 pin, the voltage should not drop below VENVh. If the load on the ENV0 pin causes the current to exceed 10 mA, use an external pull-up resistor to keep the pin at 1. Figure 1-3 shows a recommended circuit for generating a reset signal when the power is turned on. TABLE 1-2. Crystal Oscillator Component List Component Parameters Values Tolerance Resonance Frequency 40.96 MHz AT-Cut 50X Maximum Shunt Capacitance 7 pF Maximum Load Capacitance 12 pF FIGURE 1-3. Recommended Power-On Reset Circuit N/A Resistor R1 10 MX 5% Capacitor C1 1000 pF 20% 3.9 mH 10% Inductor L 7 Parallel Type Maximum Serial Crystal Resistance Resonator TL/EE/12868 – 4 1.2.2 Clocking The CompactSPEECH provides an internal oscillator that interacts with an external clock source through the X1 and X2/CLKIN pins. Either an external single-phase clock signal, or a crystal oscillator, may be used as the clock source. Third Overtone http://www.national.com 1.0 Hardware (Continued) 1.2.5 Memory Interface 1.2.3 Power-Down Mode Power-down mode is useful during a power failure, when the power source for the CompactSPEECH is a backup battery, or in battery powered devices, while the CompactSPEECH is idle. In power-down mode, the clock frequency of the CompactSPEECH is reduced, and some of the processor modules are deactivated. As a result, the CompactSPEECH consumes much less power than in normal-power mode (k 1.5 mA). Although the CompactSPEECH does not perform all its usual functions in power-down mode, it still keeps stored messages and maintains the time of day. Serial Flash Interface The CompactSPEECH supports up to four NM29A040 4-Mbit, or up to two NM29A080 8-Mbit, serial flash memory devices for storing messages. NM29A040 The NM29A040 is organized as 128 blocks of 128 pages, each containing 32 bytes. A block is the smallest unit that can be erased, and is 4 kbytes in size. Not all 128 blocks are available for recording. Up to 10 blocks may contain bad bits, and one block is write-once and holds the locations of these unusable blocks. For further information about the NM29A040, see the NM29A040 Datasheet. NM29A080 The NM29A080 is organized as 256 blocks of 128 pages, each containing 32 bytes. A block is the smallest unit that can be erased, and is 4 kbytes in size. Not all 256 blocks are available for recording. Up to 20 blocks may contain bad bits, and two blocks are write-once and hold the locations of these unusable blocks. For further information about the NM29A080, see the NM29A080 Datasheet . Message Organization and Recording Time A CompactSPEECH message uses at least one block. The number of messages that can be stored on one NM29A040 device is 117 to 127, and on one NM29A080 device is 234 to 254 depending on the number of bad blocks. The maximum recording time depends on four factors: 1. The basic compression rate (5.2 kbit/s or 7.3 kbit/s). 2. The amount of silence in the recorded speech. 3. The number of bad blocks. 4. The number of recorded messages. (The basic memory allocation unit for a message is a 4 kbyte block which means that half a block in average is wasted per recorded message.) Assuming a single message is recorded in all the available memory space of a 4 Mbit device with no bad blocks, the maximum recording time using 5.2 kbit/s compression is as follows: TABLE 1-3. Recording Time on 4 Mbit Device Note: In power-down mode all the chip select signals, CS0 to CS3, are set to 1. To guarantee that there is no current flow from these signals to the Serial Flash devices, the power supply to these devices must not be disconnected. The CompactSPEECH stores messages, and all memory management information, in flash memory. Thus, there is no need to maintain the power to the processor to preserve stored messages. If the microcontroller’s real-time clock (and not the CompactSPEECH’s real-time clock) is used to maintain the time and day, neither the flash nor the CompactSPEECH require battery backup during power failure. In this case, when returning to normal mode, the microcontroller should perform the initialization sequence, as described in Section 2.11, and use the SETD command to set the time and day. To keep power consumption low in power-down mode, the RESET, MWCS, MWCLK and MWDIN signals should be held above VCC b 0.5V or below VSS a 0.5V. The PDM (Go To Power-down Mode) command switches the CompactSPEECH to power-down mode. (For an explanation of the CompactSPEECH commands, see Section 2.15.) It may only be issued when the CompactSPEECH is in the IDLE state. (For an explanation of the CompactSPEECH states, see Section 2.3.) If it is necessary to switch to power-down mode from any other state, the controller must first issue an S command to switch the CompactSPEECH to the IDLE state, and then issue the PDM command. Sending any command while in power-down mode resets the CompactSPEECH detectors, and returns the CompactSPEECH to normal operation mode. 1.2.4 Power and Grounding The CompactSPEECH processor requires a single 5V power supply, applied to the VCC pins. The grounding connections are made on the GND pins. For optimal noise immunity, the power and ground pins should be connected to VCC and the ground planes, respectively, on the printed circuit board. If VCC and the ground planes are not used, single conductors should be run directly from each VCC pin to a power point, and from each GND pin to a ground point. Avoid daisy-chained connections. Use decoupling capacitors to keep the noise level to a minimum. Attach standard 0.1 mF ceramic capacitors to the VCC and GND pins, as close as possible to the CompactSPEECH. When you build a prototype, using wire-wrap or other methods, solder the capacitors directly to the power pins of the CompactSPEECH socket, or as close as possible, with very short leads. http://www.national.com Amount of Silence Total Recording Time 0% 10% 15% 20% 25% 13 minutes 9 seconds 14 minutes 25 seconds 15 minutes 7 seconds 15 minutes 47 seconds 16 minutes 25 seconds Serial Flash Endurance The serial flash may be erased up to 100,000 times. To reduce the effect of this limitation, the memory manager utilizes the serial flash’s blocks evenly, i.e., each block is erased more or less the same number of times, to ensure that all blocks have the same lifetime. 8 1.0 Hardware (Continued) Consider the following extensive usage of all the NM29A040’s blocks: 1. Record 15 minutes of messages (until the memory is full). 2. Playback 15 minutes (all the recorded messages). 3. Delete all messages. Assuming a NM29A040 device is used in this manner 24 times a day, its expected lifetime is: Flash Lifetime e 100,000/(24 * 365) e 11.4 years 1.2.6 Codec Interface The CompactSPEECH provides an on-chip interface to two serial codecs. This interface supports codec operation in long or short-frame formats. The format is selected with the CFG command. The codec interface uses five signals CDIN, CDOUT, CCLK, CFS0 and CFS1. The CDIN input pin and the CDOUT, CCLK and CFS0 output pins are connected to the first codec. The second codec is connected to CDIN, CDOUT, CCLK and the CFS1 output pin. Data is transferred to the codec through the CDOUT pin. Data is read from the codec through the CDIN pin. Thus the NM29A040 device will last for over ten years, even when used for six hours of recording per day. Note, that if an NM29A080 device is used, then, under the same conditions, it will last for more than 20 years. ROM Interface IVS vocabularies can be stored in either serial flash and/or ROM. The CompactSPEECH supports IVS ROM devices through Expansion Memory. Up to 64 kbytes (64k x 8) of Expansion Memory are supported directly. Nevertheless, the CompactSPEECH uses bits of the on-chip port (PB) to further extend the 64 kbytes address space up to 0.5 Mbytes address space. ROM is connected to the CompactSPEECH using the data bus, D(0:7), the address bus, A(0:15), the extended address signals, EA(16:18), and Expansion Memory Chip Select, EMCS, controls. The number of extended address pins to use may vary, depending on the size and configuration of the ROM. Short Frame Protocol When short frame protocol is configured, eight data bits are exchanged with each codec in each frame, i.e., CFS0 cycle. Data transfer starts when CFS0 is set to 1 for one CCLK cycle. The data is then transmitted, bit-by-bit, via the CDOUT output pin. Concurrently, the received data is shifted in via the CDIN input pin. Data is shifted one bit in each CCLK cycle. After the last bit has been shifted, CFS1 is set to 1 for one CCLK cycle. Then, the data from the second codec is shifted out via CDOUT, concurrently with the inward shift of the data received via CDIN. Figure 1-6 shows how the codec interface signals behave when short frame protocol is configured. Reading from Expansion Memory An Expansion Memory read bus-cycle starts at T1, when the data bus is in TRI-STATEÉ, and the address is driven on the address bus. EMCS is asserted (cleared to 0) on a T2W1 cycle. This cycle is followed by three T2W cycles and one T2 cycle. The CompactSPEECH samples data at the end of the T2 cycle. The transaction is terminated at T3, when EMCS becomes inactive (set to 1). The address remains valid until T3 is complete. A T3H cycle is added after the T3 cycle. The address remains valid until the end of T3H. Long Frame Protocol When long frame protocol is configured, eight data bits are exchanged with each codec, as for the short frame protocol. However, for the long frame protocol, data transfer starts by setting CFS0 to 1 for eight CCLK cycles. Simultaneously, the data for the first codec is shifted out bitby-bit, via the CDOUT output pin, as in short frame protocol. Concurrently, the received data is shifted in through the CDIN input. The data is shifted one bit in each CCLK cycle. One CCLK cycle after CFS0 has become inactive (0), CFS1 is set to 1, for eight CCLK cycles. Simultaneously, the data for the second codec is shifted out, MSB first, via CDOUT, concurrently with the received data shifted in from CDIN. Figure 1-7 shows how the codec interface signals behave when long frame protocol is configured. 9 http://www.national.com 1.0 Hardware (Continued) TL/EE/12868 – 7 FIGURE 1-6. Codec ProtocolÐShort Frame TL/EE/12868 – 8 FIGURE 1-7. Codec ProtocolÐLong Frame http://www.national.com 10 1.0 Hardware (Continued) All Input or Output Voltages, with Respect to GND 1.3 SPECIFICATIONS b 0.5V to a 6.5V Note:Absolute maximum ratings indicate limits beyond which permanent damage may occur. Continuous operation at these limits is not intended; operation should be limited to those conditions specified below. 1.3.1 Absolute Maximum Ratings If Military/Aerospace specified devices are required, please contact the National Semiconductor Sales Office/Distributors for availability and specifications. b 65§ C to a 150§ C Storage Temperature Temperature under Bias 0§ C to a 70§ C 1.3.2 Electrical Characteristics TA e 0§ C to a 70§ C, VCC e 5V g 10%, GND e 0V Symbol Parameter Conditions Min Typ Max Units 2.0 VCC a 0.5 V b 0.5 0.8 V VIH TTL Input, Logical 1 Input Voltage VIL TTL Input, Logical 0 Input Voltage VXH CLKIN Input, High Voltage External Clock VXL CLKIN Input, Low Voltage External Clock VENVh ENV0 High Level, Input Voltage 3.6 V VHh CMOS Input with Hysteresis, Logical 1 Input Voltage 3.6 V VHI CMOS Input with Hysteresis, Logical 0 Input Voltage VHys Hysteresis Loop Width (Note A) 0.5 V VOH Logical 1 TTL, Output Voltage IOH e b0.4 mA 2.4 V VOHWC MMCLK, MMDOUT and EMCS Logical 1, Output Voltage IOH e b0.4 mA 2.4 V VOL VOLWC Logical 0, TTL Output Voltage MMCLK, MMDOUT and EMCS Logical 0, Output Voltage 2.0 V 0.8 1.1 IOH e b50 mA (Note B) VCC b 0.2 V V V IOL e 4 mA 0.45 IOL e 50 mA (Note B) 0.2 V IOL e 4.0 mA 0.45 V IOL e 50 mA (Note B) V 0.2 V b 5.0 5.0 mA b 5.0 5.0 mA 80.0 mA IL Input Load Current (Note C) 0V s VIN s VCC IO (Off) Output Leakage Current (I/O Pins in Input Mode) (Note C) 0V s VOUT s VCC ICC1 Active Supply Current Normal Operation Mode, Running Speech Applications (Note D) 65.0 ICC2 Standby Supply Current Normal Operation Mode, DSPM Idle (Note D) 40.0 ICC3 Power-Down Mode Supply Current Power-Down Mode (Notes D and E) CX X1 and X2 Capacitance (Note A) mA 1.5 17.0 mA pF Note A: Guaranteed by design. Note B: Measured in power-down mode. The total current driven, or sourced, by all the CompactSPEECH’s output signals is k 50 mA. Note C: Maximum 20 mA for all pins together. Note D: IOUT e 0, TA e 25§ C, VCC e 5V, operating from a 40.96 MHz crystal, and running from internal memory with Expansion Memory disabled. Note E: All input signals are tied to 1 or 0 (above VCC b 0.5 or below VSS a 0.5V). 11 http://www.national.com 1.0 Hardware (Continued) Maximum times assume capacitive loading of 50 pF. CLKIN crystal frequency is 40.96 MHz. 1.3.3 Switching Characteristics Definitions Note: CTTL is an internal signal and is used as a reference to explain the timing of other signals. See Figure 1-22 . All timing specifications in this section refer to 0.8V or 2.0V on the rising or falling edges of the signals, as illustrated in Figures 1-8 through 1-14, unless specifically stated otherwise. TL/EE/12868 – 9 Signal valid, active or inactive time, after a rising edge of CTTL or MWCLK. FIGURE 1-8. Synchronous Output Signals (Valid, Active and Inactive) TL/EE/12868 – 10 Signal valid time, after a falling edge of MWCLK. FIGURE 1-9. Synchronous Output Signals (Valid) TL/EE/12868 – 11 Signal hold time, after a rising edge of CTTL. FIGURE 1-10. Synchronous Output Signals (Hold) http://www.national.com 12 1.0 Hardware (Continued) TL/EE/12868 – 12 Signal hold time, after a falling edge of MWCLK. FIGURE 1-11. Synchronous Output Signals (Hold) TL/EE/12868 – 13 Signal setup time, before a rising edge of CTTL or MWCLK, and signal hold time after a rising edge of CTTL or MWCLK. FIGURE 1-12. Synchronous Input Signals 13 http://www.national.com 1.0 Hardware (Continued) TL/EE/12868 – 14 Signal B starts after rising or falling edge of signal A. FIGURE 1-13. Asynchronous Signals The RESET signal has a Schmitt trigger input buffer. Figure 1-14 shows the characteristics of the input buffer. TL/EE/12868 – 15 FIGURE 1-14. Hysteresis Input Characteristics http://www.national.com 14 1.0 Hardware (Continued) 1.3.4 Synchronous Timing Tables In this section, R.E. means Rising Edge and F.E. means Falling Edge. OUTPUT SIGNALS Symbol Figure Description Reference Conditions Min (ns) Max (ns) tAh 1-17 Address Hold After R.E. CTTL 0.0 tAv 1-17 Address Valid After R.E. CTTL, T1 12.0 tCCLKa 1-15 CCLK Active After R.E. CTTL 12.0 tCCLKh 1-15 CCLK Hold After R.E. CTTL tCCLKia 1-15 CCLK Inactive After R.E. CTTL tCDOh 1-15 CDOUT Hold After R.E. CTTL tCDOv 1-15 CDOUT Valid After R.E. CTTL tCTp 1-22 CTTL Clock Period (Note A) R.E. CTTL to next R.E. CTTL tEMCSa 1-17 EMCS Active After R.E. CTTL, T2W1 tEMCSh 1-17 EMCS Hold After R.E. CTTL tEMCSia 1-17 EMCS Inactive After R.E. CTTL, T3 tFSa 1-15 CFS0 and CFS1 Active After R.E. CTTL tFSh 1-15 CFS0 and CFS1 Hold After R.E. CTTL tFSia 1-15 CFS0 and CFS1 Inactive After R.E. CTTL tMMCLKa 1-20 Master MICROWIRE Clock Active After R.E. CTTL tMMCLKh 1-20 Master MICROWIRE Clock Hold After R.E. CTTL tMMCLKia 1-20 Master MICROWIRE Clock Inactive After R.E. CTTL tMMDOh 1-20 Master MICROWIRE Data Out Hold After R.E. CTTL tMMDOv 1-20 Master MICROWIRE Data Out Valid After R.E. CTTL 12.0 tMWDOf 1-18 MICROWIRE Data Float (Note B) After R.E. MWCS 70.0 tMWDOh 1-18 MICROWIRE Data Out Hold (Note B) After F.E. MWCK 0.0 tMWDOnf 1-18 MICROWIRE Data No Float (Note B) After F.E. MWCS 0.0 tMWDOv 1-18 MICROWIRE Data Out Valid (Note B) After F.E. MWCK 70.0 tMWITOp 1-19 MWDIN to MWDOUT Propagation Time 70.0 tMWRDYa 1-18 MWRDY Active After R.E. of CTTL 0.0 35.0 tMWRDYia 1-18 MWRDY Inactive After F.E. MWCLK 0.0 70.0 tPABCh 1-21 PB and MWRQST After R.E. CTTL 0.0 tPABCv 1-21 PB and MWRQST After R.E. CTTL, T2W1 0.0 12.0 0.0 12.0 48.8 50,000 12.0 0.0 12.0 25.0 0.0 25.0 12.0 0.0 12.0 0.0 70.0 12.0 Note A: In normal operation mode tCTp must be 48.8 ns; in power-down mode, tCTp must be 50,000 ns. Note B: Guaranteed by design, but not fully tested. 15 http://www.national.com 1.0 Hardware (Continued) INPUT SIGNALS Symbol Figure Description Reference Conditions Min (ns) tCDIh 1-15 CDIN Hold After R.E. CTTL 0.0 tCDIs 1-15 CDIN Setup Before R.E. CTTL 11.0 tDIh 1-17 Data in Hold (D0:7) After R.E. CTTL T1, T3 or TI 0.0 tDIs 1-17 Data in Setup (D0:7) Before R.E. CTTL T1, T3 or TI 15.0 tMMDINh 1-20 Master MICROWIRE Data In Hold After R.E. CTTL 0.0 tMMDINs 1-20 Master MICROWIRE Data In Setup Before R.E. CTTL 11.0 tMWCKh 1-18 MICROWIRE Clock High (Slave) At 2.0V (Both Edges) 100.0 tMWCKI 1-18 MICROWIRE Clock Low (Slave) At 0.8V (Both Edges) 100.0 tMWCKp 1-18 MICROWIRE Clock Period (Slave) (Note A) R.E. MWCLK to next R.E. MWCLK 2.5 ms tMWCLKh 1-18 MWCLK Hold After MWCS becomes Inactive 50.0 tMWCLKs 1-18 MWCLK Setup Before MWCS becomes Active 100.0 tMWCSh 1-18 MWCS Hold After F.E. MWCLK 50.0 tMWCSs 1-18 MWCS Setup Before R.E. MWCLK 100.0 tMWDIh 1-18 MWDIN Hold After R.E. MWCLK 50.0 tMWDIs 1-18 MWDIN Setup Before R.E. MWCLK 100.0 tPWR 1-24 Power Stable to RESET R.E. (Note B) After VCC reaches 4.5V 30.0 ms tRSTw 1-23 RESET Pulse Width At 0.8V (Both Edges) 10.0 ms tXh 1-22 CLKIN High At 2.0V (Both Edges) tX1p/2 b 5 tXI 1-22 CLKIN Low At 0.8V (Both Edges) tX1p/2 b 5 tXp 1-22 CLKIN Clock Period R.E. CLKIN to next R.E. CLKIN Note A: Guaranteed by design, but not fully tested in power-down mode. Note B: Guaranteed by design, but not fully tested. http://www.national.com 16 24.4 1.0 Hardware (Continued) 1.3.5 Timing Diagrams TL/EE/12868 – 16 FIGURE 1-15. Codec Short Frame Timing TL/EE/12868 – 17 FIGURE 1-16. Codec Long Frame Timing 17 http://www.national.com 1.0 Hardware (Continued) TL/EE/12868 – 18 Note 1: This cycle may be either TI (Idle), T3 or T3H. Note 2: Data can be driven by an external device at T2W1, T2W, T2 and T3. Note 3: This cycle may be either Tl (Idle) or T1. FIGURE 1-17. ROM Read Cycle Timing TL/EE/12868 – 19 FIGURE 1-18. MICROWIRE Transaction TimingÐData Transmitted to Output http://www.national.com 18 1.0 Hardware (Continued) TL/EE/12868 – 20 FIGURE 1-19. MICROWIRE Transaction TimingÐData Echoed to Output TL/EE/12868 – 21 FIGURE 1-20. Master MICROWIRE Timing 19 http://www.national.com 1.0 Hardware (Continued) TL/EE/12868 – 22 Note: This cycle may be either Tl (idle), T2, T3 or T3H. FIGURE 1-21. Output Signal Timing for Port PB and MWRQST TL/EE/12868 – 23 FIGURE 1-22. CTTL and CLKIN Timing TL/EE/12868 – 24 FIGURE 1-23. Reset Timing When Reset is not at Power-Up TL/EE/12868 – 25 FIGURE 1-24. Reset Timing When Reset is at Power-Up http://www.national.com 20 2.0 Software 2.1.2 System Support 2.1 OVERVIEW # # # # # # The CompactSPEECH software resides in the on-chip ROM. It includes DSP-based algorithms, system support functions and a software interface to hardware peripherals. 2.1.1 DSP-based Algorithms # # # # # Speech compression and decompression Full-duplex speakerphone DTMF detector with echo canceler Energy-based busy and dial-tone detector Digital volume control Command interface to an external microcontroller Memory and message manager IVS support Tone generator Real-time clock handler Power-down mode support 2.1.3 Peripherals Support # Serial flash interface (Master MICROWIRE handler) # Microcontroller interface (Slave MICROWIRE handler) # Codec interface The following sections describe the CompactSPEECH software in detail. 21 http://www.national.com http://www.national.com 22 S S S PA PDM S INJ A S INIT P S MR S GTM S GNM GTD S GMT S S GMS A S GL GT S GI GSW S S DM S S CVOC GEW S CMT GCFG S CMSG S S CFG A S CCIO FR** S AMAP** DMS S/A Command Name Go to Power-Down Mode Pause Playback Memory Reset Inject IVS Data Initialize System Get Tagged Message Get Time and Day Generate Tone Get Status Word Get Number of Messages Get Message Tag Get Memory Status Get Length Get Information Item Get Error Word Get Configuration Value Free Memory Delete Messages Delete Message Check Vocabulary Cut Message Tail Create Message Configure CompactSPEECH Configure Codec I/O Check and Map ARAM Description 1A 1C 03 2A 29 13 09 0E 0D 14 11 04 12 19 25 1B 02 08 0B 0A 2B 26 33 01 34 06 Opcode Hex No Change No Change IDLE IDLE IDLE IDLE No Change RESET No Change Result State IDLE IDLE None TagÐref, TagÐmask None Type None Index None None None TagÐref, TagÐmask None None Length of Time Tag, NumÐofÐBlocks ConfigÐvalue ConfigÐvalue ActionÐnumber Description PLAY IDLE IDLE IDLE IDLE IDLE IDLE 1 Return Value Time/Day None Status Word Number of Messages Message Tag Recording Time Left Message Length Value Error Word Version, ConfigÐvalue None None None Test Result None None None None Test Result Description None None None None N, byte1 . . . byten None 4an None None None None None None TagÐref, TagÐMask, Dir 2 a 2 a 1 Message Found Time/Day Option 1 2a2 1 1 2a2 2 2a2 2 1 1 Bytes Command Parameters TONEÐGENERATE Tone or DTMF No Change IDLE IDLE IDLE PLAY, RECORD, SYNTHESIS, No Change TONEÐGENERATE, IDLE* IDLE IDLE IDLE RESET, IDLE IDLE IDLE IDLE All States IDLE IDLE IDLE IDLE PLAY, RECORD, SYNTHESIS, No Change TONEÐGENERATE, IDLE All States RESET, IDLE IDLE IDLE IDLE IDLE IDLE RESET RESET, IDLE Source State 1 2 2 2 2 2 2 2 2 2 1 1 Bytes 2.0 Software (Continued) 2.2 CompactSPEECH COMMANDSÐQUICK REFERENCE TABLE Normal Mode Commands S A S S S S S S S SAS SB SDET SE SETD SF SMSG 23 S S A S S S S SS SSM SV SW TUNE VC WMSG WRAM Write RAM Write Message Volume Control Tune Say Words Set Vocabulary Type Set Speakerphone Mode Say Sentence Set Playback Speed Say One Word Set Message Tag Set Message Skip Forward Set Time and Day Skip to End of Message Set Detectors Mask Skip Backward Say Argumented Sentence Stop Read RAM Resume Reset Detectors Record Message Description 17 31 28 15 21 20 2F 1F 16 07 05 30 22 0F 24 10 23 1E 00 18 1D 2C 0C Opcode Hex IDLE, MEMORYÐWRITE IDLE, MSGÐOPEN PLAY, SYNTHESIS, IDLE, TONEÐGENERATE IDLE IDLE IDLE IDLE IDLE PLAY, SYNTHESIS, IDLE IDLE IDLE IDLE, MsgÐOpen PLAY, IDLE* IDLE PLAY, IDLE* IDLE PLAY, IDLE* IDLE All States but RESET IDLE, MEMORYÐREAD PLAY, RECORD, SYNTHESIS, TONEÐGENERATE, IDLE* IDLE IDLE Source State A e Asynchronous command. S e Synchronous command. Result State MEMORYÐWRITE MSGÐOPEN No Change IDLE SYNTHESIS IDLE No Change SYNTHESIS No Change SYNTHESIS IDLE MsgÐOpen No Change No Change No Change No Change No Change SYNTHESIS IDLE MEMORYÐREAD No Change No Change RECORD **This command exists for compatibility reasons only, and will be obsoleted in future revisions of CompactSPEECH. *Command is valid in IDLE state; but has no effect. S A SPS S S RRAM** A S RES SO S RDET SMT A R S/A Command Name Message Tag, Data Data Increment/Decrement Index, Value N, word1 . . . wordn Mode, Id Mode SentenceÐn Speed Value Word Number Message Tag NumÐofÐPages Length of Time Time/Day None Detectors Mask Length of Time SentenceÐn arg1 None None None Detectors Reset Mask Message Tag Description 2 a 32 32 1 1a2 1an 1a1 1 1 1 1 2 2 2 2 1 2 1a1 1 2 Bytes Command Parameters None None None None None None None None None None None None None None None None None None None Data None None None 32 Bytes Return Value Description 2.0 Software (Continued) Normal Mode Commands (Continued) 2.2 CompactSPEECH COMMANDSÐQUICK REFERENCE TABLE (Continued) http://www.national.com S A S S S S S S GI GT RDET S SDET SSM TUNE VC S/A Command Name http://www.national.com Volume Control Tune Set SpeakerPhone Mode Set Detectors Mask Stop Reset Detectors Generate Tone Get Information Item Description 28 15 2F 10 00 2C 0D 25 Opcode Hex PLAY, SYNTHESIS, IDLE, TONEÐGENERATE IDLE IDLE IDLE All States but RESET IDLE IDLE PLAY, RECORD, SYNTHESIS, TONEÐGENERATE, IDLE Source State No Change IDLE No Change No Change IDLE No Change TONEÐGENERATE No Chane Result State Increment/Decrement Index, Value Mode Detectors Mask None Detectors Reset Mask Tone or DTMF Index Description 1 1a2 1 1 1 1 1 Bytes Command Parameters None None None None None None None Value 2 Bytes Return Value Description 2.0 Software (Continued) Speakerphone Mode Commands 2.2 CompactSPEECH COMMANDSÐQUICK REFERENCE TABLE (Continued) 24 2.0 Software (Continued) SYNCHRONOUS COMMANDS 2.3 THE STATE MACHINE The CompactSPEECH operates in one of two modes: normal mode and Speakerphone mode. The SSM command is used to change the mode of operation. In each mode the CompactSPEECH functions as a state machine. It changes state either in response to a command sent by the microcontroller, after execution of the command is completed, or as a result of an internal event (e.g., memory full or power failure). The main difference between the operation modes is that in Speakerphone mode only a limited set of commands is supported. (See the Quick Reference Tables in Section 2.2.) The CompactSPEECH may be in one of the following states: A synchronous command must complete execution before the microcontroller can send a new command (e.g., GMS, GEW). A command sequence starts when the microcontroller sends an 8-bit opcode to the CompactSPEECH, followed by the command’s parameters (if any). The CompactSPEECH executes the command and, if required, transmits a return value to the microcontroller. Upon completion, the CompactSPEECH notifies the microcontroller that it is ready to accept a new command. ASYNCHRONOUS COMMANDS An asynchronous command starts execution in the background and notifies the microcontroller, which can send more commands while the current command is still running (e.g., R, P). RESET The CompactSPEECH is initialized to this state after a full hardware reset by the RESET signal (see Section 1-3). CompactSPEECH detectors (VOX, call progress tones and DTMF tones) are not active. In all other states, the detectors are active. (See the SDET and RDET commands for further details.) STATUS WORD The 16-bit status word indicates events that occur during normal operation. The CompactSPEECH activates the MWRQST signal, to indicate a change in the status word. This signal remains active until the CompactSPEECH receives a GSW command. IDLE This is the state from which most commands are executed. As soon as a command and all its parameters are received, the CompactSPEECH starts executing the command. ERROR WORD The 16-bit error word indicates errors that occurred during execution of the last command. If an error is detected, the command is not processed; the EVÐERROR bit in the status word is set to 1, and the MWRQST signal is activated. PLAY In this state a message is decompressed, and played back. RECORD In this state a message is compressed, and recorded into the message memory. ERROR HANDLING When the microcontroller detects that the MWRQST signal is active, it should issue the GSW (Get Status Word) command, which deactivates the MWRQST signal. Then, it should test the EVÐERROR bit in the status word, and, if it is set, send the GEW (Get Error Word) command to read the error word for details of the error. For a detailed description of each of the CompactSPEECH commands, see Section 2.15. SYNTHESIS An individual word or a sentence is synthesized from an external vocabulary. TONEÐGENERATE The CompactSPEECH generates single or DTMF tones. MSGÐOPEN The CompactSPEECH either reads, or writes, 32 bytes from, or to, the message memory, or sets the message Read/Write pointer on a 32-byte boundary. After receiving an asynchronous command, (see Section 2.4) such as P (Playback), R (Record), SW (Say Words) or GT (Generate Tone), the CompactSPEECH switches to the appropriate state and executes the command until it is completed, or an S (Stop) or PA (Pause) command is received from the microcontroller. When an asynchronous command execution is completed, the EVÐNORMALÐEND event is set, and the CompactSPEECH switches to the IDLE state. Section 2.2 provides a table which shows all the CompactSPEECH commands, the source states in which these commands are valid, and the result states which the CompactSPEECH enters as a result of the command. 2.5 TUNABLE PARAMETERS The CompactSPEECH processor can be adjusted to your system’s requirements. For this purpose the CompactSPEECH supports a set of tunable parameters, which are set to their default values after reset and can be later modified with the TUNE command. By tuning these parameters, you can control various aspects of the CompactSPEECH’s operation, such as silence compression, tone detection, noenergy detection, etc. Table 2-2 describes all the tunable parameters in detail. Section 2.15 describes the TUNE command. 2.6 MESSAGES The CompactSPEECH message manager supports a wide range of applications, which require different levels of DAM functionality. The message-organization scheme, and the message tag, support advanced memory-organization features such as multiple OutGoing Messages (OGMs), mailboxes, and the ability to distinguish between InComing Messages (ICMs) and OGMs. 2.4 COMMAND EXECUTION A CompactSPEECH command is represented by an 8-bit opcode. Some commands have parameters, and some have return values. Commands are either synchronous or asynchronous. 25 http://www.national.com 2.0 Software (Continued) A message is the basic unit on which most of the CompactSPEECH commands operate. A CompactSPEECH message, stored on a flash device, can be regarded as a computer file stored on a mass-storage device. A message is created with either the R or the ( ) command. When a message is created, it is assigned a time-and-day stamp and a message tag which can be read by the microcontroller. The R command takes voice samples from the codec, compresses them, and stores them in the message memory. When a message is created with the CMSG command the data to be recorded is provided by the microcontroller via the WMSG (Write Message) command and not via the codec. The data is transferred directly to the message memory. It is not compressed by the CompactSPEECH voice compression algorithm. WMSG, RMSG (Read Message) and SMSG (Seek Message) are a complete set of message-data access commands that can be used to store and read data to/from any location in the message memory (see Section 2.15 for more details about these commands). Using these commands, messages can be used by the microcontroller to implement such features as a Telephone Directory. A message can be played back (P command) and deleted (DM command). Redundant data (e.g., trailing tones or silence) can be removed from the message tail with the CMT (Cut Message Tail) command. The PA (Pause) and RES (Resume) commands, respectively, temporarily suspend the P and R commands, and then allow them to resume execution from where they were suspended. 2.7 SPEECH COMPRESSION The CompactSPEECH implements two speech compression algorithms. One algorithm, with 5.2 kbit/s compression rate, enables up to 14 – 16 minutes of recording on a 4-Mbit device, while the other uses a 7.3 kbit/s compression rate to support 10 – 12 minutes of recording. Both compression rates assume 10% silence. Before recording each message, the microcontroller can select one of the two algorithms by programming bit 15 of the message tag. During message playback the CompactSPEECH reads this bit and selects the appropriate speech decompression algorithm. IVS vocabularies can be prepared in either of the two compression formats using the IVS tool. All the messages in a single vocabulary must be recorded using the same algorithm. (See the IVS User’s Manual for further details). During speech synthesis, the CompactSPEECH automatically selects the appropriate speech decompression algorithm. 2.8 TONE AND NO-ENERGY DETECTION The CompactSPEECH detects DTMF, busy, and dial tones, and no-energy (VOX). This enables remote control operations and call progress. Detection is active throughout the operation of the CompactSPEECH. Detection can be configured using the SDET (Set Detectors Mask) command, which controls the reporting of the occurrence of tones, and the RDET (Reset Detectors) command which resets the detectors. DTMF DTMF detection may be reported at the starting point, ending point, or both. The report is made through the status word (for further details, see GSW command in Section 2.15). The DTMF detector performance, as measured on the line input using an NSV-AM265-DAA board, is summarized on following page (see Table 2-1). CURRENT MESSAGE Most message handling commands, e.g., P, DM, RMSG, operate on the current message. The GTM (Get Tagged Message) command selects the current message. Deleting the current message does not cause a different message to become current. The current message is undefined. If, however, you issue the GTM command to skip to the next message, the first message that is newer than the just deleted message is selected as the current message. ECHO CANCELLATION Echo cancellation is a technique used to improve the performance of DTMF tone detection during speech synthesis, tone generation, and OGM playback. For echo cancellation to work properly, AGC must not be active in parallel. Thus, to take advantage of echo cancellation, the microcontroller must control the AGC, i.e., disable the AGC during PLAY, SYNTHESIS and TONEÐGENERATE states and enable it again afterwards. If AGC cannot be disabled, do not use echo cancellation. The microcontroller should use the CFG command to activate/deactivate echo cancellation. (For further details, see Section 2.15.) Echo cancellation applies only to DTMF tones. Busy and dial-tone detection is not affected by this technique. This implies that the performance of the busy and dial-tone detector during message playback depends on the message being played. 2.6.1 Message Tag Each message has a 2-byte message tag which you can use to categorize messages, and implement such features as OutGoing Messages, mailboxes, and different handling of old and new messages. The most significant bit of the message tag (bit 15) is used to indicate the speech compression rate. The microcontroller should program it before recording (‘‘1’’ for 4.8 kbit/s, ‘‘0’’ for 6.6 kbit/s). The CompactSPEECH reads the bit before message playback to select the appropriate decompression algorithm. The GMT (Get Message Tag) and SMT commands may be used to handle message tags. Note: Message tag bits can only be cleared. Message tag bits are set only when a message is first created. This limitation is inherent in flash memories, which only allow bits to be changed from 1 to 0 (changing bits from 0 to 1 requires a special erasure procedure, see Section 1.2.5). However, the main reason for updating an existing tag is to mark a message as old, and this can be done by using one of the bits as a new/old indicator, setting it to 1 when a message is first created, and clearing it when necessary. http://www.national.com 26 2.0 Software (Continued) TABLE 2-1. DTMF Detector Performance PLAY RECORD/IDLE Detection Sensitivity (Note A) Performance Depends on The Message Being Played (Note B) b 40 dBm Accepted DTMF Length l 50 ms l 40 ms Frequency Tolerance g 1.5% g 1.5% S/N Ratio 12 dB 12 dB Minimum Spacing (Note C) l 50 ms l 45 ms Normal Twist 8 dB 8 dB Reverse Twist (Note D) 4 dB or 8 dB 4 dB or 8 dB Note A: Performance depends on the DAA design. Note B: Performance with echo canceler is 10 dB better than without echo canceler. For a silent message, Detection Sensivitiy is b 34 dBm with echo canceler. Note C: If the interval between two consecutive DTMF tones is s 20 ms, the two are detected as one long DTMF tone. If the interval between two consecutive DTMF tones is between 20 ms and 45 ms, separate detection is unpredictable. Note D: Determined by the DTMFÐREVÐTWIST tunable parameter value. OTHER DETECTORS Detection of busy and dial tones, and no-energy is controlled by tunable parameters. You should tune these parameters to fit your hardware. For more information see the TUNE command in Section 2.15. Dial and busy tone detectors work with a band-pass filter that llmits the frequency range in which tones can be detected to 0 Hz–1100 Hz. Its frequency response is illustrated in Figure 2-1 and the busy tone cadences in Figure 2-2 . to change the value of some tunable parameters in order to meet the standard specifications since the energy level of generated tones depends on the analog circuits being used. Tone generation is possible in both normal and speakerphone modes to support dialing while in speakerphone mode. TONE GENERATION The CompactSPEECH can generate DTMF tones and single-frequency tones from 300 Hz to 3000 Hz in increments of 100 Hz. CompactSPEECH tone generation conforms to the EIA-470-RS standard. Note, however, that you may have GENERATIONÐLEVEL parameter, to control the energy level at which these tones are generated. # Use the GT command to specify the DTMF tones, and the frequency at which single tones are generated. # Tune the DTMFÐTWISTÐLEVEL parameter to control the twist level of the generated DTMF tones. # Use the VC command, and tune the TONEÐ TL/EE/12868 – 26 FIGURE 2-1. Busy and Dial-Tone Band-Pass Filter Frequency Response TL/EE/12868 – 27 [E1 b E3] k 90 ms [S1 b S3] k 90 ms 90 k Ei k 1650 ms 65 k Si k 1250 ms FIGURE 2-2. Busy-Tone DetectorÐCadence Specification 27 http://www.national.com 2.0 Software (Continued) 2.9 FULL-DUPLEX SPEAKERPHONE The speakerphone feature enables the user to communicate through a telephone line, using the speaker and the microphone of the unit instead of the handset. The speakerphone processes signals that are transferred from the line to the speaker, and from the microphone to the line, and performs the necessary switching, attenuation and echo cancellation on the signals that are present on the line/ speaker. The CompactSPEECH speakerphone is very simple to use. It requires no special hardware, and no training for the echo cancelers. The gain control is fully digital, which eliminates the need for analog gain control hardware. Two types of echoes exist in a speakerphone. One is an electrical echo, which is a result of an imperfect impedance match between the 4 to 2-wire interface (hybrid), and the line impedance. This echo is relatively short term, and its transfer function varies quite slowly. The second echo is an acoustic echo returning from the speaker to the microphone. This echo is relatively long term, and its transfer function may vary quite quickly if anyone, or anything, moves in the room. Both echoes must be canceled to achieve a high-quality hands-free system. MUTE 2.9.1 Speakerphone Modes of Operation LISTEN Line is audible on the speaker, and the CompactSPEECH tone detectors are active. In this mode, dialing can be performed with the GT command, and call progress can be implemented, since the busy and dial tone detectors are active. The speakerphone generates silence to the line. The nearend speaker can hear the far-end listener but not vice versa. Tone detectors are not active. HOLD Interrupts from both codecs are stopped. Neither side can hear each other. RESTART The speakerphone re-initilizes itself to the last speakerphone mode (Full-duplex, transparent or Mute). This mode should be used to resume the speakerphone operation after Hold mode or when there is a significant change in the environmental conditions (e.g., parallel pickup) that may affect the speakerphone quality. TRANSPARENT The speakerphone works in full-duplex mode, but with no echo cancellation. Samples from the microphone are transferred to the line, and samples from the line are transferred to the speaker, with no processing. This mode should be used only for tuning and testing the system. FULL-DUPLEX The speakerphone works in full-duplex mode i.e., both parties can speak and hear each other at the same time. In this mode both the acoustic and electric echo controllers are active. The CompactSPEECH tone detectors are not active in this mode. http://www.national.com 28 2.0 Software (Continued) The following pseudo-code demonstrates how to make a call from speakerphone mode: while ( ) À EV 4 wait event ( ) case EV of: skpr button pressed: if (speakerphone on) À SSM 0 // Put CompactSPEECH in idle mode first digit 4 TRUE deactivate digit timeout event ( ) else SSM 1 // Put CompactSPEECH in full-duplex speakerphone mode digit pressed: if (first digit) À SSM 4 // Enter LISTEN mode first digit 4 FALSE Ó GT kdtmf of digitl // Dial the digit S // Stop.Note that after the S command // the CompactSPEECH is still in speakerphone mode enable digit timeout event() // To ‘guess‘ when dialing is completed. digit timeout event: SSM 1 // Dialing is completed, Go back to full-duplex mode deactivate digit timeout event() Ó AEC Acoustic Echo Controller. The part in the speakerphone algorithm that controls the echo in the send path. 2.9.2 Speakerphone Terminology SEND PATH The signal path from the microphone (near-end speaker) to the line (far-end listener). The microphone is the input port, and line-out is the output port of this signal path. EEC Electric Echo Controller. The part in the speakerphone algorithm that controls the echo in the receive path. RECEIVE PATH The signal path from the line (far-end speaker) to the loudspeaker (near-end listener). The line-in is the input port, and the speaker is the output port for this signal path. 29 http://www.national.com 2.0 Software (Continued) used in the sentences You have twenty messages and You have twenty two messages . To solve this problem, words that are pronounced differently should be recorded more than once, each in the correct pronunciation. Vocabulary When recording vocabulary words, there is a recording compromise between space and quality. On one hand, the words should be recorded and saved in a compressed form, and you would like to use the best voice compression for that purpose. On the other hand, the higher the compression rate, the worse the voice quality. Another issue to consider is the difference in voice quality between synthesized and recorded messages (e.g., between time-andday stamp and incoming messages (ICMs) in a DAM environment). It is more pleasant to the human ear to hear them both in the same quality. Vocabulary Sometimes compactness and high quality are access not enough. There should be a simple and flexible interface to access the vocabulary elements. Not only the vocabulary, but also the code to access it should be compact. When designing for a multi-lingual environment, there are more issues to consider. Each vocabulary should be able to handle language-specific structures and designed in a cooperative way with the other vocabularies so that the code to access each vocabulary is the same. When you use the command to synthesize the sentence Monday, 12:30 PM , you should not care in what language it is going to be played back. 2.10 SPEECH SYNTHESIS Speech synthesis is the technology that is used to create messages out of predefined words and phrases stored in a vocabulary. There are two kinds of predefined messages: fixed messages (e.g., voice menus in a voice-mail system) and programmable messages (e.g., time and day stamp, or the You have n messages announcement in a DAM). A vocabulary includes a set of predefined words and phrases, needed to synthesize messages in any language. Applications which support more than one language require a separate vocabulary for each language. 2.10.1 International Vocabulary Support (IVS) IVS is a mechanism by which the CompactSPEECH processor can use several vocabularies stored on an external storage device. IVS enables CompactSPEECH to synthesize messages with the same meaning, but in different languages, from separate vocabularies. Among IVS features: # Multiple vocabularies are stored on a single storage device. # Plug-and-play. The same microcontroller code is used for all languages. # Synthesized and recorded messages use the same voice compression algorithm to achieve equal quality. # Argumented sentences. (For example You have kn l messages .) # Auto-synthesized time-and-day stamp (driven by the CompactSPEECH’s clock). # Support for various language and sentence structures: Ð One versus many (for example: You have one message vs. You have two messages ). Ð None versus many (for example: You have no message vs. You have two messages ). Ð Number synthesis (English–Eighty vs. French– Quatre-vingt ). Ð Word order (English–Twenty one vs. German–Einundzwanzig ). Ð Days of the week (Monday through Sunday vs. Sunday through Saturday). 2.10.3 IVS Vocabulary Components This section describes the basic concept of an IVS vocabulary, its components, and the relationships between them. The basic An IVS vocabulary consists of words, senconcepts tences, and special codes that control the behavior of the algorithm which CompactSPEECH uses to synthesize sentences. The word The words are the basic units in the vocabtable ulary. You create synthesized sentences by combining words in the vocabulary. Each word in the vocabulary is given an index which identifies it in the word table. Note that, depending on the language structures and sentences that you wish to synthesize, you may need to record some words more than once in the vocabulary. For example, if you synthesize the sentences: you have twenty messages and you have twenty five messages, the word twenty is pronounced differently. They should, therefore, be defined as two different words. The number The number tables allow you to treat numtables bers differently depending on the context. Example 1: The number 1 can be announced as one as in message number one or as first as in first message . 2.10.2 Vocabulary Design There are several issues, sometimes conflicting, which must be addressed when designing a vocabulary. Vocabulary If memory space is not an issue, the vocabucontent lary could contain all the required sentences, each recorded separately. If memory space is a concern, the vocabulary must be compact; it should contain the minimum set of words and phrases required to synthesize all the sentences. The least memory is used when phrases and words that are common to more than one sentence are recorded only once, and the IVS tool is used to synthesize sentences out of them. A good combination of sentence quality and memory space is achieved if you take the ‘‘compact’’ approach, and extend it to solve pronunciation problems. For example, the word twenty is pronounced differently when http://www.national.com 30 2.0 Software (Continued) The sentence table Sentence 0 Example 2: The number 0 can be announced as no as in you have no messages or as oh as in monday, eight oh five am. A separate number table is required for each particular type of use. The number table contains the indices of the words in the vocabulary that are used to synthesize the number. Up to nine number tables can be included in a vocabulary. The sentence table describes the predefined sentences in the vocabulary. The purpose of this table is to make the microcontroller that drives the CompactSPEECH independent of the language being synthesized. For example, if the serial flash and/or ROM contain vocabularies in various languages, and the first sentence in each vocabulary means you have n messages , the microcontroller switches languages by issuing the following command to CompactSPEECH: SV kstorage Ðmedia l, day announcement. It assumes that the sentence is designed for system and message time and day announcement and has one argument which is interpreted as follows: 0 - System time will be announced 1 - The time and day of the current message will be announced. When the microcontroller sends the command: SAS O, 0 Example 1: The system time and day is announced. When the microcontroller sends the command: SAS O, 1 Example 2: The current message time and day stamp is announced. Control and option codes kvocabulary id l Ð Select a new vocabulary The microcontroller software is thus independent of the grammar of the language in use. The sentences consist of words, which are represented by their indices in the vocabulary. All sentences but one are user defined. The CompactSPEECH treats the first sentence in the sentence table, i.e., sentence 0, in a special way to support time and Figure 2-3 shows the interrelationship between the three types of tables: The list of word indices alone cannot provide the entire range of sentences that the CompactSPEECH can synthesize. IVS control and option codes are used as special instructions that control the behavior of the speech synthesis algorithm in the CompactSPEECH. For example, if the sentence should announce the time of day, the CompactSPEECH should be able to substitute the current day and time in the sentence. These control words do not represent recorded words, rather they instruct the CompactSPEECH to take special actions. TL/EE/12868 – 28 FIGURE 2-3. Relationship of IVS Tables 31 http://www.national.com 2.0 Software (Continued) are used to synthesize the required word or sentence. The typical vocabulary-creation process is as follows: 2.10.4 The IVS Tool The IVS tool includes two utilities: 1. Design the vocabulary. 2. Create the vocabulary files (as described in detail below). Use IVSTOOL for Windows 3.1 to simplify this process. 3. Record the words using any standard PC sound card and sound editing software, that can create .wav files. 4. Run the IVS compiler to compress the .wav files, and compile them and the vocabulary tables into an IVS vocabulary file. 5. Repeat steps 1 to 4 to create a separate IVS vocabulary for each language that you want to use. 6. Burn the IVS vocabulary files into a ROM (or serial flash) device. Use the INJ (Inject IVS) command to program the data into a serial flash device. 7. Once the vocabulary is in place, the speech synthesis commands of the CompactSPEECH can be used to synthesize sentences. Ð The DOS-based IVS Compiler Ð IVSTOOL for Windows. A Windows 3.1 based utility. The tools allow you to create vocabularies for the CompactSPEECH processor. They take you all the way from designing the vocabulary structure, through defining the vocabulary sentences, and recording the vocabulary words. The IVS The IVS compiler runs on MS-DOS (verCompiler sion 5.0 or later). It allows you to insert your own vocabulary, i.e., basic words and data used to create numbers and sentences, as directories and files in MS-DOS. The IVS compiler then outputs a binary file containing that vocabulary. This information can be burned into an EPROM or serial flash for use by the CompactSPEECH software. Voice Each IVS vocabulary can be compiled usCompression ing either 5.2 kbit/s or 7.3 kbit/s voice compression algorithm. The user defines the compression rate before compilation. The CompactSPEECH automatically selects the required voice decompression algorithm when the SV command is used to select the active vocabulary. The Graphical The IVS package includes a Windows utiliUser Interface ty that assists the vocabulary designer to (GUI) synthesize sentences. With this utility, you can both compose sentences and listen to them. Figure 2-4 shows the vocabulary-creation process for a single table on a ROM or serial flash device. 2.11 INITIALIZATION Use the following procedures to initialize the CompactSPEECH processor: NORMAL INITIALIZATION 1. Reset the CompactSPEECH by activating the RESET signal. (See Section 1.2.1.) 2. Issue a CFG (Configure CompactSPEECH) command to change the configuration according to your environment. 3. Issue an INIT (Initialize System) command to initialize the CompactSPEECH firmware. 4. Issue a series of TUNE commands to adjust the CompactSPEECH to the requirements of your system. 2.12 MICROWIRE SERIAL INTERFACE MICROWIRE/PLUSTM is a synchronous serial communication protocol, originally implemented in National Semiconductor’s COPSTM and HPCTM families of microcontrollers to minimize the number of connections, and thus the cost, of communicating with peripherals. 2.10.5 How to Use the IVS Tool With the CompactSPEECH The IVS tool creates IVS vocabularies, and stores them as a binary file. This file is burnt into a ROM device or programmed into a serial flash device using the INJ command. The CompactSPEECH SV command is used to select the required vocabulary. The SW, SO, SS and SAS commands TL/EE/12868 – 29 FIGURE 2-4. Creation of an IVS Vocabulary http://www.national.com 32 2.0 Software (Continued) MWRDY The CompactSPEECH MICROWIRE interface implements the MICROWIRE/PLUS interface in slave mode, with an additional ready signal. It enables a microcontroller to interface efficiently with the CompactSPEECH application. The microcontroller is the protocol master, and provides the clock for the protocol. The CompactSPEECH supports clock rates of up to 400 kHz. This transfer rate refers to the bit transfer; the actual throughput is slower due to byte processing by the CompactSPEECH and the microcontroller. Communication is handled in bursts of eight bits (one byte). In each burst the CompactSPEECH is able to receive and transmit eight bits of data. After eight bits have been transferred, an internal interrupt is issued for the CompactSPEECH to process the byte, or to prepare another byte for sending. In parallel, the CompactSPEECH sets MWRDY to 1, to signal the microcontroller that it is busy with the byte processing. Another byte can be transferred only when the MWRDY signal is cleared to 0 by the CompactSPEECH. When the CompactSPEECH transmits data, it expects to receive the value 0xAA before each transmitted byte. The CompactSPEECH reports any status change by clearing the MWRQST signal to 0. If a parameter of a CompactSPEECH command is bigger than one byte, the microcontroller should transmit the Most Significant Byte (MSB) first. If a return value is bigger than one byte, the CompactSPEECH transmits the MSB first. MICROWIRE Ready. When active (0), this signal indicates that the CompactSPEECH is ready to transfer (receive or transmit) another byte of data. This signal is set to 1 by the CompactSPEECH after each byte transfer has been completed. It remains 1, while the CompactSPEECH is busy reading the byte, writing the next byte, or executing the received command (after the last parameter has been received). MWRDY is cleared to 0 after reset. For proper operation after a hardware reset, this signal should be pulled up. MWRQST MICROWIRE Request. When active (0), this signal indicates that new status information is available. MWRQST is deactivated (set to 1), after the CompactSPEECH receives a GSW (Get Status Word) command from the microcontroller. After reset, this signal is active (0) to indicate that a reset occurred. MWRQST, unlike all the signals of the communication protocol, is an asynchronous line that is controlled by the CompactSPEECH firmware. 2.13.1 Signal Use in the Interface Protocol After reset, both MWRQST and MWRDY are cleared to 0. The MWRQST signal is activated to indicate that a reset occurred. The EVÐRESET bit in the status register is used to indicate a reset condition. The GSW command should be issued after reset to verify that the EVÐRESET event occurred, and to deactivate the MWRQST signal. While the MWCS signal is active (0), the CompactSPEECH reads data from MWDIN on every rising edge of MWCLK. CompactSPEECH also writes every bit back to MWDOUT. This bit is either the same bit which was read from MWDIN (in this case it is written back as a synchronization echo after some propagation delay), or it is a bit of a value the CompactSPEECH transmits to the microcontroller (in this case it is written on every falling edge of the clock). When a command has more than one parameter/return-value, the parameters/return-values are transmitted in the order of appearance. If a parameter/return-value is more than one byte long, the bytes are transmitted from the most significant to the least significant. The MWRDY signal is used as follows: 2.13 SIGNAL DESCRIPTION The following signals are used for the interface protocol. Input and output are relative to the CompactSPEECH. INPUT SIGNALS MWDIN MICROWIRE Data In. Used for input only, for transferring data from the microcontroller to the CompactSPEECH. MWCLK This signal serves as the synchronization clock during communication. One bit of data is transferred on every clock cycle. The input data is available on MWDIN, and is latched on the clock rising edge. The transmitted data is output on MWDOUT on the clock falling edge. The signal should remain low when switching MWCS. MWCS MICROWIRE Chip Select. The MWCS signal is cleared to 0 to indicate that the CompactSPEECH is being accessed. Setting MWCS to 1 causes the CompactSPEECH to start driving MWDOUT with bit 7 of the transmitted value. Setting the MWCS signal resets the transfer-bit counter of the protocol, so the signal can be used to synchronize between the CompactSPEECH and the microcontroller. To prevent false detection of access to the CompactSPEECH due to spikes on the MWCLK signal, use this chip select signal, and toggle the MWCLK input signal only when the CompactSPEECH is accessed. 1. Active (0) MWRDY signals the microcontroller that the last eight bits of data transferred to/from the voice module were accepted and processed (see below). 2. The MWRDY signal is deactivated (set to 1 by the CompactSPEECH) after 8 bits of data were transferred to/from the CompactSPEECH. The bit is set following the falling edge of the eighth MWCLK clock-cycle. 3. The MWRDY signal is activated (cleared to 0) by the CompactSPEECH when it is ready to receive the first parameter byte (if there are any parameters) and so on till the last byte of parameters is transferred. An active MWRDY signal after the last byte of parameters indicates that the command was parsed and (if possible) executed. If that command has a return value, the microcontroller must read the value before issuing a new command. OUTPUT SIGNALS MWDOUT MICROWIRE Data Out. Used for output only, for transferring data from the CompactSPEECH to the microcontroller. When the CompactSPEECH receives data it is echoed back to the microcontroller on this signal, unless the received data is 0xAA. In this case, the CompactSPEECH echoes a command’s return value. 33 http://www.national.com 2.0 Software (Continued) The CompactSPEECH transmits a byte as an echo when it receives the value 0xAA from the microprocessor. Upon detection of an error the CompactSPEECH activates the MWRQST signal, and sets the ERRÐCOMM bit in the error word. 4. When a return value is transmitted, the MWRDY signal is deactivated after every byte, and activated again when the CompactSPEECH is ready to send another byte, or to receive a new command. The MWRDY signal is activated (cleared to 0) after reset, and after a protocol time-out. (See Section 2.13.2.) The MWRQST signal is used as follows: 2.14 THE MASTER MICROWIRE INTERFACE The CompactSPEECH’s Master MICROWIRE controller implements the MICROWIRE/PLUS interface in master mode. It enables the CompactSPEECH to control flash devices. Several devices may share the Master MICROWIRE channel. This can be implemented by connecting device selection signals to general purpose output ports. 1. The MWRQST signal is activated (cleared to 0), when the status word is changed. 2. The MWRQST signal remains active (0), until the CompactSPEECH receives a GSW command. Figure 2-4 illustrates the sequence of activities during a MICROWIRE data transfer. 2.14.1 Master MICROWIRE Data Transfer 2.13.2 Interface Protocol Error Handling The Signals The Master MICROWIRE controller’s signals are the Master MICROWIRE serial CLocK (MMCLK), the Master MICROWIRE serial Data OUT (MMDOUT) signal and the Master MICROWIRE serial Data In (MMDIN) signal. The Master MICROWIRE controller can handle up to four flash devices. The CompactSPEECH uses the signals, CS0 – CS3, as required for the number of devices in use, as device chip-select signals. Interface Protocol Time-Outs Depending on the CompactSPEECH’s state, if more than 20 ms – 30 ms elapse between two consecutive byte transmissions, or two byte receptions, within the same command or return value, after the MWRDY signal is asserted, a timeout event occurs, and the CompactSPEECH responds as follows: 1. Sets the error bit in the status word to 1. 2. Sets the EVÐTIMEOUT bit in the error word to 1. 3. Activates the MWRQST signal (clears it to 0). The Clock for Master MICROWIRE Data Transfer Before data can be transferred, the transfer rate must be determined and set. The rate of data transfer on the Master MICROWIRE is determined by the Master MICROWIRE serial CLocK (MMCLK) signal. This rate is the same as the Codec CLocK (CCLK) signal. As long as the Master MICROWIRE is transferring data, the codec interface must be enabled and its sampling rate should not be changed. 4. Activates the MWRDY signal (clears it to 0). 5. Waits for a new command. (After a time-out occurs, the microcontroller must wait at least four milliseconds before issuing the next command.) Echo Mechanism The CompactSPEECH echoes back to the microcontroller all the bits received by the CompactSPEECH. Upon detection of an error in the echo, the microcontroller should stop the protocol clock, which eventually causes a time-out error (i.e., ERRÐTIMEOUT bit is set in the error word). Note: When a command has a return value, the CompactSPEECH transmits bytes of the return value instead of the echo value. TL/EE/12868 – 30 FIGURE 2-4. Sequence of Activities during a MICROWIRE Byte Transfer http://www.national.com 34 2.0 Software (Continued) TL/EE/12868 – 31 FIGURE 2-5. Master MICROWIRE Data Transfer Example 2.15 COMMAND DESCRIPTION The commands are listed in alphabetical order. The execution time for all commands, when specified, includes the time required for the microcontroller to retrieve the return value, where appropriate. The execution time does not include the protocol timing overhead, i.e., the execution times are measured from the moment that the command is detected as valid until the command is fully executed. CCIO 01 Byte sequence: 34 01 CompactSPEECH 34 01 Description: loopback enable. Input is from the line codec. Output goes to both codecs. CFG Configure CompactSPEECH configÐvalue Configures the CompactSPEECH in various hardware environments. It should be used to change the default CompactSPEECH configuration. The configÐvalue parameter is encoded as follows: Note: Each command description includes an example application of the command. The examples show the opcode issued by the microcontroller, and the response returned by the CompactSPEECH. For commands which require a return value from the CompactSPEECH, the start of the return value is indicated by a thick vertical line. CCIO Microcontroller Configure Codec I/O config-value Codec configuration. 0: short-frame format (default) 1: long-frame format. (Guaranteed by design, but not tested.) Bit 1 Reserved. Bit 2 Echo cancellation control. 0: Echo cancellation off (default) 1: Echo cancellation is on during playback. Echo cancellation improves the performance of DTMF detection during playback. Echo cancellation can be turned on only with a system that can disable AGC during playback. A system with AGC that cannot be controlled (i.e., enabled/disabled) by the microcontroller must not turn on this bit. Bit 3 ReservedÐmust be cleared to 0. Bits 4 – 5 ReservedÐmust be set to 10. Bits 6 – 7 ReservedÐmust be cleared to 00. Bits 8 – 10 Number of installed flash devices. Valid range 1 .. 4 flash devices. Default is 1. Bits 11 – 15 ReservedÐMust be cleared to 0. Bit 0 Configures the voice samples paths in various states. It should be used to change the default CompactSPEECH configuration. The config-value parameter is encoded as follows: Loopback control. 0: Loopback disable (default) 1: Loopback enabled. During RECORD state, the input samples are echoed back unchanged (i.e., no volume control) to the codec. Bit 1 Codec input control 0: Input is received via the line codec i.e., the codec which is controlled via CFS0. (default) 1: Input is received via the speakerphone codec i.e., the codec which is controlled via CFS1. Bit 2 – 3 Codec output control. 00: In PLAY, IDLE, SYNTHESIS and TONEÐ GENERATE, output is to both codecs. In RECORD mode, output is to the non-input codec. Volume control is not supported in RECORD mode. If the loopback control bit is set, output is to both codecs (default). 01: Output in all states is to the line codec 10: Output in all states is to the speakerphone codec. 11: Output in all states is to both codecs. Bits 4 – 7 Reserved. Bit 0 Note: The CompactSPEECH automatically detects the type of flash device in use, i.e., NM29A040 or NM29A080. 35 http://www.national.com 2.0 Software (Continued) Example CVOC CFG 0324 Checks (checksum) if the IVS data was correctly programmed to the ROM or flash device. If the vocabulary data is correct the return value is 1. Otherwise the return value is 0. If the current vocabulary is undefined, ERRÐINVALID is reported. Example Byte sequence: Description: Microcontroller 01 03 24 CompactSPEECH 01 03 24 Configure the CompactSPEECH to work with: Codec that supports short-frame format. Three, NM29A040, flash devices. Echo cancellation on. CVOC CMSG Create Message tag numÐofÐblocks Creates a new message with a message tag tag , allocates numÐofÐblocks 4 kbytes blocks for it, and sets the message pointer to the beginning of the message data. The command switches the CompactSPEECH to the MSGÐ OPEN state. The memory space available for the message data is computed as follows: (127 x numÐofÐblocks b 1) X 32 bytes. Once a message is open i.e., the CompactSPEECH is in the MSGÐOPEN state, the message pointer can be set to any position on a page (32 bytes) boundary within the message with the SMSG command. The message contents can be modified with the WMSG command, and read with the RMSG command. As long as the message is not closed by the S command, its length can be extended with the WMSG command. Once the message is closed, its length can not be extended. The microcontroller must issue an S command to close the message and switch the CompactSPEECH to the idle state. If the memory is full, EVÐMEMFULL is set in the status word and no message is created. If the memory is not full, but there is not enough memory and the CompactSPEECH can not allocate the required memory space for the message, EVÐMEMLOW is set in the status word and no message is created. Example Byte sequence: Description: Microcontroller Byte sequence: Description: 0A Delete current message. DMS Delete Messages tagÐref tagÐmask Deletes all messages whose message tags match the tagÐ ref parameter. Only bits set in tagÐmask are compared i.e., a match is considered successful if: message tag and tagÐtask e tagÐref and tagÐmask 33 01 01 00 01 where and is a bitwise AND operation. After the command completes execution, the current message is undefined. Use the GTM command to select a message to be the current message. The memory space released by the deleted message is immediately available for recording new messages. Create a new message, and allocate 4 kbytes for its data. Example CMT 02BC http://www.national.com Microcontroller CompactSPEECH 0A Note: If timeÐlength is longer than the total duration of the message, the EVÐNORMALÐEND event is set in the status word, and the message becomes empty (i.e., message length is 0), but is not deleted. Use the DM (Delete Message), or DMS (Delete Messages), command to delete the message. Description: Check the current vocabulary. The CompactSPEECH responds that the vocabulary is OK. DM CompactSPEECH 33 01 01 00 01 Microcontroller 2B AA DM Delete Message Deletes the current message. Deleting a message clears its message tag. Deleting the current message does not cause a different message to become current. The current message is undefined. If, for example, you issue the GTM command to skip to the next message, the first message that is newer than the just deleted message is selected as the current message. The memory space released by the deleted message is immediately available for recording new messages. Example CMT Cut Message Tail timeÐlength Cut timeÐlength units, each of 10 ms duration, off the end of the current message. The maximum value of timeÐ length is 6550. Cut-time accuracy is g 0.14 sec. Byte sequence: Microcontroller CompactSPEECH 2B 01 Description: CMSG 0101 01 Byte sequence: Check Vocabulary 26 02 BC CompactSPEECH 26 02 BC Cut the last seven seconds of the current message. 36 2.0 Software (Continued) GCFG Get Configuration Value Returns a sequence of two bytes with the following information: Bits 0 – 7 Magic number, which specifies the CompactSPEECH firmware version. Bits 8 – 9 Memory type. 00: Reserved 01: Reserved 10: Serial Flash 11: Reserved The command should be used together with the CFG and INIT commands during CompactSPEECH initialization. See the CFG command for more details, and an example of a typical initialization sequence. Example 4 3 2 1 0 Res 5 GEW Byte sequence: Microcontroller 1B AA AA CompactSPEECH 1B 00 02 GCFG Microcontroller Description: 02 AA AA CompactSPEECH 02 02 01 Description: 6 The bits of the error word are used as follows: ERRÐOPCODE Illegal opcode. The command opcode is not recognized by the CompactSPEECH. ERRÐCOMMAND Illegal command sequence. The command is not legal in the current state. ERRÐPARAM Illegal parameter. The value of the parameter is out of range, or is not appropriate for the command. ERRÐCOMM Microcontroller MICROWIRE communication error. ERRÐTIMEOUT Time-out error. Depending on the CompactSPEECH’s state, more than 20 ms to 30 ms elapsed between the arrival of two consecutive bytes (for commands that have parameters). ERRÐINVALID Command cannot be performed in current context. Example Note: The description of the tag is an example only. All bits of the tag are user-definable. Byte sequence: 7 ERRÐOPCODE 8 ERRÐCOMMAND 15 –9 ERRÐPARAM Delete all old incoming messages from mailbox Number 2 in a system where the message tag is encoded as follows: Bits 0–2: mailbox ID 8 mailboxes indexed: 0 to 7 Bit 3: new/old message indicator 0: Message is old 1: Message is new Bits 4–5: message type 00: ICM/memo 01: OGM 10: Call transfer message Bits 6–15: not used Res Description: ERRÐCOMM 0B FF C2 00 3F ERRÐTIMEOUT Microcontroller CompactSPEECH 0B FF C2 00 3F ERRÐINVALID Byte sequence: Res DMS FFC2 003F Res If errors ERRÐCOMMAND or ERRÐPARAM occur during the execution of a command that has a return value, the return value is undefined. The microcontroller must still read the return value, to ensure proper synchronization. Example Get the CompactSPEECH magic number. The CompactSPEECH responds that it is Version 1, with Serial Flash. GEW Returns the 2-byte error word. Get the CompactSPEECH error word (typically sent after GSW when EVÐ ERROR is reported in the status word). The CompactSPEECH responds: ERRÐOPCODE: GI Get Information item Returns the 16-bit value specified by item from one of the internal registers of the CompactSPEECH. Get Error Word item may be one of the following: 0: The duration of the last detected DTMF tone, in 10 ms units. The return value is meaningful only if DTMF detection is enabled, and the status word shows that a DTMF tone was detected. THE ERROR WORD The 16-bit error word indicates errors that occurred during execution of the last command. If an error is detected, the command is not processed; the EVÐERROR bit in the status word is set to 1, and the MWRQST signal is activated (set to low). The GEW command reads the error word. The error word is cleared during reset and after execution of the GEW command. 37 http://www.national.com 2.0 Software (Continued) 1. The duration of the last detected busy tone in 10 ms units. 2. The energy level of the samples in the last 10 ms. 3. The energy level of the samples, in the last 10 ms, that are in the frequency range described in Figure 2-1. The return value is meaningful only if one of the tone detectors is enabled (bits 0,1 of the detectors mask; see the description of SDET command). The return value is unpredictable for any other value of item . Example GMS 0 Byte sequence: Description: 25 00 AA AA CompactSPEECH 25 00 00 06 Description: Return the remaining recording time. The CompactSPEECH responds: 320 seconds GMT Get Message Tag Returns the 16-bit tag associated with the current message. If the current message is undefined, ERRÐVALID is reported. Example GI 0 Microcontroller 12 00 AA AA CompactSPEECH 12 00 01 40 Example Byte sequence: Microcontroller Get the duration of the last detected DTMF tone. The CompactSPEECH responds: 60 ms GMT Byte sequence: Microcontroller 04 AA AA CompactSPEECH 04 00 0E GL Get Length Returns the length of the current message in multiples of 32 bytes. The returned value includes the message directory information (64 bytes for the first block and 32 bytes for every other block), message data, and the entire last block of the message, even if the message occupies only a portion of the last block. Since a flash block includes 4096 bytes, the returned length may be bigger than the actual message length by up to 4095 bytes. The minimum length of a message is one block, i.e., an empty message occupies 4 kbytes (the message length is: 4096/32 e 128). Example Description: GNM Get Number of Messages tagÐref tagÐmask Returns the number of messages whose message tags match the tagÐref parameter. Only bits set in tagÐmask are compared, i.e., a match is considered successful if: message tag and tagÐmask e tagÐref and tagÐmask where and is a bitwise AND operation. The tagÐref and tagÐmask parameters are each two bytes; the return value is also 2-bytes long. For example, if tagÐref e 4216, and tagÐmask e 3F16, the number of existing old messages whose user-defined tag is 2 is returned. See Section 2.6.1 for a description of message-tag encoding. If tagÐmask e 0, the total number of all existing messages is returned, regardless of the tagÐref value. Example GL Byte sequence: Microcontroller 19 AA AA CompactSPEECH 19 02 00 Description: Get the length of the current message. The CompactSPEECH responds: 512 i.e., the message occupies 16384 (512 * 32) bytes GNM FFFE 0003 GMS Get Memory Status type Returns the estimated total remaining recording time in seconds as a 16-bit unsigned integer. This estimate assumes 5.2 kbit/s with no silence compression: a real recording may be longer, according to the amount of silence detected and compressed. The return value is dependent on the value of the type parameter as follows: 0: The remaining recording time is returned. 1: Returns 0. (For compatibility only.) 2: Same as 0. (For compatibility only.) The return value is unpredictable for any other value of type . http://www.national.com Get the current message tag. In a system where the message tag is encoded as described in the DMS command, the CompactSPEECH return value indicates that the message is a new ICM in mailbox Number 6. Byte sequence: Microcontroller 11 FF FE 00 03 AA AA CompactSPEECH 11 FF FE 00 03 00 05 Description: 38 Get the number of messages which have bit 0 cleared, and bit 1 set, in their message tags. CompactSPEECH responds that there are five messages which satisfy the request. 2.0 Software (Continued) GSW Returns the 2-byte status word. EVÐVOX Get Status Word 1 e a period of silence (no energy) was detected on the telephone line during recording. (See VOXÐTIMEÐ COUNT in Table 2-2.) THE STATUS WORD The CompactSPEECH processor has a 16-bit status word to indicate events that occur during normal operation. The CompactSPEECH asserts the MWRQST signal (clears to 0), to indicate a change in the status word. This signal remains active until the CompactSPEECH receives a GSW command. The status word is cleared during reset, and by the GSW command. 30 EVÐDTMF 1 e Started detection of a DTMF tone. Example EVÐDTMFÐDIGIT 4 EVÐDTMFÐEND 5 EVÐNORMALÐEND 6 EVÐMEMFULL 7 EVÐERROR 8 EVÐBUSY 9 EVÐDIALTONE 10 EVÐMEMLOW 12 11 Res 13 EVÐVOX 14 EVÐRESET EVÐDTMF 15 EVÐRESET When the CompactSPEECH completes its power-upÐsequence and enters the RESET state, this bit is set to 1, and the MWRQST signal is activated (cleared to 0). Normally, this bit changes to 0 after performing the INIT command. If this bit is set during normal operation of the CompactSPEECH, it indicates an internal CompactSPEECH error. The microcontroIler can recover from such an error by re-initializing the system. GSW Byte sequence: Microcontroller 14 AA AA CompactSPEECH 14 00 40 Description: The bits in the status word are used as follows: EVÐDTMFÐDIGIT DTMF digit. A value indicating a detected DTMF digit. (See the description of DTMF code in the GT command.) EVÐDTMFÐEND 1 e Ended detection of a DTMF tone. The detected digit is held in EVÐDTMFÐDIGIT. Get the CompactSPEECH Status Word (typically sent after the MMRQST signal is asserted by the CompactSPEECH which indicates a change in the status word). The CompactSPEECH responds that the memory is full. GT Generate Tone tone Generates the tone specified by the 1-byte tone parameter, until an S command is received. Specify the tone by setting the bits of tone as follows: EVÐNORMALÐEND 1 e Normal completion of operation, e.g., end of message playback. Bit 0 Bits 1 – 4 EVÐMEMFULL 1 e Memory is full. EVÐERROR 1 e Error detected in the last command. You must issue the GEW command to return the error code and clear the error condition. 1 DTMF code. Where the DTMF code is encoded as follows: Value (Hex) 0 to 9 A B C D E F EVÐBUSY 1 e Busy tone detected. Use this indicator for call progress and line disconnection. EVÐMEMLOW 1 e Not enough memory. (See CMSG command for futher detail.) DTMF Digit 0 to 9 A * Ý B C D EVÐDIALTONE 1 e Dial tone detected. Use this indicator for call progress and line disconnection. 39 http://www.national.com 2.0 Software (Continued) Bits 5 – 7 Bit 0 Bits 1 – 5 Bits 6, 7 0 Get Tagged Message tagÐref tagÐmask dir Selects the current message, according to instructions in dir, to be the first, nth next or nth previous message which complies with the equation: message tag and tagÐmask e tagÐref and tagÐmask where and is a bitwise AND operation. dir is one of the following: 0: Selects the first (oldest) message. 128: Selects the last (newest) message. n: Selects the nth next message starting from the current message. -n: Selects the nth previous message starting from the current message. GTM To generate a single-frequency tone encode the bits as follows: 0 3 – 30 The value in bits 1–5 is multiplied by 100 to generate the required frequency (300 Hz–3000 Hz). 0 The CompactSPEECH does not check for the validity of the tone specification. Invalid specification yields unpredictable results. Example GT 0D20 Byte sequence: Microcontroller Note: To select the nth message with a given tag to be the current message you must first select the first message that complies with the above equation, and then issue another GTM command with n b 1 as a parameter, to skip to the nth message. 0D 20 CompactSPEECH 0D 20 Description: If a message is found, it becomes the current message and 1 (TRUE) is returned. If no message is found, the current message remains unchanged and 0 (FALSE) is returned. Generate a single-frequency 1600 Hz tone. If dir is not 0 and the current message is undefined, the return value is unpredictable. After the command execution the current message may either remain undefined or change to any existing message. The only exception is when the GTM command is executed just after the DM command. (See the DM command description for further detail.) GTD Get Time and Day timeÐdayÐoption Returns the time and day as a 2-byte value. timeÐdayÐ option may be one of the following: 0: Get the system time and day. 1: Get the current message time-and-day stamp. Any other timeÐdayÐoption returns the time-and-day stamp of the current message. Time of day is encoded as follows: Bits 0 – 2 Day of the week (1 through 7). Bits 3 – 7 Hour of the day (0 through 23). Bits 8 – 13 Minute of the hour (0 through 59). Bits 14 – 15 00: The time was not set before the current message was recorded. 11: The time was set, i.e., the SETD (Set Time of Day) command was executed. To access the nth message, when n l 127, a sequence of GTM commands is required. Note: If the current message is undefined, and timeÐdayÐoption is 1, an ERRÐINVALID error is reported. Example GTD 1 Byte sequence: Microcontroller 0E 01 AA AA CompactSPEECH 0E 01 E8 29 Description: Get the current message time-and-day stamp. The CompactSPEECH responds that the message was created on the first day of the week at 5:40 AM. The return value also indicates that the SETD command was used to set the system time and day before the message was recorded. Note: If the SAS command is used to announce the time-and-day stamp, ‘‘Monday’’ is announced as the first day of the week. For an external vocabulary, the announcement depends on the vocabulary definition. (See the IVS User’s Manual for more details.) http://www.national.com 40 2.0 Software (Continued) Example GTM FFCE 003F 0 Byte sequence: Microcontroller 09 FF CE 00 3F 00 AA CompactSPEECH 09 FF CE 00 3F 00 01 Description: Select the oldest of the new ICMs, in mailbox number 6, to be the current message. For a system where the message tag is encoded as described in the example for the DMS command. The CompactSPEECH return value indicates that there is such a message. The following pseudo-code demonstrates how to play all new ICMs. The messages are marked after being played. In mailbox number 6: Return val e GTM (FFCE, 003F, 1) While (ReturnVal 44 TRUE) Begin P( ) /* Play */ Message tag 4 GMT( ) /* get message tag */ SMT(FFF7) /* Mark the message as ’old’ */ GTM(FFCE, 003F, 1) /* Get next with same tag */ End If there is not enough memory space for the vocabulary data, ERRÐPARAM is set in the error word, and execution stops. Flash blocks that include IVS data cannot be used for recording, even if only one byte of the block contains IVS data (e.g., if the vocabulary size is 4k a 100 bytes, two blocks of the flash are not available for message recording). Example INIT Initialize System Execute this command after the CompactSPEECH has been configured (see CFG and GCFG commands). Performs a soft reset of the CompactSPEECH as follows: # Initializes the message directory information. Messages are not deleted. To delete the messages, use the DM and DMS commands. # Sets the detectors mask to 0. # Sets the volume level that is controlled by the VC com- INJ 128 Data mand, to 0. Byte sequence: # Sets the playback speed to normal (0). # Switches to the IDLE state. # Initializes the tone detectors. Description: Vocabulary Data Inject 128 bytes of vocabulary data. MR Memory Reset Erases all good flash blocks and initializes the CompactSPEECH (i.e., does exactly what the INIT command does). Bad blocks, and blocks which are used for IVS vocabularies, are not erased. INIT Microcontroller 29 00 00 00 80 CompactSPEECH 29 00 00 00 80 Echo of Data Description: The current message is undefined after INIT execution. The tunable parameters are not affected by this command. They are set to their default values only during RESET. Example Byte sequence: Microcontroller 13 Note: The command erases all messages and should be used with care. CompactSPEECH 13 Example Initialize the CompactSPEECH. MR INJ Inject IVS data n byte1 . . . byten Injects vocabulary data of size n bytes to good flash blocks. This command programs flash devices, on a production line, with IVS vocabulary data. It is optimized for speed; all CompactSPEECH detectors are suspended during execution of the command. Use the CVOC command to check whether programming was successful. Byte sequence: Microcontroller 2A CompactSPEECH 2A Description: Erase all Serial Flash blocks. P Playback Begins playback of the current message. The CompactSPEECH state changes to PLAY. When playback is complete, the CompactSPEECH sets the EVÐNORMALÐEND bit in the status word, and activates (clears to 0) the MWRQST signal. Playback can be paused with the PA command, and can be resumed later with the RES command. If the current message is undefined, ERRÐINVALID is reported. 41 http://www.national.com 2.0 Software (Continued) Example The 1-byte detectorsÐresetÐmask is encoded as follows: P Bit 0 Reset the busy and dial tone detectors. Bits 1 – 4 Bit 5 Bit 6 Bit 7 Example Reserved. Must be cleared to 0. Reset the no energy (VOX) detector. Reset the DTMF detector. Reserved. Must be cleared to 0. Byte sequence: Microcontroller 03 CompactSPEECH 03 Description: Play the current message. PA Pause Suspends the execution of the current R, P, GT, SO, SW, SS or SAS command. The PA command does not change the state of the CompactSPEECH; execution can be resumed with the RES command. RDET 20 Byte sequence: Microcontroller 2C 20 CompactSPEECH 2C 20 Note: DTMF and tone detectors remain active during Pause. Description: Reset the VOX detector. Example CompactSPEECH 1C RES Resume Resumes the activity that was suspended by the PA, SF or SB commands. Example Suspend playback of current message. RES PA Byte sequence: Description: Microcontroller 1C PDM Go To Power-down Mode Switches the CompactSPEECH to power-down mode (see Section 1.2.3 for details). Sending any command while in power-down mode resets the CompactSPEECH detectors, and returns the CompactSPEECH to normal operation mode. Example Byte sequence: Microcontroller Description: 1A Put the CompactSPEECH in power-down mode. R Record tag Records a new message with message tag tag. The CompactSPEECH state changes to RECORD. The R command continues execution until stopped by the S command. Recording can be paused with the PA command, and can be resumed later with the RES command. If the memory becomes full, recording stops and EVÐMEMFULL is set in the status word. Example R 000E Byte sequence: RMSG Data Microcontroller 0C 00 0E Byte sequence: CompactSPEECH 0C 00 0E Description: Microcontroller 32 AA AA CompactSPEECH 32 Record a new ICM in mailbox Number 6 in a system where the message tag is encoded as described in the example of the DMS command. Description: ... 32 bytes of data Read 32 bytes from the current message memory. RRAM Read Memory Exists for compatibility only. Use RMSG instead. RDET Reset Detectors detectorsÐresetÐmask Resets the CompactSPEECH tone and energy detectors according to the value of the detectorsÐresetÐmask parameter. A bit set to 1 in the mask, resets the corresponding detector. A bit cleared to 0 is ignored. http://www.national.com Resume playback which was suspended by either the PA, SF or SB command. RMSG Read Message data Returns 32 bytes of data from the current position of the message pointer, and advances the message pointer by 32 bytes. If the CompactSPEECH was in the IDLE state, the command opens the current message, switches the CompactSPEECH to the MSGÐOPEN state, sets the message pointer to the beginning of the message data, and returns the 32 bytes of data . The microcontroller must issue an S command to close the message, and switch the CompactSPEECH to the IDLE state. If the current message is undefined, ERRÐINVALID is reported. Trying to read beyond the end of the message will set the EVÐNORMALÐEND event and the CompactSPEECH will switch to the IDLE state. In this case, the return value is undefined and should be ignored. Example CompactSPEECH 1A Description: 1D CompactSPEECH 1D PDM Byte sequence: Microcontroller S Stop Stops execution of the current command and switches the CompactSpeech to the IDLE state. S may be used to stop the execution of all asynchronous commands. 42 2.0 Software (Continued) Example Set Detectors Mask detectorsÐmask Controls the reporting of detection for tones and VOX according to the value of the detectorsÐmask parameter. A bit set to 1 in the mask, enables the reporting of the corresponding detector. A bit cleared to 0 disables the reporting. Disabling reporting of a detector does not stop or reset the detector. The 1-byte detectorsÐmask is encoded as follows: SDET S Byte sequence: Microcontroller 00 CompactSPEECH 00 Description: Stop current activity (e.g., playback, recording) and put the CompactSPEECH in IDLE state. Bit 0 Report detection of a busy tone. Bit 1 Report detection of a dial tone. Bits 2 – 4 Reserved. Must be cleared to 0. Bit 5 Report detection of no energy (VOX) on the line. (The VOX attributes are specified with the tunable parameters VOXÐTIMEÐCOUNT and VOXÐ ENERGYÐLEVEL.) Bit 6 Report the ending of a detected DTMF. Bit 7 Report the start of a detected DTMF (up to 40 ms after detection start). Example SAS Say Argumented Sentence sentenceÐn arg Announces sentence number sentenceÐn of the currently selected vocabulary, and passes arg to it. sentenceÐn and arg are each 1-byte long. When playing is complete, the CompactSPEECH sets the EVÐNORMALÐEND bit in the status word, and activates the MWRQST signal. If the current vocabulary is undefined, ERRÐINVALID is reported. Example SAS 00 03 Byte sequence: Microcontroller SDET A3 1E 00 03 CompactSPEECH 1E 00 03 Description: Byte sequence: Announce the first sentence in the sentence table of the currently selected vocabulary with ‘‘3’’ as the actual parameter. Description: SE Byte sequence: Microcontroller 24 CompactSPEECH 24 Description: Skip to end of current message. SETD Set Time and Day timeÐandÐday Sets the system time and day as specified by bits 0 – 13 in the 2-byte timeÐandÐday parameter. The timeÐandÐday parameter is encoded as follows: Bits 0 – 2 Day of the week (1 through 7). Bits 3 – 7 Hour of the day (0 through 23). Bits 8 – 13 Minute of the hour (0 through 59). Bits 14 – 15 These bits must be set to 1. If timeÐandÐday value is not valid, ERRÐ PARAM is set in the error word. Example 23 00 19 CompactSPEECH 23 00 19 Description: Set reporting of all CompactSPEECH detectors, except for end-of-DTMF. SE Skip to End of Message This command is valid only in the PLAY state. When invoked, playback is suspended (as for the PA command), and a jump to the end of the message is performed. Playback remains suspended after the jump. Example SB 19 Microcontroller 10 A3 CompactSPEECH 10 A3 SB Skip Backward timeÐlength Skips backward in the current message timeÐlength units, each of 0.2s duration, and causes message playback to pause. timeÐlength is a 2-byte parameter that can have any value up to 320, i.e., 64s. The skip accuracy is 5%. This command is meaningful only in the PLAY state. The RES command must be issued to continue playback. If the beginning of the message is detected, during execution of the SB command, execution is terminated, the EVÐ NORMALÐEND bit in the status register is set, the MWRQST signal is activated, and the CompactSPEECH switches to the IDLE state. If timeÐlength is greater than 320, ERRÐPARAM is set in the error word. Playback speed does not affect the behavior of this command. Example Byte sequence: Microcontroller Skip back five seconds from the current position in the message being played. SETD 0E09 Byte sequence: Microcontroller 0F 0E 09 CompactSPEECH 0F 0E 09 Description: 43 Set time and day to Monday 1:30 AM. http://www.national.com 2.0 Software (Continued) SF Example Skip Forward timeÐlength SMT FF F7 Skips forward in the current message timeÐlength units, each of 0.2s duration, and causes message playback to pause. timeÐlength is a 2-byte parameter that can have any value up to 320, i.e., 64s. The skip accuracy is 5%. This command is meaningful only in the PLAY state. The RES command must be issued to continue playback. If the end of the message is detected during execution of SF, execution of the command is terminated, the EVÐ NORMALÐEND bit in the status register is set, the MWRQST signal is activated and the CompactSPEECH switches to the IDLE state. If timeÐlength is greater than 320, ERRÐPARAM is set in the error word. Playback speed does not affect the behavior of this command. Example Byte sequence: Description: Description: Microcontroller 22 00 19 CompactSPEECH 22 00 19 Skip forward five seconds from the current position in the message being played. SMSG Set Message Pointer numÐofÐpages Set the message pointer to (numÐofÐpages x 32) bytes from the beginning of the current message data. If (numÐofÐpages x 32) is greater than the message length, EVÐNORMALÐEND is set in the status word, the message pointer is set to the end of the message, and the CompactSPEECH switches to the IDLE state. Example Description: Microcontroller Mark the current message as old in a system where the message tag is encoded as described in the example of the DMS command. Note that the CompactSPEECH ignores bits in the tag which are set to 1; only bit 3 is modified in the message tag. SO 00 Byte sequence: Description: Microcontroller 07 00 CompactSPEECH 07 00 Announce the first word in the word table of the currently selected vocabulary. SPS Set Playback Speed speed Sets the speed of message playback as specified by speed. The new speed applies to all recorded messages and synthesized messages (only if synthesized using external voice synthesis), until changed by another SPS command. If this command is issued while the CompactSPEECH is in the PLAY state, the speed also changes for the message currently being played. SNSG 10 Byte sequence: 05 FF F7 CompactSPEECH 05 FF F7 SO Say One Word wordÐnumber Plays the word number wordÐnumber in the current vocabulary. The 1-byte wordÐnumber may be any value from 0 through the index of the last word in the vocabulary. When playback of the selected word has been completed, the CompactSPEECH sets the EVÐNORMALÐEND bit in the status word, and activates the MWRQST signal. If wordÐnumber is not defined in the current vocabulary, or if it is an IVS control or option code, ERRÐPARAM is set in the error word. If the current vocabulary is undefined, ERRÐINVALID is reported. Example SF 19 Byte sequence: Microcontroller 30 00 0A CompactSPEECH 30 00 0A Set the message pointer to 32 bytes from the beginning of the current message data. speed may be one of 13 values, from b6 to a 6. A value of 0 represents normal speed. Note that a negative speed value represents an increase in speed, a positive value represents a decrease in speed. The change in speed is approximate, and depends on the recorded data. If speed is not in the b6 to a 6 range, ERRÐPARAM is set in the error word. Example SMT Set Message Tag messageÐtag Sets the tag of the current message. The 2-byte messageÐ tag can be used to implement mailbox functions by including the mailbox number in the tag, or to handle old and new messages differently by using one bit in the tag to mark the message as old or new. See Section 2.6.1. To change the tag of a message, we recommend that you read the message tag, modify it, and write it back. Note 1: Message tag bits can only be cleared. Message tag bits are set only when a message is first created. SPS FB Note 2: If the current message is undefined, ERRÐINVALID is reported. Note 3: Bit 15 of the message tag is used to select the voice compression algorithm and should not be modified after recording. Byte sequence: Description: Microcontroller 16 FB CompactSPEECH 16 FB Set playback speed to b5. SS Say Sentence sentenceÐn Say sentence number sentenceÐn of the currently selected vocabulary. sentenceÐn is 1-byte long. If the sentence has an argument, 0 is passed as the value for this argument. http://www.national.com 44 2.0 Software (Continued) When playing has been completed, the CompactSPEECH sets the EVÐNORMALÐEND bit in the status word, and activates the MWRQST signal. If sentenceÐn is not defined in the current vocabulary, ERRÐPARAM is set in the error word. If the current vocabulary is undefined, ERRÐINVALID is reported. Example SV SS 00 Byte sequence: Microcontroller 1F 00 CompactSPEECH 1F 00 Description: Announce the first sentence in the sentence table of the currently selected vocabulary. SSM Set Speakerphone Mode mode Sets the speakerphone to the mode mode of operation. The command is valid when the CompactSPEECH is in IDLE state. mode can be one of: 0 OFF Deactivate the speakerphone, and return the CompactSPEECH to normal operation mode. 1 ON Put the CompactSPEECH in speakerphone mode and activate speakerphone in full-duplex mode i.e., with full cancellation of both the acoustic and the electrical echoes. Tone detectors are not active. Gains in the Send and Receive paths are set by the relevant tunable parameters. 2 TRANSPARENT Activate the speakerphone with no echo cancellation. (This mode is used for system tuning.) 3 MUTE Activate speakerphone, while generating silence on the line. Tone detectors are not active. 4 LISTEN The line is audible on the speaker. Tone detectors are active. 5 Reserved 6 RESTART Restart the current speakerphone mode. This mode differs from ON; it does not require full initialization of the speakerphone. It should be used to resume the speakerphone operation after HOLD mode or to adjust to an environment change (e.g., parallel pickup). 7 HOLD Stop the codec interrupts. Neither side can hear each other. Example SV 02 03 Byte sequence: Microcontroller Description: 20 02 03 Select the vocabulary with vocabulary-id 3, which resides on Serial Flash, as the current vocabulary. SW Say Words n word1 . . . wordn Plays n words, indexed by word1 to wordn. On completion, the EVÐNORMALÐEND bit in the status word is set, and the MWRQST signal goes low. If one of the words is not defined in the current vocabulary, or if it is an IVS control or option code, or if n l 8, ERRÐ PARAM is reported. If the current vocabulary is undefined, ERRÐINVALID is reported. Example SW 02 00 00 Byte sequence: Microcontroller 21 02 00 00 CompactSPEECH 21 02 00 00 Description: Announce the first word, in the word table of the currently selected vocabulary, twice. TUNE Tune index parameterÐvalue Sets the value of the tunable parameter identified by index (one byte) to the 2-byte value, parameterÐvalue. This command may be used to tune the DSP algorithms to a specific Data Access Arrangement (DAA) interface, or to change other parameters. If you do not use TUNE, the CompactSPEECH uses default values. If index does not point to a valid tunable parameter, ERRÐPARAM is set in the error word. 2F 01 Note: The tunable parameters are assigned with their default values on application of power. The INIT command does not affect these parameters. CompactSPEECH 2F 01 Description: Microcontroller CompactSPEECH 20 02 03 SSM 1 Byte sequence: Set Vocabulary Type type id Selects the vocabulary table to be used for voice synthesis. The vocabulary type is set according to the 1-byte type parameter: 0: For compatibility only 1: External vocabulary in ROM 2: External vocabulary in Serial Flash All others: Reserved The host is responsible to select the current vocabulary, with SV, before using an SO, SW, SS or SAS command. Each external vocabulary table has a unique id which is part of the vocabulary internal header (see the IVS User’s Manual for more details). If type is 1 or 2, the CompactSPEECH searches for the one byte id parameter in each vocabulary table header until a match is found. If the id parameter does not point to a valid IVS vocabulary ERRÐPARAM is set in the error word. Example Put the CompactSPEECH into Speakerphone mode, and set the speakerphone to full-duplex mode. Table 2-2 describes the tunable parameters, their index numbers and their default values. 45 http://www.national.com 2.0 Software (Continued) TABLE 2-2. Tunable Parameters Index 0–3 4 Parameter Name Description Default Prevents speech from being interpreted as silence. The silence detection algorithm has an adaptive threshold, which is changed according to the noise level. This parameter is, therefore, only the initial threshold level. 11264 Reserved ÐSILÐTHRESHOLD Ð Legal values: 9216 to 13824 in 512 (6 dB) steps. 5 ÐSILÐTHRESHOLDÐSTEP Defines the adaptive threshold changes step. 12 If this threshold is too low, the threshold converges too slowly. If it is too high, silence detection is too sensitive to any noise. Legal values: 3 to 48. 6 ÐSILÐBURSTÐTHRESHOLD The minimum time period for speech detection during silence. As this threshold increases, the time period interpreted as silence increases. 2 If this threshold is too low, a burst of noise is detected as speech. If it is too high, words may be partially cut off. Legal values: 1 to 3. 7 ÐSILÐHANGÐTHRESHOLD The minimum time period for silence detection, during speech. As this threshold increases, the time period interpreted as silence decreases. 15 If this threshold is too low, words may be partially cut off. If it is too high, silence is detected. Legal values: 8 to 31. 8 ÐSILÐENABLE Silence compression control. 0 turns silence compression off. 9 ÐENERGYÐFACTOR Determines the energy level used to synthesize silence. For the default value, the energy levels of the synthesized silence and the recorded silence are the same. If you divide (multiply) the default value by two, the synthesized silence is 6 dB less (more) than the level of the recorded silence. 1 8192 Legal values: 1024 to 16384. 10 VOXÐENERGYÐTHRESHOLD This constant determines the minimum energy level at which voice is detected. Below this level, it is interpreted as silence. If you divide (multiply) the value by 2 you get 3 dB decrease (increase) in the threshold. 11 Reserved 12 VOXÐTIMEÐCOUNT 12 Legal values: 0 to 65535. This constant, in units of 10 ms, determines the period of silence before the CompactSPEECH reports silence. The accuracy of the constant is g 10 ms. Legal values: 0 to 65535. 13 – 15 Reserved http://www.national.com 46 700 2.0 Software (Continued) TABLE 2-2. Tunable Parameters (Continued) Index 16 Parameter Name TONEÐGENERATIONÐLEVEL Description Default Controls the energy level at which DTMF and other tones are generated. Each unit represents 3 dB. The default level is the reference level. 6 For example, if you set this parameter to 4, the energy level is 6 dB less than the default level. The actual output level is the sum of TONEÐGENERATIONÐLEVEL and the VOLÐLEVEL variable, controlled by the VC command. The tones are distorted when the level is set too high. Legal values: 0 s TONEÐGENERATIONÐLEVEL a VOLÐLEVEL s 12. 17 Reserved 18 TONEÐTIMEÐCOUNT 19 TONEÐONÐENERGYÐTHRESHOLD Controls the duration of a tone before it is reported as a dial tone, in 10 ms units. The accuracy of the constant is g 10 ms. 700 Legal values: 0 to 65535. Minimum energy level at which busy and dial tones are detected as ON (after 700 Hz filtering). If you divide (multiply) the value by 2 you get a 3 dB decrease (increase) in the threshold. 160 The mapping between energy level and the parameter value is as follows (results were measured on the codec output when a 400 Hz tone was injected to the codec input): Tunable value Energy threshold (dB-V) b 31.8 10 b 28.6 20 b 21.7 100 b 14.7 500 b 2.5 8000 Legal values: 0 to 65535. 20 TONEÐOFFÐENERGYÐTHRESHOLD Maximum energy level at which busy and dial tones are detected as OFF (after 700 Hz filtering). If you divide (multiply) the value by 2 you get a 3 dB decrease (increase) in the threshold. 110 The mapping between energy level and the parameter value is the same as for TONEÐONÐENERGYÐTHRESHOLD. Legal values: 0 to 65535. 21 VCDÐLEVEL Controls the energy during playback and external voice synthesis. Each unit represents 3 dB. The default level is the reference level. 6 For example, if you set this parameter to 4, the energy level is 6 dB less than the default level. The actual output level is the sum of VCDÐ LEVEL and the VOLÐLEVEL variable, controlled by the VC command. Speech is distorted when the level is set too high. 22 VOXÐTOLERANCEÐTIME 23 MINÐBUSYÐDETECTÐTIME 24 ECHOÐDELAY 25 Reserved 26 DTMFÐREVÐTWIST Legal values: 0 s VCDÐLEVEL a VOLÐLEVEL s 12. Controls the maximum energy period, in 10 ms units, that does NOT reset the vox detector. 3 Legal values: 0 to 255. Minimum time period for busy detection, in 10 ms units. The accuracy of the constant is g 10 ms. 600 Legal values: 0 to 65535. The near-echo delay in samples. The sampling rate is 8000 Hz (i.e., 125 ms per sample). 4 Legal values: 0 to 16. Controls the reverse twist level at which CompactSPEECH detects DTMF tones. While the normal twist is set at 8 dB, the reverse twist can be either 8 dB (default) or 4 dB (If this parameter is set to 1). 47 0 http://www.national.com 2.0 Software (Continued) TABLE 2-2. Tunable Parameters (Continued) Index 27 Parameter Name DTMFÐTWISTÐLEVEL Description A one-byte value that controls the twist level of a DTMF tone, generated by the GT command, by controlling the energy level of each of the two tones (low frequency and high frequency) composing the DTMF tone. The Least Significant Nibble (LSN) controls the low tone and the Most Significant Nibble (MSN) controls the high tone. The energy level of each tone, as measured at the output of a TP3054 codec (before the DAA) connected to the CompactSPEECH is summarized in the following table: Default 66 Nibble Value 0 1 2 3 4 5 6 7 8 – 15 Tone Energy (dBV) 0 b 17.8 b 14.3 b 12.9 b 12.4 b 12.0 b 11.9 b 11.85 b 11.85 The volume of the generated DTMF tone during meaurements was 6. (TONEÐGENERATIONÐLEVEL a VOLÐLEVEL e 6). For the default level, the high tone is b14.3 dBV and the low tone is b 12.4 dBV, which gives a DTMF twist level of 1.9 dB. The energy level of a single generated tone is the level of the low tone. 28 Reserved 29 Reserved 31 SPÐAECÐPRIORITYÐBIAS 32 SPÐDIALÐTONEÐTHRESHOLD Controls the bias in priority between the Send and Receive paths. If send priority-bias is preferred, the value should be greater than zero. For no priority bias, the value should be zero. For priority bias for the Receive path, the value should be negative. Steps are 3 dB each (e.g., a 3 is 9 dB bias for the Send path, b2 is 6 dB bias for the Receive path). 0 Legal values: b4 to 4. The RMS level below which the speakerphone treats a dial tone as noise, and not as a dial tone. When the Speakerphone algorithm detects a dial tone above this threshold it does not attenuate the signal. A value of 32767 disables the dial tone detector. 4096 Example: if the value is 512 then dial tones with energy below the following are not detected as dial tones: 20*log10(512/16017) e b29.9 dBm0 33 SPÐBLOCKÐLEVEL Controls the maximum attenuation level of the speakerphone suppressors. It affects the speakerphone stability and its subjective quality. The maximum attenuation is calculated according to: SPÐBLOCKÐLEVEL/228 Legal values: 0 to 32000. 10922 33 SPÐAECÐLRÐLEVEL Controls the speakerphone gain from the microphone to the line-out. The total attenuation, or gain, depends on both of the analog gains and this value. The gain is: K*signal where: K e SPÐAECÐLRÐLEVEL/4096. Legal values: 0 to 16000. 14000 http://www.national.com 48 2.0 Software (Continued) TABLE 2-2. Tunable Parameters (Continued) Index Parameter Name 35 SPÐEECÐLRÐLEVEL Controls the speakerphone gain from the line-in to the speaker. The total attenuation, or gain, depends on both of the analog gains and this value. The gain is: K*signal where: K e (SPÐEECÐLRÐLEVEL/4096) * (2(6 a VOLÐLEVEL/2) Legal values: 0 to 400. Description 36 SPÐAECÐCLIPÐPOS Specifies the positive peak-value at which the analog circuit of the line-out saturates. Codec analog full scale corresponds to mLAW full scale values after expansion. Assume that positive saturation occurs at amplitudes higher than those of a sine wave at X [dBm0]. The SPÐAECÐCLIPÐPOS value is set as: SPÐAECÐCLIPÐPOS e 32636*10((Xb3.17)/20) Note: a sine wave with amplitude 4*8159 e 32636 corresponds to 3.17 dBm0. Example: For X e b6.2761 dBm0, the value is: SPÐAECÐCLIPÐPOS e 32636*10((b6.2761 – 3.17)/20) e 0.3371*32636 e 11000; Legal values: 0 to 32767. 16000 37 SPÐAECÐCLIPÐNEG Specifies the negative peak value at which the analog circuit of the line-out saturates. Codec analog full scale corresponds to mLAW full scale values after expansion. The value of SPÐAECÐCLIPÐNEG is set as shown for SPÐAECÐCLIPÐPOS, above. Legal values: b32768 to 0. b 16000 38 SPÐEECÐCLIPÐPOS Specifies the positive peak value at which the analog circuit of the speaker saturates. Codec analog full scale corresponds to mLAW full scale values after expansion. The value of SPÐEECÐCLIPÐPOS is set as shown for SPÐAECÐCLIPÐPOS, above. Legal values: 0 to 32767. 16000 39 SPÐEECÐCLIPÐNEG Specifies the negative peak value at which the analog circuit of the line-out saturates. Codec analog full scale corresponds to mLAW full scale values after expansion. The value of SPÐEECÐCLIPÐNEG is set as shown for SPÐAECÐCLIPÐPOS, above. Legal values: b32768 to 0. b 16000 40 SPÐAECÐENABLE Enables/disables the acoustic echo controller. Legal values: 0 (disable), 1 (enable). 1 41 SPÐEECÐENABLE Enables/disables the electrical echo controller. Legal values: 0 (disable), 1 (enable). 1 49 Default 281 http://www.national.com 2.0 Software (Continued) The command can lengthen a new message i.e., a message which was just created with the CMSG command, but was not yet closed by the S command. If this is the case, and if the message pointer points to the end of the last block used by the message, and WMSG command is issued, the message length increases by 4 kbytes. If the memory becomes full, EVÐ MEMFULL is set in the status word, and the CompactSPEECH switches to the IDLE state. Trying to lengthen an existing message, i.e., a message that was already closed, causes the CompactSPEECH to set the EVÐNORMALÐEND event in the status word, and switch to the IDLE state. The microcontroller must issue an S command to close the message and switch the CompactSPEECH to the IDLE state. Example TUNE 23 700 Byte sequence: Microcontroller 15 17 02 BC CompactSPEECH 15 17 02 BC Description: Set the minimum period for busy detection to seven seconds. VC Volume Control volÐlevel Controls the energy level of all the output generators (playback, tone generation, and voice synthesis) and the speakerphone, with one command. The resolution is g 3 dB. The actual output level is composed of the tunable level variable, plus the volÐlevel. The valid range for the actual output level of each output generator is defined in Table 2-2. For example, if the tunable variable VCDÐLEVEL is 6, and volÐlevel is b2, then the output level equals VCDÐLEVEL a volÐlevel e 4. Example Notes: When updating an existing message, bits can only be cleared, but not set. If the current message is undefined, ERRÐINVALID is reported. Example WMSG 32 bytes VC 04 Byte sequence: Microcontroller Byte sequence: 28 04 CompactSPEECH 28 04 Description: Set the volume level to VCDÐLEVEL a Description: 4. WMSG Write Message data Writes 32 bytes of data from the current position of the message pointer, and advances the message pointer by 32 bytes. If the CompactSPEECH is in the IDLE state, the command opens the current message, switches the CompactSPEECH to the MSGÐOPEN state, sets the message pointer to the beginning of the message data, and writes the 32 bytes of data . http://www.national.com WRAM Microcontroller 31 32 bytes of data to write CompactSPEECH 31 echo 32 bytes of data Create a message with tag e 01, and write 32 bytes in the message memory. Write Memory tag, data This command exists for compatibility only. Use WMSG instead. 50 Appendix A # User interface that includes one 16-digit LCD, and a SCHEMATIC DIAGRAMS 16-key (4 x 4) keypad. For more details about the demo please refer to the NS Digital Answering Machine Demo Operating Instructions. The following schematic diagrams are extracted from a CompactSPEECH demo unit, based on the NSV-AM266SPAF board, designed by National Semiconductor. This demo includes three basic clusters: Note: If IVS resides in serial flash, and not in ROM, the address- and dataline connections are not required, and the layout is much simpler. # COP888EEG Microcontroller. # CompactSPEECH cluster, including two TP3054 codec TL/EE/12868 – 32 and an NSAM266SP controlling a Serial Flash device. 51 http://www.national.com http://www.national.com TL/EE/12868 – 33 Appendix A (Continued) 52 TL/EE/12868 – 34 Appendix A (Continued) 53 http://www.national.com http://www.national.com TL/EE/12868 – 35 Appendix A (Continued) 54 TL/EE/12868 – 36 Appendix A (Continued) 55 http://www.national.com http://www.national.com 56 Physical Dimensions inches (millimeters) unless otherwise noted 100-Pin Molded Plastic Quad Flatpak (EIAJ) Order Number NSAM266SPA/VLJ NS Package Number VLJ100A 57 http://www.national.com NSAM266SP CompactSPEECH Digital Speech Processor with Full-Duplex Speakerphone Physical Dimensions inches (millimeters) unless otherwise noted (Continued) 68-Pin Plastic Leaded Chip Carrier (V) Order Number NSAM266SPA/V NS Package Number V68A LIFE SUPPORT POLICY NATIONAL’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF THE PRESIDENT OF NATIONAL SEMICONDUCTOR CORPORATION. As used herein: 1. Life support devices or systems are devices or systems which, (a) are intended for surgical implant into the body, or (b) support or sustain life, and whose failure to perform, when properly used in accordance with instructions for use provided in the labeling, can be reasonably expected to result in a significant injury to the user. National Semiconductor Corporation 1111 West Bardin Road Arlington, TX 76017 Tel: 1(800) 272-9959 Fax: 1(800) 737-7018 http://www.national.com 2. A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system, or to affect its safety or effectiveness. National Semiconductor Europe Fax: a49 (0) 180-530 85 86 Email: europe.support @ nsc.com Deutsch Tel: a49 (0) 180-530 85 85 English Tel: a49 (0) 180-532 78 32 Fran3ais Tel: a49 (0) 180-532 93 58 Italiano Tel: a49 (0) 180-534 16 80 National Semiconductor Hong Kong Ltd. 13th Floor, Straight Block, Ocean Centre, 5 Canton Rd. Tsimshatsui, Kowloon Hong Kong Tel: (852) 2737-1600 Fax: (852) 2736-9960 National Semiconductor Japan Ltd. Tel: 81-043-299-2308 Fax: 81-043-299-2408 National does not assume any responsibility for use of any circuitry described, no circuit patent licenses are implied and National reserves the right at any time without notice to change said circuitry and specifications.