1531 views|0 replies

3836

Posts

19

Resources
The OP
 

How to Make DSP Digital Oscillator Generate Phase-Shifted Sine Wave [Copy link]

There are many ways to generate digital phase-shifted signals. The traditional direct digital frequency synthesis (DDS) phase-shifting principle is to first digitize the sine wave signal and form a data table stored in two ROM chips, which can then be passed through the two D/A conversion chips to continuously output the data table in a loop under the control of the counter, so that two sine wave signals can be obtained. When the data sequences obtained by the two D/A conversion chips are exactly the same, the two sine wave signals obtained by the conversion have no phase difference. When the data sequences obtained by the two D/A conversion chips are different, the two sine wave signals obtained by the conversion have a phase difference. The value of the phase difference is related to the total number of data in the data table and the offset of the data address. The essence of this processing method is to map the offset of the data address to the phase value between the signals. The deviation of the data can be obtained by an external microprocessor to obtain the corresponding digital input, and this value corresponds to the phase shift angle of the sine signal. The direct frequency synthesis method has the advantages of short frequency conversion time, good phase noise performance, high accuracy, and wide frequency range of the generated signal. However, due to the need to use address, phase calculation, memory access operation and other links, the direct frequency synthesizer has a complex structure, high cost, and low phase shift resolution. This paper uses DSP technology and a numerical iteration method, that is, the implementation principle of DSP digital oscillator to obtain two sinusoidal wave signals. Through simulation and hardware implementation, two sinusoidal wave outputs with set parameters can be obtained, achieving the design purpose, and has the characteristics of convenient and flexible adjustment and high resolution. The numerical iteration method can accurately calculate the sine value of the angle, only requires a small storage space, selects the number of samples in the sine cycle, changes the delay between samples, and can generate waveforms of different frequencies. The waveform amplitude and phase can be changed by software.

1 DSP implementation principle of waveform and phase-shift waveform generator

DSP is used to generate sinusoidal signals through calculation and iteration, i.e. digital oscillator. The unit impulse response of digital oscillator is sin(nωT+θ)·u(n), i.e. the system oscillates under the excitation of δ(n), and outputs a sinusoidal sequence with a phase of θ. The system function of the system is the Z transform of the impulse response, i.e.

How to Make DSP Digital Oscillator Generate Phase-Shifted Sine Wave

When n≥3, we have: y(n)=2cosωT·y(n-1)-y(n-2). After n≥3, y(n) can be calculated using y(n-1) and y(n-2), which is a recursive differential equation. Therefore, the following conclusion is drawn: as long as the system output sinusoidal signal angular frequency ω and sampling period T are known, the system differential equation can be obtained. The system only needs to calculate the differential equation once every T seconds to obtain the value of the current sinusoidal sampling sequence y(n). The initial phases are different when the initial values of y(1) and y(2) are set differently. In the design, the main program inputs frequency and phase difference data through the keyboard. During initialization, the initial values y1(1), y1(2) and y2(1)y2(2) of the two sinusoidal signals are first calculated according to the output signal frequency, sampling rate and phase difference data, and then the timer interrupt is enabled. Each time the timer interrupt service routine is entered, the previous y1(1), y1(2) and y2(1)y2(2) are used to calculate new y1(0) and y2(0). Although there is a certain delay in calculating and outputting y1(0) and y2(0) twice, the error caused will be very small due to the high-speed pipeline operation of DSP and the high-speed serial output of McBSP.

2 System Hardware Implementation Solution

