Digital signal generator is a kind of signal generator and signal source which is widely used in electronic circuit design, automatic control system and instrument measurement and calibration. Sinusoidal signal is a common signal source with single frequency component. Any complex signal (such as sound signal) can be decomposed into many sinusoidal signals with different frequencies and amplitudes by Fourier transform. It is widely used in electronic technology test, automatic control system and signal processing system in communication, instrumentation, control and other fields In the fields of Electroacoustics, underwater acoustics and biology.

At present, most of the commonly used signal generators are composed of analog circuits or digital circuits, which are large in volume and power consumption, and expensive in price. With the development of microelectronics and computer technology, DSP Microprocessor, DSP software and hardware development system (such as integrated development environment CCS) and supporting products have formed a huge and promising high-tech industry, and the application of programmable logic devices, SOPC and other new technologies has rapidly penetrated into the fields of electronics, information, communication and so on. In this paper, the sinusoidal signal generator is designed with the advantages of DSP chip, such as high speed, low power consumption, real-time analysis, and SOPC technology, such as flexible configuration, high reliability, easy hardware upgrade, etc.

Design of sine signal generator based on DSP

1.1 principle of sine wave generation

In general, there are two ways to generate sine wave: look up table method and Taylor series expansion method. Look up table method is a common method, which has the advantages of fast processing speed, easy frequency and phase modulation, high precision, but needs a large memory capacity. Taylor series expansion method needs less memory cells, has the advantages of good stability, simple algorithm, easy programming and so on. Moreover, the more expanded series, the less distortion. Taylor series expansion method is used in this paper. A sine and cosine function with angle θ can be expanded into Taylor series

Design of digital signal generator based on TMS320VC5402

Where: X is the radian of θ, x = 2 π f / Fs (FS is the sampling frequency; F is the signal frequency to occur).

1.2 hardware design

The hardware of the system is mainly composed of microcomputer, DSP chip and D / a conversion module. DSP chip is tms3205402, and vcti has good performance price ratio. It has a set of program bus and three sets of data bus, highly parallel ALU, dedicated hardware logic chip memory, enhanced HPI port and CPU frequency up to 100 MHz. It can complete two read and one write operations in one cycle, and has a special hardware multiplier, widely uses pipeline operation, provides special DSP instructions, and can be used to quickly implement various digital signal processing algorithms. A bipolar 8-bit, low-power DAC 08 is used in D / A to realize high-speed synchronous D / a conversion. The block diagram of hardware structure is shown in Figure 1.

1.3 software design

Software design is based on CCS development environment. CCS is an integrated development environment for TMS320 series DSP software developed by TI company. It is one of the most widely used DSP development software. It provides environment configuration, source file compilation, compilation connection, program debugging, tracking analysis and other links, and integrates software and hardware development tools, so that the programming, assembly, software and hardware simulation and debugging of programs can be carried out in a unified environment, thus speeding up the software development process. In this paper, the online programming mode combined with hardware development board is adopted. The sine signal generator is realized by applying C language and C54X assembly language on CCS software platform.

The idea of software design is: the sine wave waveform can be seen as composed of countless points, which correspond to each angle value of x-axis. The advantage of DSP processor in processing a large number of repeated calculations can be used to calculate the y value of each point of x-axis (n points are taken to approximate in x-axis). The whole system software consists of main program and sin subroutine based on Taylor expansion method. The corresponding software flow chart is shown in Fig. 2 and Fig. 3.

In the program, the value of n is the number of points in one cycle of generating sinusoidal signal, and the frequency of sinusoidal signal is related to the value of N and the D / a conversion frequency FDA


Therefore, the number of samples in each sinusoidal period is selected to change the delay between each sampling point. That is to say, different frequency waveforms are generated by adjusting the n value. At the same time, the software can also be used to change the output discrete waveform value multiplied by the corresponding scaling factor A, so as to adjust the amplitude of the waveform. When the program is loaded into the DSP target chip, the waveform implementation results can be visually displayed on the CCS graphical display interface (see Figure 4) or the output results can be observed with an oscilloscope, as shown in Figure 5.

