Sterling
Sterling
DIIDevHeads IoT Integration Server
Created by Sterling on 8/8/2024 in #middleware-and-os
How to store and manage ADC values in a 2D array for FFT processing in an FMCW radar system
@UC GEE So I believe it's something like this yhhh ??
// Assuming you're inside your main loop
if (is_data_ready_for_fft == 1) {
// Copy fft_in to the matrix row corresponding to the current chirp
for (size_t i = 0; i < ADC_BUF_LENGTH; i++) {
fft_matrix[chirp_index][i] = fft_in[i];
}

// Process the FFT as usual
is_data_ready_for_fft = 0;
arm_rfft_fast_f32(&fft_handler, fft_in, fft_out, 0);
arm_cmplx_mag_f32(fft_out, fft_out2, ADC_BUF_LENGTH);
fft_out2[0] = 0;
arm_max_f32(fft_out2, ADC_BUF_LENGTH/2, &Result, &Index);

R = (300000000 * 0.004064 * Index) / 500000000;

// Increment the chirp index
chirp_index++;

// Reset if you've captured all chirps
if (chirp_index >= 20) {
chirp_index = 0; // or handle it depending on your needs
}
}
// Assuming you're inside your main loop
if (is_data_ready_for_fft == 1) {
// Copy fft_in to the matrix row corresponding to the current chirp
for (size_t i = 0; i < ADC_BUF_LENGTH; i++) {
fft_matrix[chirp_index][i] = fft_in[i];
}

// Process the FFT as usual
is_data_ready_for_fft = 0;
arm_rfft_fast_f32(&fft_handler, fft_in, fft_out, 0);
arm_cmplx_mag_f32(fft_out, fft_out2, ADC_BUF_LENGTH);
fft_out2[0] = 0;
arm_max_f32(fft_out2, ADC_BUF_LENGTH/2, &Result, &Index);

R = (300000000 * 0.004064 * Index) / 500000000;

// Increment the chirp index
chirp_index++;

// Reset if you've captured all chirps
if (chirp_index >= 20) {
chirp_index = 0; // or handle it depending on your needs
}
}
9 replies