How to store and manage ADC values in a 2D array for FFT processing in an FMCW radar system
I am using an FMCW radar to determine the distance and speed of a moving object with an STM32L476 microcontroller. To find the range of a stationary object, I store the ADC values into the "fft_in" array using the "HAL_ADC_ConvCpltCallback" function. I have initialized "is_data_ready_for_fft = 1" as follows:
Then, I calculate the range using FFT. Now, I need to store this 1D array of ADC values in a 2D array to calculate the Doppler frequency across the chirp index.
The code that copies ADC values into the fft_in array and performs the range calculation is in the file below ()
Here is the desired matrix structure, where each fft_in array at different times forms rows of the matrix:
Solution:Jump to solution
Yes, precisely!👍 @Sterling As you proceed through each chirp, that will store your {fft_in} array into the matrix row by row. After that, you may examine the matrix to calculate the velocity or any other desired parameter.
7 Replies
@Sterling You can create a 2D array where each row will represent the
fft_in
values at a specific time, or “chirp index” as you’re calling it. For example, if you’re capturing 20 chirps, you’ll want a 20x512 matrix—20 rows for each chirp and 512 columns for the samples.Hmm, makes sense tho. But how do I actually store the
fft_in
array into that matrix every second?You’d create the 2D matrix first, something like
float32_t fft_matrix[20][512];
. Then, each time your fft_in
array updates, you copy its contents into the next available row of your matrix. You can do this in your existing loop where you process the FFT. @Sterling@UC GEE So I believe it's something like this yhhh ??
Solution
Yes, precisely!👍 @Sterling As you proceed through each chirp, that will store your {fft_in} array into the matrix row by row. After that, you may examine the matrix to calculate the velocity or any other desired parameter.
Thanks very much man🙏🏽