The system structure of two-way phase-shifted sine wave output based on TMS320VC5416 DSP is shown in Figure 1. The central processing unit of this system adopts the high-performance fixed-point digital signal processing chip TMS320VC5416 of TI ( Texas Instruments ) in the United States. TMS 320VC54.16 is a low-power, high-performance fixed-point digital signal processor designed by TI specifically for portable devices. Compared with other processors in the C54 series, the running speed reaches 160M PI S, the on-chip RAM reaches 128K, and the program addressable space reaches 8M, which provides rich conditions for large-scale data processing. In particular, VC5416 provides a variety of on-chip peripheral resources; software programmable wait state generator, programmable phase-locked loop clock generator, 1 16-bit timer, 6-channel direct memory access controller ( DMA ), 3 multi-channel buffered serial ports (McBSP), 8-bit enhanced HPI interface, etc. In addition, TMS320VC5416 supports mixed programming of C and assembly languages, and its efficient pipeline operation and flexible addressing mode make it particularly suitable for high-speed real-time signal processing. Since the system has two sinusoidal signal outputs, the system adopts two-way signal time-sharing transmission. TLC320AD50C is an analog interface chip produced by TI that integrates A/D and D/A conversion functions. It uses ∑-△ technology to achieve high-precision A/D and D/A conversion at low system cost. The chip consists of a pair of 16 b synchronous serial conversion channels, with a decimation filter after the ADC and an interpolation filter before the DAC . TLC320AD50C supports both master and slave working modes and supports up to three slave devices. Using this feature, the system connects two TLC320AD50Cs in series, making one of them a master device and the other a slave device, and realizes serial communication with the two TLC320AD50Cs through the multi-channel buffered serial port McBSP of TMS320VC5416. TMS320VC54.16 controls the two TLC320AD50Cs to transmit data to the two TLC320AD50Cs in a time-division multiplexing manner for D/A conversion output. The M/S of AD50C1 is connected to a high level, the M/S of AD50C2 is connected to a low level, and the XF pin of VC5416 is used to provide the primary and secondary communication selection signals for AD50C. TLC320AD50 is widely used in audio data acquisition and processing. It can be seamlessly connected to the McBSP of TMS320C54xDSP for data acquisition, storage and processing. SCLK outputs the clock, DIN serial input, DOUT serial output, and FS frame synchronization signal output, corresponding to the corresponding pins of DSP. MCBSP has the following characteristics: ① The receiving and sending clocks of the serial port can be provided by external devices or by internal clock generators ; ② The polarity of the frame synchronization signal and the data clock signal can be programmed, and the internal clock and frame signal generator can also be controlled by software programming; ③ The signal sending and receiving parts of the serial port can run independently or work together; ④ The interrupt signal of the CPU and the synchronization signal of DMA enable the McBSP serial port to be controlled by the CPU, and can also be separated from the CPU and run independently through DMA to directly access the memory; ⑤ The multi-channel selection part enables the serial port to have the communication capability of multi-channel signals, and its multi-channel receiving and sending capabilities can reach 128 channels; ⑥ The data width can be selected from 8b, 12b, 16b, 20b, 24b, and 32b, and the data can be compressed and expanded by A law and U law. The McBSP serial port includes a data channel and a control channel. The data channel completes the sending and receiving of data. McBSP sends data through the DX pin and receives data through the DR pin. The tasks completed by the control channel include the generation of internal clocks, the generation of frame synchronization signals, the control of these signals, and the selection of multiple channels. The control channel is also responsible for generating interrupt signals to the CPU and generating synchronization event signals to notify the DMA controller. Control information is transmitted through the control channel in the form of clock and frame synchronization signals.

How to Make DSP Digital Oscillator Generate Phase-Shifted Sine Wave

3 System software design and CCS simulation results

The system software mainly consists of several modules, such as BootLoader download program, system initialization, keyboard display, timer interrupt processing, etc. When the system starts to power on, the BootLoader program is executed first, and the target program is transferred from the external FLASH to the on-chip RAM for execution.

The system initialization program completes the initialization settings of the TMS320VC5416 control registers , McBSP serial port control registers, timers and TLC320AD50C corresponding registers. The main program and timer interrupt service program flow chart are shown in Figure 2.

How to Make DSP Digital Oscillator Generate Phase-Shifted Sine Wave

The CCS simulation waveform with the sine wave frequency set to 2 kHz, the sampling frequency set to 40 kHz, and the phase shift set to 60 degrees is shown in Figure 3.

How to Make DSP Digital Oscillator Generate Phase-Shifted Sine Wave

4 Conclusion

This paper proposes a design method for generating phase-shifted sine waves based on DSP digital oscillator. The experimental results show that the waveform generated by the system is stable, has strong anti-interference ability, is easy to adjust the frequency, phase and amplitude, has high precision, the output frequency range is 20 Hz to 20 kHz, the phase shift is 0 to 360°, and the phase shift resolution can be as high as 0.001 degrees. In addition, if the system is connected to a high-speed DA conversion chip, the output frequency range can be greatly improved. The design is simple, feasible, novel and practical, and has the value of promotion and application.

This post is from DSP and ARM Processors
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list