NSAM266SC CompactSPEECH TM Digital Speech Processor with Caller-ID Support General Description The NSAM266SC 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 Caller ID feature complies with the Bellcore standard used in the USA. It implements the receiver side for data transmitted from the central office to the subscriber. 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 NSAM266SC 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. 1.0 Hardware 1.1 BLOCK DIAGRAM NSAM266SC Basic Configuration TL/EE/12585 – 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/EE12585 RRD-B30M46/Printed in U. S. A. NSAM266SC CompactSPEECH Digital Speech Processor with Caller-ID Support March 1996 Features 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 20.48 MHz operation On-chip DSP Module (DSPM) for high-speed DSP operations On-chip codec clock generation and interface Power-down mode Selectable speech compression rate of 5.2 kbit/s and 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 Caller IDÐSupports the US (Bellcore), French and Dutch Caller-ID standards Automatic storage of Caller ID data of InComing Messages (ICM) Stores caller numbers MICROWIRE slave interface to an external microcontroller MICROWIRE master interface to Serial Flash memory devices Storage and management of messages Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y http://www.national.com 2 Programmable message tag for message categorization, e.g., Mailboxes, InComing Messages (ICM), OutGoing Messages (OGM) Skip forward or backward during message playback Digital volume control 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 Call screening (input signal echoed to codec output) Real-time clock Direct access to message memory Supports long-frame and short-frame codecs Supports up to four 4-Mbit, or two 8-Mbit, Serial Flash devices Supports prerecorded IVS and OGM on Serial Flash Available in 68-pin PLCC and 100-pin PQFP packages Table of Contents 2.2 CompactSPEECH CommandsÐQuick Reference Table 1.0 HARDWARE 1.1 Block Diagram 2.3 The State Machine 1.2 Pin Assignment 2.4 Command Execution 1.2.1 PinÐSignal Assignment 1.2.2 Pin Assignment in the 68-PLCC Package 1.2.3 Pin Assignment in the 100-PQFP Package 2.5 Tunable Parameters 2.6 Messages 2.6.1 Message Tag 1.3 Functional Description 2.7 Speech Compression 1.3.1 Resetting 1.3.2 Clocking 1.3.3 Power-down Mode 1.3.4 Power and Grounding 1.3.5 Memory Interface 1.3.6 Codec Interface 2.8 Tone and No-Energy Detection 2.9 Caller ID 2.10 Speech Synthesis 2.10.1 Explanation of Terms 2.10.2 External (International) Vocabularies 1.4 Specifications 2.11 Initialization 1.4.1 Absolute Maximum Ratings 1.4.2 Electrical Characteristics 1.4.3 Switching Characteristics 1.4.4 Synchronous Timing Tables 1.4.5 Timing Diagrams 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.0 SOFTWARE 2.14.1 Master MICROWIRE Data Transfer 2.1 Overview 2.15 Command Description 2.1.1 DSP-based Algorithms 2.1.2 System Support 2.1.3 Peripherals Support APPENDIX A SCHEMATIC DIAGRAMS 3 http://www.national.com 1.0 Hardware (Continued) 1.2.1 PinÐSignal Assignment 1.2 PIN ASSIGNMENT The following sections detail the pins of the NSAM266SC 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 D(0:7) TTL D(0:7) I/O MWCS TTL (Note A) MWCS Input TST TTL TST Input MWRDY TTL MWRDY I/O 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 CFS0 CMOS CFS0 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.2.2 Pin Assignment in the 68-PLCC Package TL/EE/12585 – 3 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.2.3 Pin Assignment in the 100-PQFP Package TL/EE/12585 – 4 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.3 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.4.2. 1.3.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/12585 – 6 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/12585 – 7 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/12585 – 5 1.3.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.3.5 Memory Interface 1.3.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 Organaization 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 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 kbytes block which means that half a block in average is not used 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.3.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 13 minutes and 9 seconds 10 14 minutes and 25 seconds 15 15 minutes and 7 seconds 20 15 minutes and 47 seconds 25 16 minutes and 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 the blocks have the same lifetime. 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. 8 1.0 Hardware (Continued) 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. 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 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. 1.3.6 Codec Interface The CompactSPEECH provides an on-chip interface to a serial codec. This interface supports codec operation in long or short-frame formats. The format is selected with the CFG command. The codec interface uses four signalsÐCDIN, CDOUT, CCLK and CFS0. Data is transferred to the codec through the CDOUT pin. Data is read from the codec through the CDIN pin. Data transfer between the CompactSPEECH and the serial codec starts by the CompactSPEECH asserting (setting to 1) the CFS0 frame synchronization signal. After one clock cycle, the CompactSPEECH de-asserts (clears to 0) CFS0, data from the CompactSPEECH is sent to the codec through CDOUT, and simultaneously data from the codec is sent to the CompactSPEECH through CDIN. 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. 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. TL/EE/12585 – 8 FIGURE 1-6. Codec ProtocolÐShort Frame TL/EE/12585 – 9 FIGURE 1-7. Codec ProtocolÐLong Frame 9 http://www.national.com 1.0 Hardware (Continued) Figure 1-6 shows how the codec interface signals behave when short frame protocol is configured. the data for the first codec is shifted out bit-by-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. 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, Figure 1-7 shows how the codec interface signals behave when long frame protocol is configured. 1.4 SPECIFICATIONS All Input or Output Voltages, with Respect to GND 1.4.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 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. 0§ C to a 70§ C 1.4.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 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) 0.2 V 5.0 mA b 5.0 5.0 mA 80.0 mA 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 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). 10 V b 5.0 IL http://www.national.com V mA pF 1.0 Hardware (Continued) Maximum times assume capacitive loading of 50 pF. CLKIN crystal frequency is 40.96 MHz. 1.4.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/12585 – 10 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/12585 – 11 Signal valid time, after a falling edge of MWCLK. FIGURE 1-9. Synchronous Output Signals (Valid) TL/EE/12585 – 12 Signal hold time, after a rising edge of CTTL. FIGURE 1-10. Synchronous Output Signals (Hold) 11 http://www.national.com 1.0 Hardware (Continued) TL/EE/12585 – 13 Signal hold time, after a falling edge of MWCLK. FIGURE 1-11. Synchronous Output Signals (Hold) TL/EE/12585 – 14 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 http://www.national.com 12 1.0 Hardware (Continued) TL/EE/12585 – 15 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/12585 – 16 FIGURE 1-14. Hysteresis Input Characteristics 13 http://www.national.com 1.0 Hardware (Continued) 1.4.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 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 12.0 tFSa 1-15 CFS0 Active After R.E. CTTL 25.0 tFSh 1-15 CFS0 Hold After R.E. CTTL tFSia 1-15 CFS0 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 tMWDRYia 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 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. http://www.national.com 14 0.0 0.0 12.0 0.0 12.0 48.8 50,000 12.0 0.0 0.0 25.0 12.0 0.0 12.0 0.0 70.0 12.0 1.0 Hardware (Continued) INPUT SIGNALS Symbol Figure tCDIh 1-15 CDIN Hold Description After R.E. CTTL Reference Conditions Min (ns) 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 24.4 Note A: Guaranteed by design, but not fully tested in power-down mode. Note B: Guaranteed by design. but not fully tested. 15 http://www.national.com 1.0 Hardware (Continued) 1.4.5 Timing Diagrams TL/EE/12585 – 17 FIGURE 1-15. Codec Short Frame Timing TL/EE/12585 – 18 FIGURE 1-16. Codec Long Frame Timing http://www.national.com 16 1.0 Hardware (Continued) TL/EE/12585 – 19 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/12585 – 20 FIGURE 1-18. MICROWIRE Transaction TimingÐData Transmitted to Output 17 http://www.national.com 1.0 Hardware (Continued) TL/EE/12585 – 21 FIGURE 1-19. MICROWIRE Transaction TimingÐData Echoed to Output TL/EE/12585 – 22 FIGURE 1-20. Master MICROWIRE Timing http://www.national.com 18 1.0 Hardware (Continued) TL/EE/12585 – 23 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/12585 – 24 FIGURE 1-22. CTTL and CLKIN Timing TL/EE/12585 – 25 FIGURE 1-23. Reset Timing When Reset is not at Power-Up TL/EE/12585 – 26 FIGURE 1-24. Reset Timing When Reset is at Power-Up 19 http://www.national.com 2.0 Software # # # # 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 # # # # # Tone generator Real-time clock handler Power-down mode support 2.1.3 Peripherals Support Speech compression and decompression DTMF detector with echo canceler Energy-based busy and dial-tone detector Caller-ID modem Digital volume control # Serial flash interface (Master MICROWIRE handler) # Microcontroller interface (Slave MICROWIRE handler) # Codec interface The following sections describe the CompactSPEECH software in detail. 2.1.2 System Support # Command interface to an external microcontroller # Memory and message manager http://www.national.com IVS support 20 21 S S S S S S S S GCFG GCID GEW GI GL GMS GMT GNM S S A S INJ MR P PA S A FR** INIT S DMS S S DM S S CVOC GTM S CMT GTD S CMSG S S CFG A S CCIO GT S AMAP** GSW A ACID Name S/A Command 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 Caller ID 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 Activate Caller ID Description 1C 03 2A 29 13 09 0E 0D 14 11 04 12 19 25 1B 2E 02 08 0B 0A 2B 26 33 01 34 06 2D Opcode Hex No change Idle No change IDLE IDLE IDLE IDLE MSGÐOPEN RESET No change CID Result State IDLE Description None TagÐref, TagÐmask None Type None Index None bufÐoption None None TagÐref, TagÐmask None None Length of Time Tag, NumÐofÐblocks ConfigÐvalue ConfigÐvalue ActionÐnumber None IDLE PLAY IDLE No change IDLE IDLE 1 Time/day None Status word Number of messages Message tag Recording time left Message length Value Error word Caller ID data Version, ConfigÐvalue None None None Test result None None None None Test result None Description Return Value None None None N, byte1 . . . byten None 4an None None None None None TagÐref, TagÐMask, Dir 2 a 2 a 1 Message found Time/Day Option 1 2a2 1 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 RESET, IDLE RESET, IDLE IDLE IDLE IDLE All states IDLE IDLE IDLE IDLE PLAY, RECORD, SYNTHESIS, No change TONEÐGENERATE, IDLE All states Idle RESET, IDLE IDLE IDLE IDLE IDLE IDLE RESET RESET, IDLE IDLE Source State 1 2 2 2 2 2 2 2 2 36 2 1 1 Bytes 2.0 Software (Continued) 2.2 CompactSPEECH COMMANDSÐQUICK REFERENCE TABLE http://www.national.com http://www.national.com 22 S A S S S S SV SW TUNE VC WMSG WRAM** Write RAM Write Message Volume Control Tune Say Words Set Vocabulary Type 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 Read Message Resume Reset Detectors Record Message Go to Power-Down Mode Description 17 31 28 15 21 20 1F 16 07 05 30 22 0F 24 10 23 IE 00 18 32 1D 2C 0C 1A Opcode Hex IDLE, MSGÐOPEN PLAY, SYNTHESIS, IDLE, TONEÐGENERATE 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, MSGÐOPEN PLAY, RECORD, SYNTHESIS, TONEÐGENERATE, IDLE* IDLE IDLE IDLE Source State A e Asynchronous command. S e Synchronous command. **This command exists for compatibility reasons only, and will be obsolete in future revisions of CompactSPEECH. *Command is valid in IDLE state; but has no effect. S A SS SO SPS S A SMT S S SETD SMSG S SE S S SF S SDET S RRAM** SB S RMSG S S RES A S RDET SAS A R S S S/A PDM Name Command MSGÐOPEN No Change IDLE SYNTHESIS IDLE SYNTHESIS No Change SYNTHESIS IDLE MSGÐOPEN No Change No Change No Change No Change No Change SYNTHESIS IDLE MSGÐOPEN No Change No change RECORD IDLE Result State Message Tag, Data Data Increment/Decrement Index, Value N, word1 . . . wordn Mode, Id 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 None Detectors Reset Mask Message Tag None Description 2 a 32 32 1 1a2 1an 1a1 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 Data Data None None None None Description 32 32 Bytes Return Value 2.0 Software (Continued) 2.2 CompactSPEECH COMMANDSÐQUICK REFERENCE TABLE (Continued) 2.0 Software (Continued) SYNCHRONOUS COMMANDS 2.3 THE STATE MACHINE 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 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. RESET The CompactSPEECH is initialized to this state after a full hardware reset by the RESET signal (see Section 1-6). 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.) 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). 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. 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. 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 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. SYNTHESIS An individual word or a sentence is synthesized from an external vocabulary. 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. 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. CID The CompactSPEECH receives the Caller ID data into a 48byte internal buffer. 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. 23 http://www.national.com 2.0 Software (Continued) The GMT (Get Message Tag) and SMT commands may be used to handle message tags. 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 CMSG (Create Message) command. When a message is created, it is assigned a time-and-day stamp, caller ID information, 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 Telephone Directory and Caller Numbers List (caller IDs of all those who called, but did not leave a message). 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. 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.3.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. 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 algorithms 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. 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. 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 below (see Table 2-1). 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 (bit 15) of the message tag is used to indicate the speech compression rate. The microcontroller should program it before recording (‘‘1’’ for 5.2 kbit/s, ‘‘0’’ for 7.3 kbit/s). The CompactSPEECH reads the bit before message playback to select the appropriate decompression algorithm. http://www.national.com 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. 24 2.0 Software (Continued) TABLE 2-1. DTMF Detector Performance PLAY RECORD/IDLE Detection Sensitivity (Note A) Performance depends on 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 Sensitivity 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. the EIA-470-RS standard. Note, however, that you may have 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. 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 . # Tune the DTMFÐTWISTÐLEVEL parameter to control the twist level of the generated DTMF tones. # Use the VC command, and tune the TONEÐGENERA- TIONÐLEVEL parameter, to control the energy level at which these tones are generated. 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 # Use the GT command to specify the DTMF tones, and the frequency at which single tones are generated. TL/EE/12585 – 27 FIGURE 2-1. Busy and Dial-Tone Band-Pass Filter Frequency Response TL/EE/12585 – 28 [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 25 http://www.national.com 2.0 Software (Continued) 2.10 SPEECH SYNTHESIS 2.9 CALLER ID The CompactSPEECH Caller-ID feature provides complete support for the Bellcore standard used in the USA, the French standard and the Dutch standard. In addition it provides hooks for other standards, if they are similar to one of the above three, through CFG configuration command and a few tunable parameters. The CompactSPEECH activates the Caller-ID physical layer (either Bell202, V.23 or DTMF as determined by the CFG command) when it receives the ACID (Active Caller ID) command from the microcontroller. After the modem session has been completed, if the session was successful, the CompactSPEECH reports an EVÐNORMALÐEND event. If any error is encountered during the session, the CompactSPEECH reports an ERRÐ CID error. In this case, details of the error are included in the caller ID data. Whether an error was detected or not, the Caller-ID data is saved in a 48-byte buffer, and can be retrieved by the microcontroller with the GCID command. Speech synthesis enables you to announce prerecorded voice prompts, or form a sentence by combining individual words. The main speech synthesis features are: # External vocabularies on ROM or Serial Flash. # International Vocabulary Support (IVS) without changing the microcontroller code. # Up to 220 words in each vocabulary. Each word can be announced separately. # Sentences announced from a predefined table of sentences. # On-the-fly sentence announcement. 2.10.1 Explanation of Terms The following terms are used throughout this datasheet: Vocabulary Ð A complete set of words and sentences. Words are arranged in a word table. Sentences are arranged in a sentence table. Word Table Ð A set of words, arranged in a table, as part of a vocabulary. Sentence Table Ð A set of sentences, arranged in a table, as part of a vocabulary. The structure of a sentence table is described in detail in the IVS User’s Manual. THE CALLER-ID MODEM If either Bell202 or V.23 are used as the physical layer (modem), for the Caller-ID modem to function correctly, AGC must not be active in parallel. The microcontroller must disable the AGC before activating the modem. If DTMF is used as the physical layer, AGC must be active for best performance. MESSAGE FORMAT For the Bellcore standard, the CompactSPEECH supports CND (Caller Number Delivery) and CNAM (Calling Name Delivery) in SDMF (Single Data Message Format) and MDMF (Multiple Data Message Format). For the French standard, CND and CNAM are supported in MDMF (SDMF is not defined in the French standard). For the Dutch standard the Caller-ID data includes a 17 digit telephone number. The CompactSPEECH provides the same interface to the Caller-ID data using the GCID command regardless of the selected standard. For more details about the ACID and GCID commands, and the various Caller-ID specific tunable parameters, refer to Section 2.15. http://www.national.com Word Sentence 26 Ð An entry in a word table which represents a spoken word or phrase. A word is played with the SW (Say Words), or SO (Say One word) commands. Ð A series of words, synthesized from a vocabulary. A sentence is defined as an entry in the sentence table, and is synthesized with the SS (Say Sentence) or SAS (Say Argumented Sentence) command, or is synthesized ‘‘on-the-fly’’ with the SW command. 2.0 Software (Continued) External Vocabulary Ð An optional vocabulary which resides on external ROM or Serial Flash. International Vocabulary Support (IVS) IVS enables you to have the same program on the controller to support operation with several languages. You have only to switch to another table, containing another language, and the machine ‘‘speaks’’ the new language. Before using a specific table, set the currently used vocabulary with the command SV (Set Vocabulary Type). Until the next invocation of this command, the selected vocabulary is used when invoking any synthesis command. It is possible to have several vocabularies on a flash device and/or ROM, and the controller can switch between them. Ð A method that enables the same CompactSPEECH command to synthesize sentences with the same meaning, but in different languages, from separate external vocabularies. SENTENCES The CompactSPEECH provides specific commands to synthesize sentences. When using external vocabularies, sentences can be defined in a sentence table, and accessed directly via the SS and SAS commands. Use the SS command to play a sentence without an argument. Use the SAS command to play a sentence with an argument. A sentence can have only one argument. 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.3.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.10.2 External (International) Vocabularies IVSTOOL, a PC-based tool from National Semiconductor, is available to create external vocabularies. With this tool, you can compress voice-format files, and compose both numbers and sentences to comply with the grammar of a specific language. The CompactSPEECH supports external vocabularies which you can easily tailor for country-specific applications. Every language has its own sentence structure, and its own mechanism for composing numbers. Therefore, the information on the sentence structure and number composition is a part of the external vocabulary. A method, IVS, has been developed which uses this information to compose a complete sentence. The information stored in the external vocabulary, together with this retrieval method, can be used to compose sentences or phrases in various languages, to implement a voice menu and command voice prompts. The vocabulary can reside on either external ROM or serial flash. 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. 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. 27 http://www.national.com 2.0 Software (Continued) 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 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 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. 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.) 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. MWRDY 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 http://www.national.com 28 2.0 Software (Continued) The MWRQST signal is used as follows: 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. 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. Figure 2-3 illustrates the sequence of activities during a MICROWIRE data transfer. 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. 2.13.2 Interface Protocol Error Handling 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). 2.14.1 Master MICROWIRE Data Transfer 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. 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.) 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. 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/12585 – 29 FIGURE 2-3. Sequence of Activities during a MICROWIRE Byte Transfer 29 http://www.national.com 2.0 Software (Continued) TL/EE/12585 – 30 FIGURE 2-4. Master MICROWIRE Data Transfer 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. Example ACID Byte sequence: 2D CompactSPEECH 2D Description: Activate Caller ID modem. CCIO Configure Codec I/O configÐvalue Configures the voice samples path in various states. It should be used to change the default CompactSPEECH configuration. The configÐvalue parameter is encoded as follows: Bit 0 Loopback control. 0: Loopback disabled (default). 1: Loopback enabled. During RECORD state, the input samples are echoed back unchanged (i.e., no volume control) to the codec. Bits 1 – 7 Reserved. Example 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. ACID Activate Caller ID When the CompactSPEECH receives the ACID command, it clears the caller ID buffer, activates the caller ID modem, and enters the CID state. When the Caller-ID physical layer is Bell202 or V.23, this command should be sent by the microcontroller after the first ring, but before the second ring (timing should be according to the relevant standard). It is the responsibility of the microcontroller’s ring detection algorithm to determine when the first ring has ended. If the physical layer is DTMF, the command should be sent by the microcontroller after it detects voltage polarity change on the line. After the modem session has been completed, and the caller ID buffer has been loaded with the new caller ID data, the CompactSPEECH deactivates the modem and reports an EVÐNORMALÐEND event. If the second ring occurs before the CompactSPEECH reports an event, the microcontroller should terminate the caller ID modem session with the S command. If the modem session is not successful, the CompactSPEECH sets the ERRÐCID bit in the error word, and reports an EVÐERROR event. The microcontroller can still retrieve the contents of the caller ID buffer, using the GCID command. The error details are in the caller ID status byte (bytes 46 – 47 of the caller ID buffer). If the modem session is terminated with the S command, the contents of the caller ID buffer are undefined. CCIO 3401 Byte sequence: Microcontroller 34 01 CompactSPEECH 34 01 Description: Enabled Loopback. 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: Bit 0 Bit 1 Note 1: When ACID starts execution, the previous contents of the caller ID buffer are destroyed. Note 2: AGC must be ON (Bellcore and French) or OFF (Dutch) before activating the ACID command. http://www.national.com Microcontroller 30 Codec configuration. 0: short-frame format (default) 1: long-frame format. (Guaranteed by design, but not tested.) Reserved. 2.0 Software (Continued) Bit 2 The memory space available for the message data is computed as follows: Echo cancellation control. 0: Echo cancellation off (default) 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 reported and no message created. Example 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 can not 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. Bit 11 Caller-ID Physical Layer 0: Bell202 or V.23 (default). 1: DTMF. Bit 12 Caller-ID Application Layer 000: USA, Bellcore (default, physical layer should be Bell202/V.23). 001: French (physical layer should be Bell202/ V.23). 010: Dutch (physical layer should be DTMF). CMSG 010100 01 Byte sequence: Description: Note: The CompactSPEECH automatically detects the type of flash device in use, i.e., NM29A040 or NM29A080. CFG 0324 Microcontroller 01 03 24 Create a new message, and allocate 4 kbytes for its data. 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. CompactSPEECH 01 03 24 Description: 33 01 01 00 01 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. Example Byte sequence: Microcontroller CompactSPEECH 33 01 01 00 01 Configure the CompactSPEECH to work with: Codec that supports short-frame format. Three, NM29A040, flash devices. Echo cancellation on. Example CMT 02BC Byte sequence: 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. Microcontroller 26 02 BC CompactSPEECH 26 02 BC Description: 31 Cut the last seven seconds of the current message. http://www.national.com 2.0 Software (Continued) Example CVOC Check Vocabulary 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 DMS FFC2 003F Byte sequence: Description: CVOV Byte sequence: Microcontroller 2B AA CompactSPEECH 2B 01 Description: Check the current vocabulary. The CompactSPEECH responds that the vocabulary is OK. 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 Microcontroller 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 GCFG 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. http://www.national.com 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 GCFG Get Configuration Value Returns a sequence of two bytes with the following information: Bit 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 CompactSPEECH 0A Description: 0B FF C2 00 3F Note: The description of the tag is an example only. All bits of the tag are user-definable. DM Byte sequence: Microcontroller CompactSPEECH 0B FF C2 00 3F Byte sequence: Microcontroller 02 AA AA CompactSPEECH 02 02 01 Description: 32 Get the CompactSPEECH magic number. The CompactSPEECH responds that it is Version 1, with Serial Flash. 2.0 Software (Continued) GCID Bytes 46 – 47 Two status bytes. Get CID bufÐoption Every bit represents either error (E) warning (W) or status (S). Whenever ERRÐCID is set in the CompactSPEECH error word, one of the (E) bits is set to indicate the error details. Byte 46 format: Bit 0 Ð Message format error. (E) Bit 1 Ð Parameter redundancy. (W) Bits 2 – 7 Ð Reserved. Byte 47 format: Bit 0 Ð End of message (S). Set after the last byte of the caller ID data has been received. If not set, it indicates that the session was not completed. The EVÐNORMALÐEND event in the CompactSPEECH status word is set in parallel to this bit. Bit 1 Ð Checksum error. (E) Bit 2 Ð No carrier. (E) Bit 3 Ð Timeout 0 (See CIDÐPARAM0 tunable for details). (E) Bit 4 Ð Timeout 1 (See CIDÐPARAM1 tunable for details). (E) Bit 5 Ð Timeout 2 (See CIDÐPARAM2 tunable for details). (E) Bit 6 Ð Timeout 3 (See CIDÐPARAM3 tunable for details). (E) Bit 7 Ð Field overflow. (W) Returns the caller ID data. bufÐoption may be one of the following: 0: returns the current content of the caller ID buffer. 1: returns the caller ID data of the current message. For Dutch Caller-ID, the 48 bytes of the caller ID data is encoded as follows: Bytes 0 –45 Caller telephone number, NULL padded. Bytes 46 –47 Two status bytes. Every bit represents either error (E) warning (W) or status (S). Whenever ERRÐCID is set in the CompactSPEECH error word, one of the (E) bits is set to indicate the error details. Byte 46 is reserved. Byte 47 format: Bit 0 Ð End of message (S). Set after the last byte of the caller ID data has been received. If not set, it indicates that the session was not completed. The EVÐNORMALÐEND event in the CompactSPEECH status word is set in parallel to this bit. Bits 1–2 Ð Reserved. Bit 3 Ð Timeout 0 (See CIDÐPARAM0 tunable for details). (E) Bit 4 Ð Timeout 1 (See CIDÐPARAM1 tunable for details). (E) Bit 5 Ð Timeout 2 (See CIDÐPARAM2 tunable for details). (E) Bit 6 Ð Reserved. Bit 7 Ð Field overflow. (W) For USA and French Caller-ID, the 48 bytes of the caller ID data is encoded as follows: Bytes 0 –17 Caller telephone number, NULL padded. If the telephone number is absent, byte 0 is used to indicate the reason: 0xFF - Private 0xEF - Out-of-area/unavailable Bytes 18 –37 Caller name, NULL padded. If the caller name is absent, byte 0 is used to indicate the reason: 0xFF - Private 0xEF - Out-of-area/unavailable Bytes 38 –39 Month - ASCII code of 01 to 12 where byte 26 is the MSB Bytes 40 –41 Day - ASCII code of 01 to 31 where byte 28 is the MSB Bytes 42 –43 Hour - ASCII code of 00 to 24 where byte 30 is the MSB Bytes 44 –45 Minute - ASCII code of 00 to 59 where byte 32 is the MSB Example GCID Byte sequence: Description: Microcontroller 2E 00 AA ... AA CompactSPEECH 2E 00 36-byte caller ID data CompactSPEECH returns 36 bytes of caller ID data. GEW Returns the 2-byte error word. Get Error Word 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. 33 http://www.national.com 2.0 Software (Continued) 2 The energy level of the samples in the last 10 ms. 2 1 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 . 0 Example GI 0 Byte sequence: Res 3 ERRÐOPCODE 4 ERRÐCOMMAND ERRÐTIMEOUT 5 ERRÐPARAM 6 Res 7 ERRÐCOMM 8 ERRÐINVALID Res 15 – 9 ERRÐCID 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. Description: Get the duration of the last detected DTMF tone. The CompactSPEECH responds: 60 ms 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 all other blocks), the 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 GL Byte sequence: Microcontroller 19 AA AA CompactSPEECH 19 02 00 Description: GEW Microcontroller 25 00 AA AA CompactSPEECH 25 00 00 06 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 can not be performed in current context. ERRÐCID Error during Caller ID detection. Example Byte sequence: Microcontroller 1B AA AA Get the length of the current message. The CompactSPEECH responds: 512 i.e., the message occupies 16384 (512 * 32) bytes CompactSPEECH 1B 00 02 Description: 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 . 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. 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. 1 The duration of the last detected busy tone in 10 ms units. http://www.national.com 34 2.0 Software (Continued) to indicate a change in the status word. This signal remains active until the CompactSPEECH receives a GSW command. Example GMS 0 12 00 AA AA Microcontroller 04 AA AA 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. EVÐERROR 5 4 30 EVÐDTMFÐDIGIT EVÐBUSY 6 EVÐDTMFÐEND 7 EVÐNORMALÐEND 8 EVÐMEMFULL 9 EVÐNORMALÐEND 1 e Normal completion of operation, e.g., end of message playback. 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. 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 further detail.) EVÐDIALTONE 1 e Dial tone detected. Use this indicator for call progress and line disconnection. GNM FFFE 0003 Microcontroller 11 FF FE 00 03 AA AA CompactSPEECH 11 FF FE 00 03 00 05 Description: 10 EVÐDTMFÐEND 1 e Ended detection of a DTMF tone. The detected digit is held in EVÐDTMFÐDIGIT. 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-byte 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 Byte sequence: 12 11 EVÐDTMFÐDIGIT DTMF digit. A value indicating a detected DTMF digit. (See the description of DTMF code in the GT command.) CompactSPEECH 04 00 0E Description: 13 The bits in the status word are used as follows: GMT Byte sequence: 14 EVÐDIALTONE 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 15 EVÐMEMLOW Return the remaining recording time. The CompactSPEECH responds: 320 seconds Res Description: EVÐVOX The status word is cleared during reset, and by the GSW command. CompactSPEECH 12 00 01 40 EVÐRESET Microcontroller EVÐDTMF Byte sequence: EVÐVOX 1 e a period of silence (no energy) was detected on the telephone line during recording. (See VOXÐTIMEÐ COUNT in Table 2-2.) 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. GSW Returns the 2-byte status word. 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. Get Status Word 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), 35 http://www.national.com 2.0 Software (Continued) Time of day is encoded as follows: EVÐDTMF 1 e Started detection of a DTMF tone. 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. Example GSW Byte sequence: Description: Microcontroller 14 AA AA CompactSPEECH 14 00 40 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. Note: If the current message is undefined, and timeÐdayÐoption is 1, an ERRÐINVALID error is reported. Example GTD 1 Byte sequence: 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: Bit 0 Bits 1 – 4 Bits 5 – 7 Bit 0 Bits 1 – 5 Bits 6, 7 Description: 1 DTMF code. Where the DTMF code is encoded as follows: Value (Hex) 0 to 9 A B C D E F DTMF Digit 0 to 9 A * Ý GTM 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. Example 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. GT 0D20 0D 20 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. CompactSPEECH 0D 20 Description: 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. http://www.national.com 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. (See the IVS User’s Manual for more details.) B C D Microcontroller 0E 01 AA AA 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. 0 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. Byte sequence: Microcontroller CompactSPEECH 0E 01 E8 29 Generate Tone tone GT To access the nth message, when n l 127, a sequence of GTM commands is required. 36 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 can not 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. Activates (clears to 0) the MWRDY signal. Initializes the tone detectors. 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 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. Note: The command erases all messages and should be used with care. Microcontroller 13 Example CompactSPEECH 13 Description: 29 00 00 00 80 CompactSPEECH 29 00 00 00 80 Echo of Data Description: INIT Byte sequence: Microcontroller MR Initialize the CompactSPEECH. Byte sequence: Microcontroller 2A CompactSPEECH 2A 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. 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. 37 http://www.national.com 2.0 Software (Continued) # (ICM, OGM, memo) The microcontroller sends the R Example command, and uses one of the message tag bits to indicate the caller ID validity. When recording a memo, or an OGM, the caller ID modem is not usually activated, and the contents of the caller ID buffer are therefore meaningless. Later, when the microcontroller uses the GCID command to retrieve the caller ID data, it should read the message tag to verify that the caller ID data is valid. Example P 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. R 000E Byte sequence: Description: Example PA Microcontroller 1C CompactSPEECH 1C Description: 1A CompactSPEECH 1A RDET 20 Put the CompactSPEECH in power-down mode. Byte sequence: PDM Description: Microcontroller 2C 20 CompactSPEECH 2C 20 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. Description: Reset the VOX detector. RES Resume Resumes the activity that was suspended by the PA, SF or SB commands. Example RES Note 1: A time-and-day stamp is automatically attached to each message. Before using the R command for the first time, use the SETD command. Failure to do so results in undefined values for the time-andday stamp. Byte sequence: Microcontroller 1D CompactSPEECH 1D Description: Note 2: The contents of the caller ID buffer are automatically attached to each message. After command execution, the contents of the buffer are undefined. It is the microcontroller’s responsibility to trace the validity of the caller ID data. The message tag can be used for this purpose. 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 . Example of a typical recording session: # (ICM) The microcontroller detects the first ring. # (ICM) The microcontroller sends the ACID command to activate the caller ID modem. # (ICM) The CompactSPEECH reports EVÐNORMALÐ END to indicate a successful caller ID session. The contents of the caller ID buffer are valid. http://www.national.com Reset the busy and dial tone detectors. Reserved. Must be cleared to 0. Reset the no energy (VOX) detector. Reset the DTMF detector. Reserved. Must be cleared to 0. Bit 0 Bits 1 – 4 Bit 5 Bit 6 Bit 7 Example Microcontroller 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. 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. The 1-byte detectorsÐresetÐmask is encoded as follows: Suspend playback of current message. PDM Go To Power-down Mode Switches the CompactSPEECH to power-down mode (see Section 1.3.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: 0C 00 0E CompactSPEECH 0C 00 0E Note: DTMF and tone detectors remain active during Pause. Byte sequence: Microcontroller 38 2.0 Software (Continued) If the current message is undefined, ERRÐINVALID is reported. Trying to read beyond the end of the message will set 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 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 RMSG Data SB 19 The microcontroller must issue an S command to close the message, and switch the CompactSPEECH to the IDLE state. Byte sequence: Microcontroller 32 CompactSPEECH 32 Description: AA AA ... Byte sequence: 32 bytes of data Description: 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 s 00 CompactSPEECH 00 Description: Stop current activity (e.g., playback, recording) and put the CompactSPEECH in IDLE state. 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 SDET A3 Byte sequence: Description: 10 A3 Set reporting of all CompactSPEECH detectors, except for end-of-DTMF. SE Microcontroller 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 1E 00 03 CompactSPEECH 1E 00 03 Description: Microcontroller CompactSPEECH 10 A3 SAS 00 03 Byte sequence: Skip back five seconds from the current position in the message being played. SDET 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: 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 SMSG, WMSG, RMSG and all asynchronous commands. Example Microcontroller 23 00 19 CompactSPEECH 23 00 19 Read 32 bytes from the current message memory. RRAM Read Memory Exists for compatibility only. Use RMSG instead. Byte sequence: Microcontroller Announce the first sentence in the sentence table of the currently selected vocabulary with ‘‘3’’ as the actual parameter. SE SB Skip Backward timeÐlength Skips backward in the current message timeÐlength units, each of 0.2 sec duration, and causes message playback to pause. timeÐlength is a 2-byte parameter that can have any value up to 320, i.e., 64 sec. The skip accuracy is 5%. This command is meaningful only in the PLAY state. The RES command must be issued to continue playback. Byte sequence: Microcontroller 24 CompactSPEECH 24 Description: 39 Skip to end of current message. http://www.national.com 2.0 Software (Continued) SETD Example 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 SNSG 10 Byte sequence: Microcontroller Description: 0F 0E 09 Set time and day to Monday 1:30 AM. Note 1: Message tag bits can only be cleared. Message tag bits are set only when a message is first created. SF Skip Forward timeÐlength Skips forward in the current message timeÐlength units, each of 0.2 sec duration, and causes message playback to pause. timeÐlength is a 2-byte parameter that can have any value up to 320, i.e., 64 sec. 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 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. Example SMT FF F7 Byte sequence: Microcontroller Description: 05 FF F7 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 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 22 00 19 CompactSPEECH 22 00 19 Description: Microcontroller CompactSPEECH 05 FF F7 SF 19 Byte sequence: Set the message pointer to 32 bytes from the beginning of the current message data. 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. CompactSPEECH 0F 0E 09 Description: 30 00 0A CompactSPEECH 30 00 0A SETD 0E09 Byte sequence: Microcontroller Skip forward five seconds from the current position in the message being played. SMSG Set Message Pointer numÐofÐpages Sets 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. SO 00 Byte sequence: Microcontroller 07 00 CompactSPEECH 07 00 Description: http://www.national.com 40 Announce the first word in the word table of the currently selected vocabulary. 2.0 Software (Continued) SPS Set Playback Speed speed SV 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. 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 SPS FB Byte sequence: Microcontroller SV 02 03 16 FB CompactSPEECH 16 FB Description: 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 Byte sequence: Microcontroller 20 02 03 CompactSPEECH 20 02 03 Set playback speed to b5. Description: Select the vocabulary with vocabulary-id 3, which resides on Serial Flash, as the current vocabulary. 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. 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 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, ERRÐPARAM is set in the error word. If the current vocabulary is undefined, ERRÐINVALID is reported. Example SS 00 SW 02 00 00 Byte sequence: Microcontroller 1F 00 Byte sequence: CompactSPEECH 1F 00 Description: Microcontroller 21 02 00 00 CompactSPEECH 21 02 00 00 Announce the first sentence in the sentence table of the currently selected vocabulary. 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. Note: The tunable parameters are assigned with thefr default values on application of power. The INIT command does not affect these parameters. Table 2-2 describes the tunable parameters, their index numbers and their default values. 41 http://www.national.com 2.0 Software (Continued) TABLE 2-2. Tunable Parameters Index 0 Parameter Name CIDÐPARAM0 Description Timeout for Caller-ID detection after activation of the ACID command in 10 ms units. If Caller-ID detection is not completed within this period, ERRÐCID is reported. Default 0 If the value is 0, there is no check for timeout. Legal values: 0 to 65535. 1 CIDÐPARAM1 If the Caller-ID physical layer is V.23 or Bell202: Timeout for SMMR signal detection after activation of the ACID command in 10 ms units. 0 The value should be computed as follows: The maximum time as defined in the standard, less the time between end of first ring until activation of the ACID command, plus 20 ms. For the French Caller-ID the value should be 154 assuming zero delay between the end of the first ring to ACID activation. The default value is for the USA Caller-ID where the timeout is not defined. If the Caller-ID physical layer is DTMF: Maximum time for starting code (See CIDÐSTARTÐENDÐCODES) detection after activation of the ACID command in 10 ms unit. For the Dutch Caller-ID the value should be 80. If this timeout elapses, ERRÐCID is reported. If the value is 0, there is no check for timeout. Legal values: 0 to 65535. 2 CIDÐPARAM2 If the Caller-ID physical layer is V.23 or Bell202: Timeout for MARK signal detection after SMMR signal in 10 ms units. 0 For the French Caller-ID the value should be 8. The default value is for the USA Caller-ID where the timeout is not defined. If the Caller-ID physical layer is DTMF: Maximum time between two consecutive DTMF codes. For the Dutch Caller-ID the value should be 50. If this timeout elapses, ERRÐCID is reported. If the value is 0, there is no check for timeout. Legal values: 0 to 65535. 3 CIDÐPARAM3 If the Caller-ID physical layer is V.23 or Bell202: Timeout for message type detection after valid SMMR signal in 10 ms units. 0 For the French Caller-ID the value should be 46. The default value is for the USA Caller-ID where the timeout is not defined. If this timeout elapses, ERRÐCID is reported. If the value is 0, there is no check for timeout. Legal values: 0 to 65535. If the Caller-ID physical layer is DTMF: Defines the maximum number of DTMF codes (digits) in the message body that is supported by the standard. For the Dutch Caller-ID the value should be 17. No error is reported if the number of codes exceeds the parameter value however, the field overflow bit in the status byte of the Caller-ID data will be set. (See the GCID command for more details) Legal values: 0 to 46. 4 ÐSILÐTHRESHOLD 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. Legal values: 9216 to 13824 in 512 (6 dB) steps. http://www.national.com 42 11264 2.0 Software (Continued) TABLE 2-2. Tunable Parameters (Continued) Index Parameter Name Description Default 5 ÐSILÐTHRESHOLDÐSTEP Defines the adaptive threshold changes step. If this threshold is too low, the threshold converges too slowly. If it is too high, silence detection is too sensitive to any noise. 6 ÐSILÐBURSTÐTHRESHOLD The minimum time period for speech detection, during silence. As this threshold increases, the time period interpreted as silence increases. 12 Legal values: 3 to 48. 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. 1 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. 8192 If you divide (multiply) the default value by two, the synthesized silence is 6 dB less (more) than the level of the recorded silence. Legal values: 1024 to 16384. 10 VOXÐENERGYÐTHRESHOLD 11 Reserved 12 VOXÐTIMEÐCOUNT 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. 12 Legal values: 0 to 65535. This constant, in units of 10 ms, determines the period of silence before the CompactSPEECH reports silence. 700 The accuracy of the constant is g 10 ms. Legal values: 0 to 65535. 13 – 14 Reserved 15 VOICEÐSYNTHESISÐLEVEL Controls the energy level at which internal vocabulary words are output. 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 VOICEÐSYNTHESISÐ LEVEL and the VOLÐLEVEL variable, controlled by the VC (Volume Control) command. Synthesized speech is distorted if the level is set too high. The valid range is: 0 s VOICEÐSYNTHESISÐLEVEL a VOLÐLEVEL s 12. 16 TONEÐGENERATIONÐLEVEL 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. The valid range is: 0 s TONEÐGENERATIONÐLEVEL a VOLÐLEVEL s 12. 43 http://www.national.com 2.0 Software (Continued) TABLE 2-2. Tunable Parameters (Continued) Index Parameter Name 17 Reserved 18 TONEÐTIMEÐCOUNT Description 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. Default 700 Legal values: 0 to 65535. 19 TONEÐONÐENERGYÐTHRESHOLD 20 TONEÐOFFÐENERGYÐTHRESHOLD 21 VCDÐLEVEL 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 3 dB decrease (increase) in the threshold. 160 Legal values: 0 to 65535. 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 3 dB decrease (increase) in the threshold. 110 Legal values: 0 to 65535. 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. The valid range is: 0 s VCDÐLEVEL a VOLÐLEVEL s 12. 22 VOXÐTOLERANCEÐTIME Controls the maximum energy-period, in 10 ms units, that does NOT reset the vox detector. 23 MINÐBUSYÐDETECTÐTIME Minimum time period for busy detection, in 10 ms units. The accuracy of the constant is g 10 ms. 24 ECHOÐDELAY 25 Reserved 26 DTMFÐREVÐTWIST 3 Legal values: 0 to 255. 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. http://www.national.com 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). 44 0 2.0 Software (Continued) TABLE 2-2. Tunable Parameters (Continued) Index 27 Parameter Name DTMFÐTWISTÐLEVEL Description Default 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 at each tone, as measured at the output of a TP3054 codec (before the DAA) connected to the CompactSPEECH is summarized in the following table: 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 measurements 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 CIDÐRECEIVEÐSENSITIVITY If the Caller-ID physical layer is V.23 or Bell202: Defines the minimum energy level, in dBm, on the codec input, above which the Caller-ID signal is detected. b 36 Legal values: b26 to b38. 29 Reserved. 30 CIDÐSTARTÐENDÐCODES If the Caller-ID physical layer is DTMF: Defines the starting DTMF code (high nibble) and ending DTMF code (low nibble). The default value follows the Dutch Caller-ID specification which defines the ‘‘D’’ DTMF as the starting code and the ‘‘C’’ DTMF as the ending code of the Caller-ID data. 45 254 http://www.national.com 2.0 Software (Continued) 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 . 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 the 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), 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 Note: When updating an existing message, bits can only be cleared, but not set. If the current message is undefined, ERRÐINVALID is reported. VC 04 Byte sequence: Description: 28 04 Example CompactSPEECH 28 04 WMSG 32 bytes Microcontroller Set the volume level to VCDÐLEVEL a 4. Microcontroller 31 32 bytes of data to write Byte sequence: CompactSPEECH 31 echo 32 bytes of data 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. http://www.national.com Description: Create a message with tag e 01, and write 32 bytes in the message memory. WRAM Write Memory tag, data This command exists for compatibility only. Use WMSG instead. 46 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 a TP3054 codec and TL/EE/12585 – 31 an NSAM266SC controlling a Serial Flash device. 47 http://www.national.com http://www.national.com TL/EE/12585 – 32 Appendix A (Continued) 48 TL/EE/12585 – 33 Appendix A (Continued) 49 http://www.national.com http://www.national.com TL/EE/12585 – 34 Appendix A (Continued) 50 TL/EE/12585 – 35 Appendix A (Continued) 51 http://www.national.com http://www.national.com 52 Physical Dimensions inches (millimeters) 100-Pin Molded Plastic Quad Flatpak (EIAJ) Order Number NSAM266SCA/VLJ NS Package Number VLJ100A 53 http://www.national.com NSAM266SC CompactSPEECH Digital Speech Processor with Caller-ID Support Physical Dimensions inches (millimeters) (Continued) 68-Pin Plastic Leaded Chip Carrier (V) Order Number NSAM266SCA/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.