The output results show that the sinusoidal signal with stable frequency, small signal interference and small waveform distortion can be obtained in the CCS graphic observation window, and the sinusoidal signal with good and stable waveform can also be observed by using the oscilloscope.

2. Design sine signal generator based on SOPC technology

Although DSP processor (such as TI’s TMS320 Series) is almost the only choice of DSP application system core devices for a long time in the past. However, due to its own limitations, such as inflexible hardware structure, it is difficult to meet the rapid development of DSP application market. Modern large capacity, high speed, embedded with a variety of DSP module FPGA and the corresponding SOPC technology, makes the realization of digital signal processing easier.

2.1 principle of DDFS

Direct digital frequency synthesis (DDFS) circuit consists of system clock, phase accumulator, frequency accumulator, waveform look-up table, D / a converter and signal conditioning circuit. The working principle of DDFS is that in each clock cycle, the frequency accumulator is used to carry out self increasing accumulation by taking the input frequency word FW as the step. The high bit of the accumulation result is sent to the phase accumulator and accumulated with the input phase word PW. The output of the phase accumulation is used as the address of the waveform look-up table, and the corresponding data is read out from the look-up table and sent to the D / a converter. Finally, it passes through the low-pass filter and the post stage amplifier Large signal conditioning circuit to form analog waveform output. The system structure block diagram is shown in Fig. 6.

The frequency output formula of DDFS is as follows:

Where: n is the bit width of the phase accumulator; m is the bit width of the frequency word; fclk is the system clock signal.

DDFS generates sinusoidal wave with controllable frequency and phase through a numerical controlled oscillator. Its advantages include no phase feedback control, fast frequency establishment and frequency switching, programmable and fully digital, flexible and convenient control, and continuous output phase. If the bit n of the phase accumulator is large enough, high resolution can be obtained in theory. DDFS can also generate other modulation signals, so it has high cost performance.

2.2 hardware module design and simulation

Using DSP buiider to design DSP module is a part of SOPC technology. The key design process is carried out in the graphic simulation environment simulink of MATLAB. The graphic module in DSP Builder and other Simulink libraries is called graphically to form the system level design module, as shown in Figure 7.

The main advantage of modular design is that the frequency and phase of sine wave can be easily controlled by changing the status word in the module. It does not need to be modified in the program, and it does not need to understand the complex hardware description language, which is difficult to master.

After the circuit model design is completed, the powerful graphical simulation verification function of Simulink environment can be used to directly carry out algorithm level model simulation verification, and the results are shown in Figure 8. In the Simulink of MATLAB, the model simulation belongs to the simulation of system verification, not RTL level simulation, and has nothing to do with the target device and hardware system. Therefore, Modelsim is used to simulate the function of the designed circuit. Modelsim is an outstanding HDL simulation tool of mentor company. It is widely used for its powerful digital and analog simulation functions, and the simulation results are intuitive and easy to understand, as shown in Figure 9.

It can be seen from the output waveform results of Fig. 8 and Fig. 9 that the sine waveform generated by the sine signal generator designed with SOPC scheme is clear, stable, the phase change is relatively continuous, and the output phase noise is low.

2.3 system hardware verification

Through the signaicompiler, the design model file is transformed into the corresponding VHDL design file. In Quartus II integrated environment, compile. VHD file, simulate the timing, verify the design file, and determine the pin lock corresponding to PIO in de2 development board; program the device and download it to the target chip de2ep2c35f672c6 to realize the hardware test; call signal tap II to observe the hardware test results, and observe them by oscilloscope through D / a conversion The result of waveform output is the same as that of system simulation, which verifies the rationality of system design.


From the perspective of engineering application, a structural and modular design method based on DSP and SOPC is proposed. This method can be extended to other electronic design fields, making the system circuit design more simple and intuitive, and easy to expand, with high practicability and reliability. By comparing the advantages and disadvantages of DSP and SOPC design, it shows that compared with DSP design, SOPC technology can greatly shorten the design cycle of the system, save the design cost, improve the cost performance and competitiveness of products, so it has a better promotion and application prospect.

Editor in charge: GT

Leave a Reply

Your email address will not be published. Required fields are marked *