Introduction to MAXQ
The MAXQ series of microcontrollers are high-performance 16-bit RISC devices designed for low-noise operation and are ideal for battery-powered mixed-signal applications. MAXQ integrates high-precision analog functions with digital components to reduce the number of chips in the design. MAXQ uses the Harvard memory structure to arrange data, code and register space on different buses. The main advantage of this memory structure is that it has flexible word lengths, and system and peripheral registers can be 8 or 16 bits. Since the instruction word of MAXQ is 16 bits, microcontrollers usually have a 16-bit instruction bus. Another advantage of the Harvard structure is that registers are always used to access memory, so that peripherals such as analog-to-digital converters (ADCs) and hardware coprocessors can be accessed in a direct access manner. MAXQ2000 is the first product in the MAXQ series of microcontrollers. It integrates a 16-bit CPU, 64KB flash memory, 2KB SRAM and a 4 36-segment LCD controller.
Challenges that arise when both control applications and digital signal processing are required
Traditional microcontrollers (MCUs) and digital signal processors (DSPs) are generally considered to be two incompatible machines in the field of microcomputers. MCUs are suitable for control applications that require low-latency response to asynchronous processes, while DSPs excel in high-intensity mathematical calculations. Of course, MCUs can also be used to perform complex arithmetic operations, but because the arithmetic logic unit (ALU) of most MCUs performs one operation at a time, its operation speed is much slower than that of DSPs. Similarly, DSPs are not suitable for control applications due to their internal architecture.
As more and more applications are added to control applications with small amounts of signal processing, choosing between DSPs and traditional MCUs becomes increasingly difficult. In such applications, the solution of embedding DSP code into the MCU is attractive. However, with this approach, most of the application time is spent executing DSP functions, and the control application has to sacrifice. The emergence of the MaxQ architecture solves this problem. In the modular MaxQ architecture, the multiply-accumulate unit (MAC) can be easily integrated. With the use of hardware MAC, 16 16-bit multiply-accumulate operations can be implemented in a single cycle without affecting the task execution on the control processor. The following example shows how to use the MAC module in the MaxQ microcontroller to solve a practical problem.
The mac module is used in conjunction with maxq
For DSP, the most basic application is to filter analog signals. In filtering applications, the appropriately modulated analog signal is provided to the ADC, and the sampled data stream is filtered in the digital domain. The execution process of a conventional filter can be implemented by the following formula:
Where Bi and Ai are the characteristic values of the system feedforward and feedback responses, respectively. According to the values of Ai and Bi, digital filters can be divided into two categories: finite impulse response (FIR) filters and infinite impulse response (IIR) filters. When the system does not contain any feedback elements (that is, all Ai = 0), the filter is of FIR type, and its equation is:
When the elements of Ai and Bi are not 0, the filter is of IIR type.
From formula (2), we know that the main mathematical operation of the FIR filter is to multiply each sample input by a constant, and then accumulate each product, which is performed n times in total. It can be explained by the following C language program segment:
y[n]=0;
for(i=0;i小于n;i++)
y[n]+=x[i]*b[i]
For a microprocessor with a multiplier unit, it can be implemented according to the following pseudo code:
move ptr0, #x ;primary data pointer -> samples
move ptr1, #b ;secondary dp -> coefficients
move ctr, #n ;loop counter gets number of samples
move result, #0 ;clear result register
acc_loop:
move acc, @ptr0 ;get a sample
mul @ptr1 ;multiply by coefficient
add result ;add to previous result
move result, acc ;...and save the result back
inc ptr0 ;point to next sample
inc ptr1 ;point to next coefficient
dec ctr ;decrement loop counter
jump nz, acc_loop ;jump if there are more samples
end
Thus, even though there is a multiplier, the multiplication and accumulation loop requires 12 instructions and (assuming a single-cycle unit and multiplier) 4+ 8n cycles. The same operation is done in the multiplication-accumulation unit of the maxq, the code space is reduced from 12 words to 9 words, and the running time is reduced from 4+ 8n cycles to 4 +5n cycles. The code implementation is as follows:
move dp[0], #x ; dp[0] -> x[0]
move dp[1], #b ; dp[1] -> b[0]
move lc[0], #loop_cnt ; lc[0] -> number of samples
move mcnt, #init_mac ; initialize mac unit
mac_loop:
move dp[0], dp[0] ; activate dp[0]
move ma, @dp[0]++ ; get sample into mac
move dp[1], dp[1] ; activate dp[1]
move mb, @dp[1]++ ; get coeff into mac and multiply
djnz lc[0], mac_loop
It is important to note that in the MAXQ multiply-accumulate unit, when the second operand is loaded into the unit, the requested operation is automatically performed and the result is stored in the MC register. It should also be noted that the length of the MC register is 40 bits, which allows a large number of 32-bit multiplication results to be accumulated before overflow, which is an improvement over the traditional method, where overflow detection must be performed after each basic operation. To illustrate how to use MAC efficiently in the signal processing flow, a simple application for a dual-tone multi-frequency (DTMF) transceiver is listed.
dtmf Overview
DTMF (Dual Tone Multitre-Quency) is a signaling technology used in telephone networks to transmit address information from network terminals (telephones or other devices) to switches. The mechanism is to use two groups of four independent tones, each with no harmonic correlation between them, such as a "low frequency group" (below 1 kHz) and a "high frequency group" (above 1 kHz). Each digit on the telephone keypad can be represented by exactly one tone in the low frequency group and one tone in the high frequency group. Figure 1 shows the distribution of these tones.
Tone encoder for dtmf transceiver
The encoder portion of the dtmf transceiver is straightforward and requires two digital sine oscillators, each of which can be tuned to one of four low-frequency group frequencies or high-frequency group frequencies.
There are many ways to solve the problem of digitally synthesizing a sine wave.
One way to generate a sine wave is to avoid the digital synthesis problem completely and just filter the square wave generated by the port pin strongly. Although this method is effective in many applications, the technique does not meet the Bellcore (Bell Communications Research Institute) requirements for the spectral purity of the sine wave. The second method is to use a lookup table to generate the sine wave. In this method, 1/4 of a sine wave is stored in a ROM table, which generates the required waveform based on pre-calculated interval sampling. However, it takes a lot of memory to generate a 1/4 sine table with high enough resolution to meet the spectral requirements, so this method is not usually used. Another relatively good method is to use a recursive digital resonator to generate a sine wave.
The sine wave generated by the recursive digital resonator is shown in Figure 2. The resonator is implemented as a two-pole filter and can be described by the following difference equation:
Where k is a constant defined as:
Since the DTMF dial requires only a small number of tones, the eight values of k can be precomputed and stored in ROM. For example, the constant required to produce a 770 Hz line frequency tone at an 8 kHz sampling rate is:
There is also a value that must be calculated, namely the initial pulse required to start the oscillator. Obviously, if xn-1 and xn-2 are both 0, each subsequent xn will be 0. To start the oscillator, set xn-1 to 0 and xn-2 to:
In this example, assuming that a unit sine wave is required, equation (6) can be simplified to:
It is easy to express the above process in code: Initialize two intermediate variables x1 and x2. x1 is initialized to 0, and x2 is loaded with the initial excitation value (calculated in equation (7) above) to start oscillation. Perform the following operations to generate a single sample of the sine wave:
x0=k*x1-x2;
x2=x1;
x1=x0;
Each new sine value is calculated using a multiplication and a subtraction. Using the single-cycle hardware MAC on the MAXQ microcontroller, a sine wave can be generated with the following code:
move dp[0], #x1 ; dp[0] -> x1
move mcnt, #init_mac ; initialize mac unit
move ma, #k ; ma=k
move mb, @dp[0]++ ; mb=x1, mc=k*x1, point to x2
move ma, #-1 ; ma=-1
move mb, @dp[0]-- ; mb=x2, mc=k*x1-x2, point to x1
nop ; wait for result
move @--dp[0], mc ; store result at x0
Detection of dtmf tones
Since only a small number of frequencies need to be detected, a modified Goertzel algorithm can be used. This Goertzel algorithm is more efficient than the general DFT (Discrete Fourier Transform) mechanism and provides reliable detection of signals within the frequency band. Figure 3 is a schematic diagram of the Goertzel algorithm implemented with a simple second-order filter.
In order to detect a tone of a specific frequency using the Goertzel algorithm, the constant k must be calculated first. For the DTMF detector, this constant can be calculated at compile time, and all tone frequencies are explicitly specified. The value of k can be calculated according to formula (4).
First, the three intermediate variables (d0, d1 and d2) are initialized to 0. Now, for each sample value x received, the following formula is calculated:
After obtaining a sufficient number of samples (usually 205 if the sampling rate is 8 kHz), use the newly calculated D1 and D2 to calculate the following formula:
So that P contains the square power of the test frequency in the input signal x (D12 and D22). In order to decode all four columns of DTMF, each sample will be passed through 8 filters. Each filter will have its own K value and a set of intermediate variables. Since each variable is 16 bits, the entire algorithm will require 48 bytes of intermediate storage.
Once the p values of different tone frequencies are calculated, one tone in the high-frequency group and the low-frequency group will be more than twice the value of the other tones, and usually its amplitude is one order of magnitude higher. Figure 4 is the sampled input signal provided to the decoder, and the values of x are 852 Hz and 1336 Hz respectively. Figure 5 shows the detection results of the Goertzel algorithm. If the signal spectrum does not meet this standard, there are two possible situations, either there is no DTMF energy in the signal, or the noise is too large to block the signal.
A spreadsheet illustrating the algorithm and example code for a MAXQ processor equipped with a MAC are available at www.maxim-ic.com/MAXQ_DTMF.
in conclusion
The MaxQ microcontroller combined with its MAC unit builds a bridge between the traditional MCU and DSP, and effectively solves the technical problem of coexistence of control applications and systems that require a small amount of signal processing. With the addition of a hardware MAC, the MaxQ microcontroller takes the signal processing capabilities of the previous 16-bit microcontroller to a new level. The single-cycle MAC also provides commonly used functions, making real-time signal processing possible.
Previous article:Using time-interleaved ultra-high-speed analog-to-digital converters at the PCB level
Next article:Design and application of RF source control signal simulator
- Popular Resources
- Popular amplifiers
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- 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
- Bluetooth module interfaces
- Five factors to consider when designing a fixed wireless access (FWA) system
- Weak Bluetooth signal strength and excessive static power consumption of the product
- Analysis of the circuit diagram of infrared pair tube. Can someone please help me analyze it?
- Practical information! The most comprehensive Linux application development case sharing, including key codes! (Part 2)
- Application design of active RFID tag based on MSP430F2012 and nRF24L01
- CC3200LaunchPad modified infrared thermometer
- EEWORLD University Hall----Live Replay: STMicroelectronics Data Center and Communication Network Power Management Solutions
- Array out of bounds and HardFault exception interrupt
- EEWORLD University Hall----Xuvod ML51PC0AE