Chapter 1 System Design and Function Introduction
1.1 System Design
This design studies a scattering parameter measurement device. The device uses an STM32H723ZGT6 as the control chip, with an external scattering data acquisition module and a display module. The scattering data acquisition module is the core of the device. It generates a swept-frequency signal to excite the system under test, separates the incident and reflected signals using a directional bridge, mixes the signals using a superheterodyne structure, and acquires the signals using an ADC chip. The display module supports functions such as switching measurement parameters, switching display modes, and selecting the measurement range through a self-designed UI interface. All modules are connected via a "horn-shaped connector" using IDC cables, ensuring convenient connection while preventing reverse connection. We use this device to measure the amplitude and phase frequency characteristics of the system under test at various frequencies, thereby calculating the S-parameters (including S11, S12, S21, and S22) of the system under test, and further calculating the impedance continuity, reflection coefficient, electrical length, and other related properties of the system under test. The overall block diagram of the scattering parameter measurement device is shown in Figure 1.1:

Figure 1.1 Overall block diagram of the scattering parameter measurement device
. The scattering data acquisition module is responsible for implementing four key module functions: a swept frequency signal source, a directional bridge, a mixer, and ADC synchronous signal acquisition. Among them, the signal source is used to excite the system under test, the directional coupler is used to separate the S11 echo and inject the excitation, the mixer is used for down-conversion, and the local oscillator is the signal source for down-conversion. After the signal under test is down-converted, the excitation signal generated by the signal source needs to be mixed and analyzed simultaneously to realize the calculation of scattering parameters. Thanks to the high-performance digital circuit, all down-converted signals can be directly sent to the ADC for synchronous sampling after passing through an anti-aliasing filter, and finally for digital signal processing.
1.2 Main technical features
1.2.1 Using square wave signal as signal source
The signal source chip selected is Si5351A, which is itself a clock generator and can be used to generate square wave clock signals with a frequency of 8kHz-160MHz. Compared to a sinusoidal signal of the same frequency, the odd harmonics (third harmonic, fifth harmonic, etc.) of a square wave can also be used as excitation signals. Therefore, a 160MHz square wave signal can be used as a 160MHz test signal, as well as a 480MHz (third harmonic) or 800MHz (fifth harmonic) test signal. By configuring the registers corresponding to the multiplication and division coefficients of the clock chip Si5351, a sweep frequency signal of 8kHz~800MHz can be obtained.
1.2.2 Downconversion using a superheterodyne structure
The excitation signal (i.e., the incident signal) generated by the Si5351A chip, the reflected signal from the device under test (DUT), and the output signal of the DUT are all downconverted to 5kHz by the mixer chip SA612AD along with another local oscillator signal generated by the Si5351A chip. The downconverted output signal is then passed through a low-pass filter before being fed into the ADC chip for sampling. To ensure that all signals can be down-converted to 5kHz, fS - fL = 5kHz must be achieved, where fS is the frequency of the excitation signal generated by the Si5351A chip, and fL is the frequency of another local oscillator signal generated by the Si5351 clock chip. The structure of the superheterodyne receiver is shown in Figure 1.2:

Figure 1.2 Superheterodyne Receiver Structure
1.3 Performance Indicators
Table 1.1 Performance Indicators of the Scattering Parameter Measurement Device
Basic Parameters
Performance Indicators
Scattering Parameters Measurement Frequency Range
50kHz - 300MHz
Frequency Resolution
1kHz
Amplitude Frequency Response Measurement Error
Less than 5%
Phase Frequency Response Measurement Error Less
than 5%
Coaxial Cable Length Measurement Range
0.1m - 20m
Coaxial Cable Length Measurement Error
Less than 1%
Measurement Response Time
Less than 3S
Self-calibration Function
Yes
Chapter 2 Software Design and Algorithm Implementation of the Scattering Parameter Measurement Device
2.1 Program Flowchart
2.1.1 Main Program Flowchart
After the device is powered on, each functional module will be initialized. After initialization, the function can be selected through the serial port screen. First, port calibration is required to eliminate system errors in the test system. The second step is to set the test frequency range: configure the scattering parameter measurement device to cover the required frequency range. The third step is to set the scattering parameters to be measured: such as S11, S21, etc. The fourth step is to perform the measurement: after the measurement starts, the scattering parameter measurement device will send a test sweep frequency signal to the device under test and measure the output signal at the corresponding port. The corresponding S-parameters are calculated based on the amplitude, phase and other information of the output signal and the test signal. The fourth step is to select the data display method and content: the coordinate axis can be linear or logarithmic, and the measurement content can be amplitude or phase. The last step is to record and analyze the results: the measurement results can be recorded in flash memory for later storage, reading and analysis. The specific flowchart of the main program is shown in Figure 2.1:

