The DTMF codec converts keystrokes or digital information into a dual-tone signal during encoding and sends it. During decoding, it detects the presence of keystrokes or digital information in the received DTMF signal. Each key on the telephone keypad is uniquely identified by the row frequency and column frequency shown in Figure 1. The DTMF encoding and decoding scheme does not require excessive computation and can be easily executed concurrently with other tasks in the DSP system.
Figure 1
As shown in Figure 1, a DTMF signal is composed of two superimposed audio signals. The frequencies of the two audio signals come from two pre-assigned frequency groups: row frequency group or column frequency group. Each pair of such audio signals uniquely represents a number or symbol. In order to generate a DTMF signal, the DSP uses software to generate two sine waves and superimposes them before sending them. When decoding, the DSP uses an improved Goertzel algorithm to search for the existence of the two sine waves in the frequency domain. This article discusses the implementation of DTMF encoding and decoding on TI's fixed-point DSP chip TMS320C54x (hereinafter referred to as C54x) series.
1. Generation of DTMF signals
The DTMF encoder is based on two second-order digital sine wave oscillators, one for generating the line frequency and the other for generating the column frequency. By loading the corresponding coefficients and initial conditions into the DSP, only two oscillators can be used to generate the required eight audio signals. The typical DTMF signal frequency range is 700 to 1700 Hz. Selecting 8000 Hz as the sampling frequency can meet the Nyquist condition.
Figure 2
From the block diagram of the digital oscillator pair in Figure 2, the differential equation of the second-order system function can be obtained as follows:
y(n) = -a1y(n-1) - a2y(n-2) (1)
Where a1=-2cosω0, a2=1, ω0=2πf0 /fs, fs is the sampling frequency, f0 is the frequency of the output sine wave, and A is the amplitude of the output sine wave. The initial value of this formula is y(-1)=0, y(-2)=-Asinω0.
The CCITT specification for DTMF signals is that the transmission/reception rate is 10 digits per second, that is, 100ms for each digit. The audio signal representing the digit must last at least 45ms but no longer than 55ms. The rest of the 100ms is silent in order to distinguish between two consecutive key signals.
Figure 3
The programming process is shown in Figure 3. According to CCITT regulations, there must be silence of appropriate length between digits. Therefore, the encoder has two tasks, one is the audio signal task, which generates dual-tone samples, and the other is the silence task, which generates silence samples. After each task is completed, before starting the next task (audio signal task or silence task), the timer variable that determines its duration must be reset. After the silence task is completed, the DSP calls the next digit from the digital buffer, determines the row frequency and column frequency signals corresponding to the digital signal, and determines its initialization parameters a1=-2cosω0 and y(-2)=-Asinω0 according to different frequencies.
The flowchart can be implemented in C language, and the generation of dual-tone signals is implemented by 54x assembly code. The entire program is used as the transmitting serial port interrupt service subroutine of the C54x multi-channel buffered serial port (McBsp). The interrupt is triggered by the external 8000Hz serial port clock, and can process in real time and output DTMF signaling signals through the D/A converter.
2 DTMF signal detection
Detecting DTMF signals in the input signal and converting them into actual numbers is a continuous process in nature, which requires continuous searching for the existence of DTMF signal spectrum in the input data signal stream. The entire detection process is divided into two steps: first, using the Goertzel algorithm to extract spectrum information from the input signal; then checking the validity of the detection result.
2.1 Goertzel algorithm
DTMF decoding is to search for valid line and column frequencies in the input signal. DFT and its fast algorithm FFT can be used to calculate the spectrum of digital signals, and the Goertzel algorithm is faster than FFT when implementing DTMF decoding. FFT can be used to calculate all spectral lines of the signal and understand the entire frequency domain information of the signal. For DTMF signals, only the 8 line/column frequencies and their second harmonic information need to be concerned (the second harmonic information is used to distinguish DTMF signals from sound signals). At this time, the Goertzel algorithm can extract spectrum information from the input signal more quickly.
Figure 4
The Goertzel algorithm is essentially a two-pole IIR filter, and its algorithm principle block diagram is shown in Figure 4. Since the input signal in DTMF detection is a real number sequence, it is not necessary to detect the phase of the eight row/column frequencies, but only to calculate the square of their amplitude.
2.2 DTMF Detector Process
The detection process can be referred to Figure 5. The detection program is used as the McBsp receive interrupt service subroutine of C54x. When each receive interrupt arrives, it indicates that a new sample point has been collected. The sample point value is substituted into formula (2), and the intermediate variable vk(n) of the 8 row/column frequencies is iteratively calculated (k is the digital frequency corresponding to the 8 row/column frequencies) until N=125 samples are collected (at a sampling frequency of 8kHz, it is about 15ms). At this time, the amplitude square of the 8 row/column frequencies |X(k)|2 is calculated according to formula (4). Next, |X(k)|2 is compared with the threshold, and a second harmonic detection is performed to determine a valid audio signal. After the audio signal is mapped to a digital signal, it is compared with the last detected digital signal to finally determine a valid digital signal.
Figure 5
The DTMF signaling detection program is obtained according to the flow shown in Figure 5. The entire program is used as the McBsp receiving serial port interrupt service subroutine of C54x, so that the DTMF signaling signal from the A/D converter can be analyzed in real time.
3 Performance Analysis
Based on the above principles and algorithm codes, the performance of the above DTMF signaling generation and detection scheme is analyzed in Code Composer Studio (CCS), a DSP development environment of TI.
(1) According to the following memory image file report given by CCS, the two core codes of DTMF generation (gen_dtmf.obj) and DTMF detection (de_dtmf.obj) occupy 3e6H and 1e0H words (16-bit word) respectively, that is, about 1K words of memory space, consuming very low system resources;
(2) The generation and detection procedures of DTMF signaling are placed in the McBSP interrupt service subroutine of C54x. The code execution time is analyzed by the CCS code analysis tool. When C54x runs at a main frequency of 100MHz, the DTMF generation interrupt service subroutine interrupt transmit() consumes a maximum of 283 clock cycles, that is, 2.83μs, and the DTMF detection interrupt service subroutine interrupt receive() consumes a maximum of 6148 clock cycles, about 61μs. Therefore, this solution can generate and detect DTMF signaling in real time, and can also ensure time redundancy and concurrent execution with other programs in the user system.
Previous article:SoC-type DSP chip TMS320LF2407 is used in speed measurement and remote transmission
Next article:Design of Imaging Guidance Simulation System Based on DSP Chip TMS320C6418
Recommended ReadingLatest update time:2024-11-16 20:35
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- MicroPython driver for M5stack
- TI DSP simulator type selection
- Smarter: How smart battery fuel gauges can improve battery life in continuous glucose monitors
- The key points of a good brushless motor control chip.
- EEWORLD University ---- HVI Series: Mastering the Robustness of Isolated Gate Drivers - In-depth Research by CMTI
- GigaDevice GD32F350 Competition preliminary review Q&A and judges' comments, paying tribute to our serious judges
- 【GD32L233C-START Review】5. USB custom HID device lighting
- pybCN's UF2 bootloader
- [RVB2601 Creative Application Development] 6. Get weather information
- DIY Wireless Charging Cool Light