ZLS38502 Firmware for Advance Hands-free Speaker- Phones Firmware Data Sheet Features April 2009 • Selectable Acoustic and Line Echo Cancellers (AEC & LEC) with patented Psycho acoustic Noise Reduction • Narrow band (8 kHz sampling) and Wide band (16 kHz sampling) operation. • Programmable echo tail cancellation length from 8 to 256 ms • AEC and Noise Reduction bypass for handset operation • Psycho acoustic Noise reduction - up to 20 dB for white noise and up to 30 dB in a typical car environment • Non-linear Echo Controller • 16/22 band equalizer in the Sout and Rout path • Handles up to 6 dB line echo return loss measured from Sout to Rin • Programmable Tone Generator to generate, DTMF, SF, MT and tone ringer. • No divergence due to double-talk (patented Adaption Control) • Programmable gain at Rin, Sin and Sout to accommodate system requirements • User gain control provided on speaker range (Rout) from -21 dB to +24 dB in 0.375 dB steps • Programmable DC offset nulling filter cutoff frequency on send and receive paths • 16-bit linear coding at acoustic interface (Rout & Sin) • Programmable coding (μ/A-law ITU-T G.711 or 8-bit sign magnitude or 16-bit linear) at Line interface (Sout & Rin) • Superior voice quality with patented NonLinear Processor (NLP) • Patented Clipping Compensation • Patented Narrow-band signal divergence protection • Provides mute capability on Rout and Sout independently • Patented Anti-howling - prevents oscillation in echo canceller audio path • Speaker path AGC (Rout) • G.169 ALC in the Sin to Sout path • Application specific tuneable performance • Run-time programmable parameters Master Bypass Acoustic Echo Canceller AEC Bypass Sin Null HPF SIN Gain Double Talk Detect Acoustic Echo Path ALC - Adaption Control Narrow Band Signal Detect XRAM Gain Limiter Rout Σ ROUT Gain Non Linear Echo Control Psycho -acoustic NR EQ Adaptive Filter Howling Detect AGC NLP Tone Generator SOUT Gain Line Echo Canceller Limiter Adaptive Filter Narrow Band Signal Detect To Howling Detector EQ NLP -Σ Sout Double Talk Detect Adaption Control From LEC Receive Path A/μ or Linear Null HPF LEC Bypass Master Bypass Figure 1 - Firmware Functional Block Diagram 1 Zarlink Semiconductor Inc. Zarlink, ZL and the Zarlink Semiconductor logo are trademarks of Zarlink Semiconductor Inc. Copyright 2009, Zarlink Semiconductor Inc. All Rights Reserved. A/μ or Linear Line Echo Path Rin ZLS38502 Applications • Full duplex speaker-phone for digital telephone • Full duplex speaker-phone for analog telephone • Echo cancellation for video conference systems • Intercom system for Home Analog Speaker 2 Zarlink Semiconductor Inc. Firmware Data Sheet ZLS38502 Firmware Data Sheet Table of Contents 1.0 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.0 Firmware Algorithm Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1 Acoustic Echo Canceller (AEC) Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.1 Linear Acoustic Echo Cancellation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.2 Non Linear Echo Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Line Echo Canceller (LEC) Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 Noise Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4 Adaptation Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4.1 Echo Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.5 Non-Linear Processor (NLP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.6 Narrow-band Signal Detector (NBSD). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.7 Howling Detector (HWLD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.8 16/22 Band Equalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.9 Programmable High Pass Filter (Offset Nulling Filter). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.10 Limiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.11 Automatic Gain Control (AGC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.12 G.169 Automatic Level Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.13 User Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.14 Programmable Gain Pads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.15 Mute Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.16 Master Bypass. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.17 AEC Bypass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.18 Stereo Audio Bypass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.19 Audio Mixing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.20 Broadcast Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.21 Dynamic Range Compression. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.22 Half Duplex Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.22.1 Automatic Half Duplex Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.22.2 Switched Attenuation Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.23 Coefficient Pre-loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.23.1 Coefficient Save to FLASH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.23.2 Coefficient Automatic down load from FLASH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.23.3 Manual Pre-load. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.24 Tone Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.25 Side Tone Insertion (Sin to Rout) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3 Zarlink Semiconductor Inc. ZLS38502 1.0 Firmware Data Sheet Functional Description ZLS38502 is firmware that runs on the ZL38004 (Advanced Acoustic Echo Canceller with Noise Reduction) hardware platform to realize audio applications requiring acoustic echo cancellation and noise reduction. This firmware and hardware combination is a hands free communication processor that is ideal for Full-duplex VoIP Speaker Phone (Figure 2) and Full-duplex Analog Speaker Phone (Figure 3) Applications. ZLS38502 Microphone ΣΔ CODEC Noise Reduction Sin Sout LEC AEC Rout VoIP PCM Processor Ethernet Rin Speaker Figure 2 - Full-duplex VoIP Speaker Phones ZLS38502 Microphone ΣΔ CODEC Noise Reduction Sin Sout LEC AEC Rout Rin ΣΔ CODEC 4W COIC 2W To PBX/ PSTN Speaker Analog Interface COIC - Central Office Interface Circuit Figure 3 - Full-duplex Analog Speaker Phones Hands-free Car Kit (Cable & BlueTooth) 2.0 Firmware Algorithm Description The ZLS38502 firmware implements both an linear and non linear Acoustic Echo Canceller (AEC), Line Echo Canceller (LEC), Psycho acoustic Noise Reduction (PNR), equalizers and tone generation circuit and using the DSP block of the ZL38004. The AEC cancels echo that originates at the speaker to microphone interface of Figure 3 and Figure 4. The LEC cancels echo that originates in the telephone network. This AEC and LEC combination supports full-duplex echo cancellation for analog speakerphone applications. The processing of the AEC, NR and LEC firmware blocks is done on 16-bit digital audio. Each of these firmware blocks may be bypassed to realize stand-alone AEC, LEC or PNR functionality, see Figure 3, Full Duplex VoIP Speaker Phone. The ZL38004 filter co-processor can cancel up to 256 ms (@ 8 kHz sampling) echo tail. This capacity is shared between the AEC and the LEC is programmable in 16 ms steps. For example, if the AEC is 4 Zarlink Semiconductor Inc. ZLS38502 Firmware Data Sheet programmed to cancel 192 ms of echo tail, then the LEC can cancel up to 64 ms of echo tail (@ 8 kHz sampling). If the LEC is bypassed, then the AEC can cancel echo tails of up to 256 ms. Table 1 describes the virtual input/output signals of Figure 1. These signals are associated with specific ZL38004 I/O blocks (i.e., ΣΔ CODEC[1:0], PCM Port 0/1 and I2S Port) through the ZLS38502 Firmware. Name Description Sin Send In: A stream of 16-bit linear encoded audio samples that originate at the acoustic (microphone) side of an application. Audio signals are sampled by the ΣΔ CODEC[1:0] converted to 16-bit linear format and passed to the ZLS38502 firmware at Sin. Rout Receive Out: A stream of 16-bit linear encoded audio samples that originate from the network (line) side of an application and have been processed by the ZLS38502 firmware. This digital audio data is then passed to the ΣΔ CODEC[1:0] (Digital-to-Analog Converter) at Rout and the resulting analog audio signal is used to drive a speaker. The signal level at Rout can be adjusted from -21 to +24 dB in 3 dB steps. Rin Receive In: A stream of 16-bit linear encoded audio samples that originates from the network (line) side of an application. Audio signals are either sampled by the ΣΔ CODEC[1:0] and converted to a digital audio or are transported by a digital interface (PCM Port 0/1 or I2S Port), and passed to the ZLS38502 firmware at Rin. Digital audio data at Rin may be either μ/A-Law ITU-T G.711 or 8-bit sign magnitude, as well as 16-bit linear. The ZLS38502 converts these forms to 16bit linear format for processing. See Figure 1. Sout Send Out: A stream of either μ/A-Law ITU-T G.711 or 8-bit sign magnitude or 16-bit linear encoded audio samples that originates from the acoustic (microphone) side of an application and has been processed (16-bit linear) by the ZLS38502 firmware. This signal is either passed to the ΣΔ CODEC[1:0] (Digital-to-Analog Converter) or a digital interface (PCM Port 0/1 or I2S Port). See Figure 1. Table 1 - ZLS38502 Firmware Virtual Input/Output Signals The ZLS38502 firmware implements the following functions: • Adaptive Filter: continuously adapts to the echo path and uses this data to cancel the acoustic or line side echo • NLP: Non-Linear Processor reduces residual echo to a negligible level • Double-Talk Detector: detects double-talk conditions so they do not adversely affect the NLP and adaptive filter operations • Non-Linear Echo Control: is provided to compensate for non linearities in the speaker/mic circuitry • Advanced Noise Reduction: reduces background noise from the near-end speech signal (Sin) • Rout Equalizer: a 16 band equalizer is placed in the Rout path to compensate for bandwidth limitations in the speaker • Sout Equalizer: a 16 band equalizer is placed in the Sout path • G.169 ALC: Automatic Level Controller in the Sin to Sout path • AGC: Automatic Gain Control for the speaker output (Rout). • Gain Pads: used to adjust signal levels at Sin, Sout and the AEC adaptive filter. The Sin Gain Pad is adjustable from -24 to +21 dB in 1.5 dB steps; Gain Pads for Sout and XRam are adjustable from -24 to +21 dB in 3 dB steps. • User Gain (Rout Gain): adjusts speaker volume at Rout from -24 to +21 dB in 3 dB steps • Clipping Compensation: adjusting the analog and digital gain stages to minimize clipping at the audio input • Narrowband Detector: detects narrowband signals coming from the acoustic or line side interfaces. Prevents narrowband signals from adversely affecting adaptive filter operation 5 Zarlink Semiconductor Inc. ZLS38502 Firmware Data Sheet • Offset Nulling filter: removes DC signals from the Rin and Sin inputs • Limiter: used to limit Rout and Sout signals to defined maximum values • Howling detector: detects howling caused by positive feedback in the loop. When howling is detected, the AGC gain is reduced to eliminate the howling. • A/μ-Law or Linear: converts 8-bit μ-law, A-law or sign magnitude PCM to 16-bit linear data, or passes 16-bit linear data unaltered. The A/μ-Law converters are only on the Rin and Sout ports. 2.1 Acoustic Echo Canceller (AEC) Description The Acoustic echo canceller section is contains two functional blocks, a linear acoustic echo canceler and a non linear echo controller. The linear echo canceller is used to remove the linear portion of the echo produced by the direct coupling between the speaker and microphone and the room acoustics (this is majority of the acoustic echo). The non- linear echo controller is used to remove non linear echo caused by the speaker (produced when the speaker is driven to maximum capability). 2.1.1 Linear Acoustic Echo Cancellation The AEC provides high performance full-duplex operation similar to network echo cancellers. That is, the AEC will provide clear speech and uninterrupted background signals that occur during normal conversations, without the sound quality problems associated with “noise gating” or “noise contrasting”. The AEC does not use variable attenuators during double-talk or single-talk periods of speech, as do many other "full duplex" speakerphone acoustic echo cancellers. This guarantees clear signal transmission in both transmit and receive audio paths even in the presence of low level signals. The AEC uses an advanced adaptive filter algorithm that is double-talk stable, allowing convergence even when both parties are talking. This algorithm continuously tracks changes in the echo path, regardless of double-talk, as long as a reference signal is present. The echo tail length of the AEC is programmable up to 256 ms in 16 ms steps in 8 kHz sampling mode (Note: this 256 ms maximum capacity is shared with the LEC). The typical initial convergence time of the AEC is less than 1 s. Figure 4 illustrates a typical acoustic echo profile created by a vehicle passenger compartment. 1 0.8 0.6 Echo Signal Level Amplitude 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 0 20 40 60 80 100 t (ms) 120 140 160 Echo Delay (ms) Figure 4 - Typical Acoustic Echo Profile 6 Zarlink Semiconductor Inc. 180 200 ZLS38502 2.1.2 Firmware Data Sheet Non Linear Echo Controller The non-linear echo controller is used to enhance the performance of the linear acoustic canceller and attenuate any remaining residual echo caused by non-linearities in the echo path. These non -linearities can be caused by over driving either the speaker driver or the speaker itself. The non linear controller can decrease the residual echo caused by non linearities by up to 20 dB. During double talk periods (when both parties are talking at the same time) the non-linear echo controller can cause minor distortion in the signal coming from the Sin microphone. There is a trade-off between the amount of non linear echo reduction and distortion which can be tuned by the user. During a live conversation this distortion is not noticeable since the distortion is masked by the talker’s voice. 2.2 Line Echo Canceller (LEC) Description The LEC filter adapts to the echo path and generates an estimate of the echo signal. This echo estimate is then subtracted from the echo path. The echo tail length of the LEC is programmable up to 256 ms in 8 ms steps (Note: this 256 ms maximum capacity is shared with the AEC). 2.3 Noise Reduction The ZLS38502 Noise Reduction block (see Figure 5) uses psychoacoustic to provide superior subjective noise reduction without distortion to the voice. Figure 5 shows the block diagram of the noise reduction algorithm. The noisy speech signal is first converted to the frequency domain and then signal power levels are calculated for individual frequency bins. The speech signal power and noise signal power are estimated based on the power level calculation for each bin. These two new estimated power levels are used to adaptively generate noise reduction coefficients that are applied to the noisy speech signal. This result is converted back to the time domain to produce a noise reduced output. The noise reduction level is programmable so the user can adjust the level of noise cancellation to meet system requirements. A larger value in this register will increase the amount of noise reduction The results of the psycho acoustic noise reduction shows that 6 dB of noise reduction using psycho acoustic techniques is subjectively equivalent to 12 dB of noise reduction but with less distortion. Noisy Speech Time Domain to Frequency Domain X Power per Bin Estimated Noise Estimated Speech Frequency Domain to Time Domain Speech Power Noise Power Noise Reduction Coefficients Figure 5 - Spectral Noise Reduction Block Diagram 7 Zarlink Semiconductor Inc. Noise Reduced Output ZLS38502 2.4 Firmware Data Sheet Adaptation Control The adaptation control block regulates the convergence speed of the adaptive filter. When adaptation is disabled by the user the current echo profile is frozen and used to continue cancelling echo. In this state, changes in the echo path are not tracked. Additionally, the Adaptation Control block supports the following: • Freeze filter adaptation when narrow-band signal is detected • Freeze filter adaptation when no active far-end speech appears • Increase convergence speed when active near-end speech is absent • Decrease convergence speed when low level double talk is present • Decrease convergence speed further (or freeze adaptation) when high-level double talk is detected 2.4.1 Echo Profiling The ZLS38502 firmware allows the user to profile the adaptive filter to provide optimum performance. The adaptive filter is segmented into profile slices. Each slice is 16 ms long. The adaptation speed can be programmed for each individual slice allowing the user to pre-model the echo path (see Figure 6). This feature is primarily used in profiling acoustic echo where the first echo to return is from the direct coupling between the microphone and the speaker and is generally the largest reflection (also this reflection rarely changes since the microphone and speaker locations are fixed). All others are reflections from the room and decrease in amplitude over time (these reflections may change due to movement in the room). The default profiler parameters have the adaptation speed set to fast for the first few slices then decreasing over time. The recommended profiling values for 128 ms/64 ms and 256/128 ms settings are provided in Table 2. Adaptation Speed 0h(Full speed) Fh (Frozen) Slice 15 Slice 14 Slice 13 Slice 12 Slice 11 Slice 10 Slice 9 Slice 8 Slice 7 Slice 6 Slice 5 8kHz 16 32 48 64 80 96 112 128 144 160 16kHz 8 16 24 32 40 48 56 64 72 80 Delay (ms) Figure 6 - Filter Profiling 8 Zarlink Semiconductor Inc. Slice 4 Slice 3 176 88 Slice 2 Slice 1 Slice 0 192 208 224 240 96 104 112 120 256 128 t ZLS38502 Firmware Data Sheet Register Address Slice value 128 ms @ 8 kHz sampling 64 ms @ 16 kHz Slice value 256 ms @8 kHz sampling 128 ms @ 16 kHz 0x0494 0x4567 0x6677 0x0495 0x0123 0x4455 0x0496 0x0000 0x2233 0x0497 0x0000 0x0011 Table 2 - Recommended Profile Register Settings There are three profiling parameters that can be set by the user. These are: • The echo tail length - The echo tail length for the AEC and LEC is programmable from 0 ms up to 256 ms in 16 ms steps in 8 kHz sampling mode (Note: the 256 ms maximum capacity is shared between the AEC and LEC). • Flat delay - Programming the flat delay register causes the AEC not to converge on any echoed signal within the flat delay window. The flat delay window starts at tap 0 and can be any number of tap providing a grandularity of 125 us (8 kHz sampling). This feature is only used if the echo profile is predetermined. This feature is rarely used and is disabled by default. • Per slice adaptation speed - The user can program the adaptation speed for every slice. The slice locations are fixed, therefore if a slice is located in the flat delay window or allocated to the LEC then the adaptation speed is over written. The adaptation speed for each slice can be programmed from full speed (0h) to virtually frozen (Fh). The speed can be calculated using the following equation. FullSpeed AdaptiatonSpeed = ----------------------------Slicevalue 2 Full speed is 80 dB/s attenuation based on white noise. For example if the slice value is 2 then the adaptation speed is 1/4 full speed. 2.5 Non-Linear Processor (NLP) When the AEC/LEC functions have converged and a single talk (i.e., Rin to Rout incident audio signal; no return Sin to Sout audio, or Sin to Sout incident audio signal; no return Rin to Rout audio) condition exists there will be low level echo on the return path due to ADC and DAC quantization errors. The AEC/LEC echo cancellation algorithms cannot predict quantization errors; therefore, this small amount of echo (i.e., residual echo) will not be cancelled. The NLP algorithm, illustrated in Figure 7, replaces this residual echo signal with a comfort noise signal that has the same signal strength and same spectral characteristics as the original signal. During normal operation when the input signal level of the NLP is below the background noise level, the filter of Figure 7 will learn the background noise level through switch SW1. When the input signal level is above the background noise level and the signal is residual echo, the filter input will be zero through SW1 and the filter output signal will pass through SW2 to Sout. When the input signal level is above the background noise level and the signal is not dominated by residual echo SW2 will bypass the NLP and the filter input will be connected to zero. 9 Zarlink Semiconductor Inc. ZLS38502 AEC (LEC) Sin (Rin) Firmware Data Sheet Non Linear Processor Residual Echo Σ SW2 Sout (Rout) - SW1 Filter Adaptive Filter Echo Path "0" NLP Control Rin (Sin) Rout (Sout) Sin (Rin) Rout (Sout) Echo Audio Sout (Rout) Sin (Rin) Rin (Sin) Rout (Sout) Single-Talk Audio + Echo Audio Sout (Rout) Rin (Sin) Double-Talk Figure 7 - NLP Block Diagram 2.6 Narrow-band Signal Detector (NBSD) Narrow-band signals such as single or multi-frequency tones (i.e., DTMF or signalling tones) present at the reference input of an echo canceller for a prolonged period of time may cause the adaptive filter to diverge. The Narrow-band Signal Detector (NBSD) is designed to prevent this divergence by first detecting single or multifrequency tones of arbitrary frequency, phase, and amplitude. When these narrow-band signals are detected, the echo canceller continues to cancel echo, but the filter adaptation process is stopped. 2.7 Howling Detector (HWLD) The Howling detector (see Figure 1) is part of an Anti-Howling control algorithm that prevents oscillation as a result of positive feedback on the audio paths. When howling is initially detected the AGC at Rout will reduce the signal level by 6 dB. If howling persists then the AGC will decrease the signal level by an additional 6 dB. This continues until the howling stops. At this point the AGC will increase the gain to determine if the howling begins again. If it does then the AGC gain is reduced again. If the howling condition does not exist then the AGC will increase its gain in 6 dB steps until the user defined signal level (without howling) is reached. 2.8 16/22 Band Equalizers Two equalizers are used to aide the user to optimize the performance and sound quality of the hands free device. The two equalizers are 16 band (@ 8 kHz sampling) or 22 band (@16 kHz sampling). These equalizers are placed in the Rin/Rout and Sin/Sout paths. Although the operation of these two equalizers are the same, they serve two different functions. The equalizer at Rout is used to improve the audio quality at the speaker. This is needed since most smaller speakers have a poor response at lower frequencies producing a "tinny" output. The Rout equalizer can be used to amplify the lower frequencies. Figure 8 shows an example of the frequency response of a speaker. In this case the lower frequencies are attenuated and there is area of lower response at 1 kHz. The Rout equalizer can be used to amplify these regions and produce a flatter response. Note: the equalizer must not be changed during an active call. This may cause an audible divergence of the AEC for a period of time until the AEC reconverges. 10 Zarlink Semiconductor Inc. ZLS38502 Firmware Data Sheet Figure 8 - Example Speaker Response 2.9 Programmable High Pass Filter (Offset Nulling Filter) Programmable high pass filters are placed at the Sin and Rin ports, see Figure 1. These filters have two functions: to remove any DC offset that may be present on either the Rin or the Sin ports; and second, to filter low frequency (below 100 Hz) noise such as road noise. 2.10 Limiters The limiters on the send and receive paths (See Figure 1) prevent the Rout and Sout output signal levels from exceeding a preset limit. This is to ensure that the linear region of the speaker is not exceeded. Limiter values are programmable. See registers Upper limit value for Sout. 2.11 Automatic Gain Control (AGC) The Automatic Gain Control (AGC) is used to automatically adjust the input speech level of the audio signal to a predetermined output value. The AGC automatically decreases the speaker path gain during the following conditions: • when clipping of the receive signal occurs at Rout, • when initial convergence of the acoustic echo canceller detects unusually large echo return • when howling is detected 2.12 G.169 Automatic Level Control This block automatically controls the level of the Sin to Sout path and is located at the output of the echo canceller and the input of the noise reduction (NR) block. The range is selectable either (-12 to 6 dB) or (-6 to 12 dB) ALC range. When the ALC is disabled a fixed gain of either 6 dB or 12 dB programmed into the ALC. 2.13 User Gain The User Gain function is used to adjust the speaker volume outside the echo path. This gain is optimally placed outside the echo path so re-convergence is not necessary after gain changes. It is important to use ONLY this gain pad to adjust the speaker volume during normal operation. This gain is adjustable from -24 to +21 dB in 3 dB steps. 11 Zarlink Semiconductor Inc. ZLS38502 2.14 Firmware Data Sheet Programmable Gain Pads The AEC has gain pads associated with Sin, Sout and the AEC adaptive filter (Xram). These gain pads are intended to be set once during initialization and not adjusted during normal operation. Their purpose is to help fine tune the performance of the acoustic echo canceller for a particular application. Sin gain pad is adjustable from -24 to +21 dB in 1.5 dB steps; Sout and Xram gain pads are adjustable from -24 to +21 dB in 3 dB steps. The gain pads can be used to improve audio quality in high echo environments. The AEC can cancel echo with a ERL as low as -10 dB (attenuation from Rout to Sin). In many hands-free applications, the ERL can be very low (or negative) due to speaker and microphone gain settings. The speaker gain has to be set high enough for the audio signal to be heard properly and the microphone gain needs to be set high enough to ensure sufficient signal is sent to the far end. Normally, if the ERL (ERL = Acoustic Attenuation - speaker gain - microphone gain) is greater than 0 dB, then the echo canceller cannot cancel echo. To overcome this limitation, the gain pads at Sin and Sout can be used to lower the Sin level (and therefore the ERL) by 6 dB, perform the echo cancellation then amplify it at Sout by 6 dB. Effectively there will be 0 dB gain between Sin and Sout for double talk signals with an additional 6 dB attenuation of the echo return. It is important to reduce the double talk detection threshold to match the Sin/Sout gain settings. 2.15 Mute Function Mute functions are provided for independent control of the Receive (Rin to Rout) and Send (Sin to Sout) audio paths. Setting mute will transmit quiet code on the Rout or Sout ports. LINEAR 16 bits 2’s complement SIGN/ MAGNITUDE μ/Α-Law CCITT (G.711) μ-Law A-Law 0x0000 0x80 0xFF 0xD5 Table 3 - Quiet PCM Code Assignment 2.16 Master Bypass When the Master Bypass function is active, PCM data passes transparently from Rin to Rout and from Sin to Sout, with bit-wise integrity preserved. When this mode of operation is selected, most internal functions are automatically powered down to reduce power consumption. 2.17 AEC Bypass The AEC bypass function allows send and receive PCM data to pass around the AEC, non linear echo controller, NLP, ALC and noise reduction function) with bit-wise integrity preserved (i.e., the echo estimate from the AEC adaptive filter is not subtracted from the Send path). This mode of operation does not affect the normal operation of other functions. The LEC bypass function allows send and receive PCM data to pass around the LEC function with bit-wise integrity preserved (i.e., the echo estimate from the LEC adaptive filter is not subtracted from the Send path). This mode of operation does not affect the normal operation of other functions. 12 Zarlink Semiconductor Inc. ZLS38502 2.18 Firmware Data Sheet Stereo Audio Bypass The ZLS38502 firmware provides a stereo bypass feature that utilized the CD quality DACs. Rin Rout AEC PCM0 or I2S port DAC0 Algorithms Sout Sin Secondary Channel DAC1 Figure 9 - Stereo Audio Bypass 2.19 Audio Mixing The Firmware allows for a secondary channel to be mix into the Rin path. This is provided to allow announcements to be played to the speaker (at Rout). Since it is mixed at Rin only the near user will hear it and it will be cancelled for the far end user. Secondary Channel PCM0, I2S or Analog Port Rin AEC Rout DAC Sin ADC Algorithms Sout Figure 10 - Audio Mixing 13 Zarlink Semiconductor Inc. ZLS38502 2.20 Firmware Data Sheet Broadcast Mode The firmware provides a broadcast mode that allows the Rout signal to be routed to both DACs. DAC1 PCM0, or I2S Port Rin Sout AEC Algorithms Sout Rout DAC0 Sin ADC Figure 11 - Broadcast Mode 2.21 Dynamic Range Compression The firmware provides dynamic range compression. This simply attenuates the portion of a voice sample that exceed a certain threshold. This is used to limit the level of distortion that might occur if the signal was allow to hard clip. The dynamic range compression comprises of 4 regions. Each region has a specific gain associated to it. If the magnitude of the voice sample falls within this region the portion over the previous threshold will be either amplified or attenuate, depending on the region. To disable a region program 0 into the associated threshold register. Region Gain Setting (dB) 0 0 1 -6 0x0472 Voice samples that are above the threshold in register 0x0472 but below the threshold in 0x0473 will be attenuated by 6 dB 2 -12 0x0473 Voice samples that are above the threshold in register 0x0473 but below the threshold in 0x0474 will be attenuated by 6 dB 3 Hard Limit 0x0474 Any voice sample that has a value above the threshold in register 0x0474 will be hard limited to the value in 0x0474 Register Description Voice samples between 0x0 and the value in register 0x0472 pass through without modification Table 4 - Dynamic Range Compression 14 Zarlink Semiconductor Inc. ZLS38502 Firmware Data Sheet Hard limit Typical settings Gain = -6dB Gain = 0dB Gain= -12dB Register Settings PCM Value OUT 0x0472= 0x5000 0x0473= 0x6000 0x0474= 0x7FFF X1 0 X2 X3 PCM Value IN Figure 12 - Dynamic Gain Compression 2.22 Half Duplex Mode The firmware provides two half duplex mode, these are the automatic half duplex mode and the switch attenuation mode. Both of these mode are disabled by default. 2.22.1 Automatic Half Duplex Mode When active the firmware will enter into half duplex mode when either howling occurs or when the initial convergence does not meet a specified threshold. 2.22.2 Switched Attenuation Mode When in switched attenuation (semi full duplex) mode and firmware will attenuate the Sin signal by a program amount during double conditions. 2.23 Coefficient Pre-loading The majority of echo in a typical speakerphone actually occurs within the plastics of the phone itself. This type of echo is consistent for every call made through the phone. Initial convergence of the AEC can be improved by preloading this echo profile into the filter coefficients. A pre-loaded filter profile means that the echo canceller starts from a solution which is much closer to the final solution (echo in plastics + echo from environment) and initial convergence can appear instantaneous to the end user. 2.23.1 Coefficient Save to FLASH The first step is to converge the echo canceller on the plastics. This can be done by placing the phone/echo canceller in a non-reflective environment and then making a voice call through the phone. The echo canceller will converge on the echo solution (typically all residual echo should be removed within the first second or two of the call). Once it has converged, disable the AEC filter adaptation by setting ADAPTDIS (bit 1) of AEC_CONTROL1 (address 0x44B) high. By setting bit 1 in register 0x0421, the firmware will then copy the filter coefficients to FLASH and then clear bit 1. 15 Zarlink Semiconductor Inc. ZLS38502 2.23.2 Firmware Data Sheet Coefficient Automatic down load from FLASH To preload the filter coefficients first disable the AEC filter adaptation by setting ADAPTDIS (bit 1) of AEC_CONTROL1 (address 0x44B) high. Then set bit 0 (filter load) in register 0x0421. This will automatically load the filter coefficients from FLASH, then enable adaptation and clear bit 0 once the operation is complete. To automatically preload the coefficients during power up disable adaption and enable the preload in the configuration record. 2.23.3 Manual Pre-load Please refer to Application Note TN22767.11 2.24 Tone Generator The ZLS38502 firmware incorporates a programmable tone generator. The following features are supported in the tone generator: • Ability to generate dual or single tone with pre-programmed frequencies. • Ability to generate ring tone. The warble effect is generated using a square wave with programmable duty cycle and frequency. • Two sets of eight pre-programmed frequencies are provided in the user config file where each pair of frequencies can be selected. Overall 16 frequencies can be selected. All frequencies are programmable. • Burst mode support with programmable burst time (from approximately 0 to 4 seconds). During the burst generation of DTMF any modification to the tone generator will be ignored. • Programmable output gain from -18 to 24 dB with 6 dB steps. (Default is 0 dB) • Individual output gain for low and high tones. • DTMF output can be switched to Rout or Sout (or both) outputs. Depending on the selection. During DTMF injection signal passing through Sout or Rout will be switched out. • 2 dB twist support mode for DTMF tones. The twist mode can be enabled or disabled. • No need for adjustment for 16 kHz or 8 kHz sampling mode. All generated frequencies and timings will be the same for 8 kHz or 16 kHz sampling modes 2.25 Side Tone Insertion (Sin to Rout) When the programmable side-tone feature is activated attenuated transmit speech from Sin is fed-back to Rout. The Sin signal is summed with the Rout signal before the AEC so that only the side-tone gain function affects the side-tone level. Side-tone gain may be adjusted from -15 dB to +6 dB in 3 dB steps. 16 Zarlink Semiconductor Inc. For more information about all Zarlink products visit our Web Site at www.zarlink.com Information relating to products and services furnished herein by Zarlink Semiconductor Inc. or its subsidiaries (collectively “Zarlink”) is believed to be reliable. However, Zarlink assumes no liability for errors that may appear in this publication, or for liability otherwise arising from the application or use of any such information, product or service or for any infringement of patents or other intellectual property rights owned by third parties which may result from such application or use. Neither the supply of such information or purchase of product or service conveys any license, either express or implied, under patents or other intellectual property rights owned by Zarlink or licensed from third parties by Zarlink, whatsoever. Purchasers of products are also hereby notified that the use of product in certain ways or in combination with Zarlink, or non-Zarlink furnished goods or services may infringe patents or other intellectual property rights owned by Zarlink. This publication is issued to provide information only and (unless agreed by Zarlink in writing) may not be used, applied or reproduced for any purpose nor form part of any order or contract nor to be regarded as a representation relating to the products or services concerned. The products, their specifications, services and other information appearing in this publication are subject to change by Zarlink without notice. No warranty or guarantee express or implied is made regarding the capability, performance or suitability of any product or service. Information concerning possible methods of use is provided as a guide only and does not constitute any guarantee that such methods of use will be satisfactory in a specific piece of equipment. It is the user’s responsibility to fully determine the performance and suitability of any equipment using such information and to ensure that any publication or data used is up to date and has not been superseded. Manufacturing does not necessarily include testing of all functions or parameters. These products are not suitable for use in any medical products whose failure to perform may result in significant injury or death to the user. All products and materials are sold and services provided subject to Zarlink’s conditions of sale which are available on request. Purchase of Zarlink’s I2C components conveys a license under the Philips I2C Patent rights to use these components in and I2C System, provided that the system conforms to the I2C Standard Specification as defined by Philips. Zarlink, ZL, the Zarlink Semiconductor logo and the Legerity logo and combinations thereof, VoiceEdge, VoicePort, SLAC, ISLIC, ISLAC and VoicePath are trademarks of Zarlink Semiconductor Inc. TECHNICAL DOCUMENTATION - NOT FOR RESALE