vlmbMZC4L

High-frequency function signal generator based on STM32

 
Overview
Module Physical Details:
Design Process Record:
Algorithm analysis for designing custom waves, and Matlab data verification
testing of AD9910 module waveform output function.
Overall System Construction and Function Verification:
During this period, the system baseboard was designed, located in the function file directory -- project name: Baseboard PCB.
Soldering
and assembling the baseboard is the basic process, which will not be elaborated here, as this is a basic skill for electronic engineers.
--------------------------Divider----------------------------
Main Basic Functions Implemented in this Project:
This project is a high-frequency function signal generator designed based on the DDS-AD9910 module. The system uses an STM32 series microcontroller as the main controller. A 2.8-inch OLED display is used to display the main waveform parameters. By combining the dial buttons with the EC11 rotary encoder, the waveform output parameters can be set, achieving: High-frequency sine wave: 1Hz-420MHz output, waveform frequency, amplitude, and phase are programmable; Low-frequency 10Hz-244kHz range of common waveforms such as square waves, triangle waves, and sawtooth waves can be output, waveform frequency and amplitude are programmable. It can output SinC or other custom waveforms to achieve arbitrary waveform output. The waveform parameters can be generated by Matlab software. The maximum output frequency of the waveform is 244kHz and the maximum output amplitude is 3.2Vpp.
Main Functions and Parameters:
1. Output sine wave with adjustable frequency, amplitude, and phase. Frequency: 1Hz~420MHz adjustable. Amplitude: 0~760mVpp adjustable (attenuation varies with increasing waveform frequency).
2. Output square wave with adjustable frequency and duty cycle. Frequency: 3.7Hz-244.4kHz adjustable.
3. Output triangle wave (triangle chopper) with adjustable frequency and width. Frequency: 3.7Hz-244.4kHz adjustable.
4. Output sawtooth wave with adjustable frequency and slope (triangle wave at 50% slope). Frequency: 3.7Hz-244.4kHz adjustable.
5. (Other waveform outputs shown) Output COS wave. Frequency: 3.7Hz-244.4kHz adjustable.
6. (Other waveform outputs shown) Output SinC wave. Frequency: 3.7Hz-244.4kHz adjustable.
7. Frequency sweep function:
① Automatic fast frequency sweep, low frequency band (easy to observe). Sweep range and frequency parameters are adjustable.
② Automatic fast frequency sweep, high frequency band (easy to observe). Sweep range and frequency parameters are adjustable.
③ Line-controlled frequency sweep, sweep range and frequency parameters are adjustable.
User Interface (UI) Display:
Sine Wave UI Simplified Interface Display:
Operation Instructions: The frequency of the sine wave can be adjusted in this interface, with a minimum adjustment step of 1Hz. The waveform amplitude can also be adjusted in this interface, with a maximum amplitude of full-scale output, approximately 700mVpp.
② Output Square Wave: Frequency and duty cycle are adjustable.
Square Wave UI Simplified Interface Display:
Operation Instructions: The frequency and duty cycle can be adjusted in this interface, with a maximum frequency of 244kHz and a minimum of 3.7Hz. The step size is related to the register data; please refer to the datasheet for details. The example shown is a 16-step value. The square wave waveform has a duty cycle step frequency of 10%, with a maximum of 90% and a minimum of 10%.
③ Output triangle wave: frequency and width are adjustable.
Triangle wave UI simplified interface display:
Operation instructions: In this interface, the frequency and width ratio of the waveform can be adjusted. The frequency range is the same as that of the square wave. The width ratio of the triangle wave is 10%-100%, with a step of 10%.
④ Output sawtooth wave: frequency and slope are adjustable.
Sawtooth wave UI simplified interface display:
Operation instructions: In this interface, the frequency is adjusted in the same way as the square wave and sine wave. The slope ratio of the waveform can be adjusted, with an adjustment range of 10%-100%, and a step of 10%. When the slope ratio is 50%, the waveform is the same as that of the triangle wave when the width ratio is 100%.
⑤ Output SinC signal wave: frequency is adjustable.
SinC wave UI simplified interface display:
Operation instructions: In this interface, the frequency of the waveform can be adjusted. The frequency range is the same as that of the waveform described above.
⑥ Output Cosine trigonometric function waveform: Frequency adjustable.
Cosine wave UI simplified interface display:
Operation instructions: The waveform frequency can be adjusted in this interface; the frequency range is the same as the waveform frequency described above.
⑦ Frequency sweep function: Frequency sweep parameters are adjustable.
Frequency sweep mode UI simplified interface display:
Operation instructions: In this mode, the upper and lower limit frequencies of the waveform can be adjusted; the frequency range is 1Hz-420MHz.
⑦ Digital harmonic high-speed frequency sweep function: Frequency sweep parameters are adjustable.
Operation instructions: Fast frequency sweep mode UI simplified interface display:
This mode only displays the frequency sweep waveform; the adjustable frequency sweep range is not shown. (The oscilloscope is terrible, the waveform is unclear even after scanning!).
*****
Screenshot of oscilloscope for waveform output test
#Testing waveform output in the Hz range of a sine wave:
1. 50Hz waveform, amplitude 100% output.
2. 136Hz waveform, amplitude 100% output.
3. 203Hz waveform, amplitude 54% output.
4. 363Hz waveform, amplitude 75% output.
5. 502Hz waveform, amplitude 91% output.
This shows that within the Hz range, the waveform parameters and output parameters are consistent.
#Testing waveform output in the kHz range of a sine wave:
1. 26kHz waveform, amplitude 100% output.
2. 53kHz waveform, amplitude 55% output.
3. 145kHz waveform, amplitude 71% output.
4. 220kHz waveform, amplitude 51% output.
5. 369kHz waveform, amplitude 66% output.
6. 593kHz waveform, amplitude 100% output.
#Testing waveform output in the MHz range of a sine wave:
1. 9MHz waveform, 100% amplitude output.
2. 16MHz waveform, 77% amplitude output.
3. 39MHz waveform, 77
% amplitude output. 4. 81MHz waveform, 77% amplitude
output. 5. 96MHz waveform, 77
% amplitude output. 6. 95MHz waveform, 100% amplitude output.
My oscilloscope can measure waveforms up to 100MHz without distortion, so frequencies above 100MHz cannot be tested. The AD9910 has a maximum output of 400MHz.
#Testing square sine wave output (10% duty cycle):
1. Output waveform with 90% duty cycle, frequency 244kHz.
2. Output waveform with 90
% duty cycle, frequency 122kHz. 3. Output waveform
with 60% duty cycle, frequency 40.7kHz. 4.
Output waveform with 60% duty cycle, frequency 34.9kHz. 5. Output waveform with 60% duty cycle, frequency 24.4kHz.
#Testing triangle wave waveform output (step width 10%): 1. Triangle wave output waveform with 100% width and a frequency of 244kHz. 2. Triangle wave output waveform with 60% width and a frequency of 244kHz. 3. Triangle wave output waveform with 60% width and a frequency of 122kHz. 4. Triangle wave output waveform with 60% width and a frequency of 81.4kHz. 5. Triangle wave output waveform with 100% width and a frequency of 81.4kHz. 6. Triangle wave output waveform with 100% width and a frequency of 61.0kHz. 7. Triangle wave output waveform with 100% width and a frequency of 34.9kHz. 8. Triangle wave output waveform with 30% width and a frequency of 24.4kHz. 9. Triangle wave output waveform with 90% width and a frequency of 22.2kHz. #Test sawtooth wave waveform output (step slope 10%): 1. Sawtooth wave output waveform with a slope of 20% and a frequency of 244kHz. 2. Sawtooth wave output waveform with a slope of 40% and a frequency of 244kHz. 3. Sawtooth wave output waveform with a slope of 60% and a frequency of 244kHz. 4. Sawtooth wave output waveform with a slope of 30% and a frequency of 81.4kHz. 5. Sawtooth wave output waveform with a slope of 30%, and triangle wave output waveform with a frequency of 48.8kHz. 6. Sawtooth wave output waveform with a slope of 70%, and triangle wave output waveform with a frequency of 34.9kHz. 7. Sawtooth wave output waveform with a slope of 70%, and triangle wave output waveform with a frequency of 27.1kHz. #Test output SinC waveform: 1. SinC waveform output with a frequency of 122kHz. 2. SinC waveform output with a frequency of 81.4kHz. 3. SinC waveform output with a frequency of 61.0kHz . 4. SinC waveform output with a frequency of 48.8kHz. 5. SinC waveform output with a frequency of 34.9kHz. 6. SinC waveform output with a frequency of 24.4kHz. #Test output Cos waveform: 1. Cos waveform output with a frequency of 244kHz. 2. Cos waveform output with a frequency of 122kHz. 3. Cos waveform output with a frequency of 81.4kHz. 4. Cos waveform output at 61.0kHz. 5. Cos waveform output at 48.8kHz. 6. Cos waveform output at 34.9kHz. 7. Cos waveform output at 24.4kHz. Frequency Sweep Modes : Frequency Sweep Mode 1: Frequency Sweep Mode 2 (High Frequency): Special Note: The waveforms in frequency sweep modes should be observed using a higher-performance oscilloscope. Due to equipment limitations, only the waveforms of frequency sweeps are shown here. Please consult relevant documentation for specific applications of the frequency sweep function. Test Results: The above waveform output tests indicate that the module functions well and meets basic functional requirements. Project Function Demonstration Video: Hardware Circuit Introduction: ### The hardware circuit module mainly includes the following: 1. DDS-AD9910 (Independent design of circuit and PCB layout and routing) 2. STM32F1 minimum system core (Designed by Fanke Technology) 3. 2.8-inch IPX-OLED touch screen (Independent design of circuit and PCB layout and routing) 4. Signal output control board (Independent design of circuit and PCB layout and routing) 5. Control core board (Independent design of circuit and PCB layout and routing) Hardware Circuit 1 Display Images: AD9910 Module Hardware Circuit Physical Detail Display Photos: Aesthetics from Immersion Gold Craft---AD9910: Baseboard: LCD: Core Board AD9910 Module Hardware Circuit Design Details: This circuit module is probably the one I'm most satisfied with so far, both in terms of layout and routing and the actual finished product. The waveform output terminal of AD9910 is first replaced with straight lines, and then converted into pads to form an exposed trace pattern. (Whether to expose the circuit should be analyzed based on the actual situation.) For modules with complex functions like this, when programming or designing the PCB, try not to deviate from the datasheet. For example, this module uses +3.3V and +1.8V power supplies, and it's important to distinguish between analog and digital voltages, as well as digital and analog grounds. The datasheet should group the power supplies accordingly. (For specific grouping details, please refer to the attached AD9910 datasheet; this is just a brief tip for developers.) When designing the PCB for the AD9910 module, I followed the datasheet requirements as closely as possible. For instance, I isolated the digital +3.3V power supply from the analog +3.3V power supply using ferrite beads, and I added numerous filter units, using a filter network consisting of ferrite beads and 0.1uF and 100nF filters. The filter circuit is shown in the figure below. For high-precision operational amplifier circuits, a 10uF bypass capacitor is generally required for power supply filtering. I learned this from the AD9853 op-amp datasheet, so I added four 10uF capacitors around the AD9910 chip to increase power supply stability and reduce power supply interference. The 10uF capacitors are placed at the four corners of the chip, corresponding to different power supplies. For active crystal oscillator circuits, the power supply generally needs to be filtered by a ferrite bead, as shown in the circuit diagram. The dial button circuit is connected to a 5V level. By default, the voltage is 5V; when pressed, the voltage jumps to 0V. The corresponding operation can be assigned by the software program. (For any questions, please refer to the datasheet for the dial operation parameters.)


























