Figure 2.1 Flowchart of the main program of the scattering parameter measurement device
2.1.2 Flowchart of scattering parameter measurement
The microcontroller first controls the clock chip Si5351 to generate a linear sweep frequency signal according to the selected test frequency range, then controls AD7606 to sample the input and output signals. After the sampling is completed, the sampling results are analyzed, and the set S-parameters are calculated by combining the calibration data. Finally, the results are displayed through the serial port screen. The specific flowchart for scattering parameter measurement and calculation analysis is shown in Figure 2.2:

Figure 2.2 Specific flowchart for scattering parameter measurement
2.2 Single-port reflection coefficient measurement and system error correction
Single-port system error calibration includes OSM (open/short/match, also known as OSL—open/short/load). OSL calibration is a full single-port calibration, which can correct all error terms involved in single-port testing and effectively improve the accuracy when testing single-port devices.
The basic process of reflection testing: The excitation source provides a signal, which is mostly output to the DUT through the vector network interface (VMI) port after passing through the coupler; the signal reflected by the DUT reaches the measurement receiver (Meas. Receiver) through the coupling path of the coupler. Since the VMI port also has reflection, assuming the reflection coefficient is S, there will be multiple reflections between the VMI port and the DUT port, and the amount of multiple reflections will also enter the Meas. Receiver through the coupling path. In addition, since the coupler is not ideal, its isolation is also limited, which causes a part of the excitation signal to be directly fed into the Meas. Receiver through the isolation channel of the coupler. In other words, the signal received by the Meas. Receiver actually consists of three parts: the signal directly reflected by the DUT, the multiple reflections at the test reference plane, and the signal directly leaked through the coupler isolation channel. The entire process of the signal from source transmission to receiver reception is shown in Figure 2.3:

Figure 2.3 Single-port signal model.
The coupler itself has 4 ports, but considering that this model only involves some parameters of the coupler, it is equivalent to a 3-port device here, with ports 1, 2, 3, and 4. S21 refers to the direct transmission coefficient of the coupler, is the transmission coefficient of the leakage channel, and is the transmission coefficient of the coupling channel. For simplicity, the signal flow graph in Figure 4.3 can be drawn first, as shown in Figure 2.4, where is the actual reflection coefficient of the DUT.

Figure 2.4 Single-port signal flow graph.
The expression for b3 can be directly obtained from the signal flow graph:
After simplification, the measured value of the reflection coefficient is as follows:
From the above formula, it can be seen that the reflection coefficient measurement contains four error terms: , , , S. Generally, () is called reflection tracking R (Reflective Tracking), which is called directivity, abbreviated as D (Directivity), and S is called source matching.
After simplification, there are actually three error terms R, D, and S in single-port testing. During calibration, three standard components, Open, Short, and Match, are used respectively. Each standard component yields an equation:
where , , and are the reflection coefficients measured when the port is open, short-circuited, and matched. By solving the equation, the solution for the three error terms can be obtained:
The true reflection coefficient can be deduced from the three error terms R, D, and S:
=
where M is the measured reflection coefficient and is the true reflection coefficient after correction.
Chapter 3 Device Test Results
3.1 Device Physical Diagram
The device consists of a main control STM32H7 development board, a scattering data acquisition module, and a device under test (DUT) (the device under test in this case is a coaxial cable with a characteristic impedance of 50Ω). Figure 3.1 shows the state of the coaxial cable with an open circuit at the measuring terminal:

Figure 3.1 Physical diagram of the scattering parameter measuring device.
The scattering data acquisition module transmits a swept frequency signal to the coaxial cable through a swept frequency signal source. The directional bridge separates the incident signal and the reflected signal. After down-conversion by a mixer, the two signals are synchronously sampled by an ADC. The main control STM32H7 reads the sampling results of the two signals, performs spectrum analysis through DFT, and compares the amplitude-frequency characteristics and phase-frequency characteristics of the two signals to obtain the amplitude-frequency characteristics and phase-frequency characteristics at each frequency point.
The main control STM32H7 sends the test results (including amplitude response and phase response) of each test frequency point to the computer for display via serial port, as shown in Figure 3.2:

Figure 3.2 Test results at each frequency point .
The main control STM32H7 calculates the length of the coaxial cable based on the propagation speed of electromagnetic waves in the coaxial cable and the phase difference between the reflected signal and the incident signal. Finally, the amplitude-frequency response curve, phase-frequency response curve, and coaxial cable length are displayed on the serial port screen. Figure 3.3 shows the amplitude-frequency response curve on the left and the phase-frequency response curve on the right. The two curves can be switched using the buttons on the serial port screen.

Figure 3.3 Amplitude-frequency response curve (left) and phase-frequency response curve (right).
Full video link on Bilibili: [Coaxial Cable Length Measurement Demo] https://www.bilibili.com/video/BV1eZ421p7kp/?share_source=copy_web&vd_source=55d78a192daa8233cdbffec3fcf10359