Lab 3
Lab 3
In this lab, the frequency response of the STM32F7 Microcontroller will be observed by viewing the
aliasing effect of the 48 kHz sampling rate and the 32 kHz sampling rate of the microcontroller. The
code that determines the sampling rate is shown below and the uncommented code is the sampling
rate that was executed by the microcontroller. Firstly, I uploaded the pictures then explain whole
parts of the lab.
In these pictures, we settle down the oscilloscope, then how we do it, I will explain it here. The setup
is shown in Figure 1 and the splitter was connected to the output channel of the function generator
which splits the output of the function generator into two channels. One channel was connected to
the audio right or red channel which is to be read by the STM32F7 and produced to be sent out at the
audio right output of the STM32F7 which is connected to the channel 2 input of the oscilloscope.
Channel 2 corresponds to the blue line on the oscilloscope. The splitter splits the other channel to
read directly by the oscilloscope and is connected to the channel 1 input and the channel 1
corresponds to the yellow line on the display of the oscilloscope. The STM32F7 was programmed to
have the sampling rate of 48 kHz and the frequency response was recorded as frequency was
increased by the function generator. The function generator was set to 1V peak-to-peak and
recordings started at 1 kHz. The intervals of the reading decreased as the function generator
approached the cutoff frequency of the sampling rate. The magnitude of the wave was recorded
using the ‘Measure’ function of the oscilloscope to display peak-to-peak voltage values of each
reading taken at the corresponding frequency. The initial values of the voltage readings were
observed to have a peak-to-peak voltage of more than what was made by the original voltage output
of the function generator. The phase difference was also recorded at each frequency and this was
recorded by using the ‘Cursor’ functions to track cursors along the signal lines and the phase
difference was recorded in microseconds as the cursors were placed at the peak of their
corresponding signals. In this picture,
This ‘Cursor’ function is shown in this picture, The distance was given as the ΔX which indicated the
time difference of the two peaks. The phase difference also oscillated in a behavior as the frequency
response was plotted. The code for the interrupt service routine was used from Lab 1 to produce an
identical signal as the input as long as the input frequency was maintained below half the sampling
rate frequency.
In these pictures, The cursor function was used on the FFT so the cursor could be dragged along the
values of the FFT plot and the points would not have to be done manually for the X and Y coordinates.
One cursor was set any point on the passband which indicated the gain of the lower frequencies and
the other cursor was traced along the FFT line until the ΔY was the smallest value it could be closest
to -3 dB. The cursor functions of these are shown here.
The results of the impulse response method showed that 23.97 kHz was the cutoff frequency of the
48 kHz sampling rate and is close in terms of the order of magnitude. The plotting method showed
that the cutoff frequency for 48 kHz is 24.1 kHz, which is approximately 200 Hz higher than the what
the impulse response had showed. The plotting method showed that the cutoff frequency is 16.1 kHz
and it is shown to be the same in the impulse response method.