It's worth noting that the AD9910 has many I/O interfaces due to considerations for other scenarios during its design. However, if you only use it to communicate with low-speed devices like STM32, you can connect fewer than 10 driver I/Os, significantly reducing the PCB area occupied by I/Os. You can refer to AD9910 module design diagrams found on Taobao, including those from the Tianjin-based Kodite store. I'll only briefly describe their products here. When
designing circuit layouts, I like to learn from several sources before integrating them. I usually start by searching on Taobao and then ask around. Some resources are available, while others only provide resources after purchase; it depends on how you gather the information. However, many circuit designs are similar, and following the principle of "good enough" is generally sufficient.
Hardware Circuit 3: Signal Conditioning Board Circuit Physical Photo
Signal Conditioning Board Hardware Circuit Design Description:
This board is mainly designed for adjusting the frequency and amplitude of the output signal. Settings can be made via a dial switch and two encoder knobs, which is much easier than programming with an integrated keyboard and also saves PCB space. To increase operational feedback signals, a surface-mount buzzer module was added (a through-hole module would be too tall; my original intention was to compress the overall device size for easier casing design). This module provides corresponding prompts, such as dial fluctuations and encoder frequency adjustments. An integrated Type-C interface is used to power the entire system.
Simultaneously, an IPEX-to-SMA interface integrates the data acquisition channel and waveform output channel onto this board for output transmission. This was done to reduce the thickness of the physical component.
The 2.8-inch OLED screen used in this project has touch functionality, but it was not used because the corresponding data settings can be completed via the DIP switches and the buttons on the EC11 module. In practice, it is recommended to use a screen without touch functionality.
Hardware Circuit 5: System Control Core
The main function of this board is to integrate the control core on this layer, connected via pin headers and ribbon cables. An STM32F103 series minimum system board is used, with its pins brought out and connected to the corresponding devices via ribbon cables.
Special Notes:
①. Dial Button Circuit: I couldn't find a schematic design for this circuit, so I designed it by referring to its datasheet. Beginners who enjoy design can refer to the datasheet and design their own circuits to practice finding solutions from the datasheet. I compared the datasheet several times before designing the dial button circuit used in this project.

②. In this design, except for the STM32F1 control core and the 2.8-inch OLED which do not use JLCPCB's packages, all other hardware modules are from JLCPCB's component library and can be purchased from the LCPCB online store. Therefore, purchasing details are not provided.
③. Some modules use a 4-layer PCB design, but a two-layer layout is sufficient for actual routing. If referring to this project design, please analyze the specific situation accordingly.
PCB Circuit Design Description:

This is a screenshot of the PCB layout and routing during the AD9910 design process. The screenshots are used to illustrate that designing a hardware circuit from scratch can be a challenging process, but the final result is always gratifying.
The outer edging was originally intended to be metal-based, but that's too expensive... a bit unaffordable!
Software Program Design:
The main challenge in the software program lies in arbitrary waveform output. This section describes the software for arbitrary waveform output in this design.
The program design for this project is relatively simple, mainly focusing on understanding and applying the AD9910 register functions, as many operations are implemented through registers. Buttons and encoders are used for auxiliary settings.
This section specifically explains the code for generating arbitrary waveforms using AD9910 (generated using Matlab)
. It provides reference code for generating triangular wave function waveform data. `
close all;
clear all;

% Data depth 2^12
N=1024;
% Data width 2^7
P=16383;
a3(1:1:N)=0;
for b3=1:1:N
a3(b3)=round((P-4)*tripuls((b3-N/2)/N,4,0.5));
end
figure(3);
plot(a3,'r','LineWidth',2);
axis([0, N, 0, P]);
fid = fopen('C:Users13781Desktop1024点蟒数据测试555triplus.coe','wt');
fprintf(fid,'%s ','memory_initialization_radix=10'); fprintf(fid,'% s
','memory_initialization_radix=10');` ` fprintf(fid,'%g, ',a3); fclose(fid);` This generates a waveform preview . Waveform data is stored in an array . The declaration and call function for `AD9910_RAM_WAVE_Set(AD9910_WAVE_ENUM wave)` in the `AD9910.c` file is recommended . It is advised to consult the datasheet for comparison and learning, as the setting of any frequency generation function is achieved by setting the value of this register. The main core code of this project is located in the folders indicated by the arrows. Only a brief explanation is provided here; please refer to the program for details. Most of the core code has comments. Note: This 2.8-inch LCD may overheat significantly when connected to a +5V power supply; it is recommended to use a 3.3V power supply. Function demonstration video: https://www.bilibili.com/video/BV1A84y1X7gH/















参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-26 00:17:31

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号