This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IWR6843AOP:

Part Number: IWR6843AOP

Hi, 

I have found some information in the mmWave Studio application in regards to the number of guard cells, as well as the threshold. Can you please explain what the CFAR window size is? Would this be the number of training cells, one-sided or two-sided?  Also in the attached image you can see what I am referring to. In the image it specifies CA-CFAR. would this mean that the following c script from sdk, mmwavelib_cfarca.c, is used for noise estimation? 

I attempted using the MATLAB CFAR-CA function but it gave me different results form mmWave Studio so I would like to understand the difference. 

Thank you in advance for taking the time to response.

  • HI Diana,

    I'm working on a response now. Will respond by EOD today. Thank you for your patience.

    Best,

    Nate

  • Hi Nathan, 

    Thank you I look forward to your response. 

    Sincerely, 

    Diana

  • Hi Diana,

    I'm still locating the source for this file, but typically the cell lengths here are one-sided. I can't speak for the built in MATLAB CFAR functions though. You could try it both ways and see what matches your output most closely?

    Best,

    Nate

  • Hi Diana,

    The source function is here, and it confirms that it's a one-sided CFAR. Note that this code is NOT intended for production use. It is NOT checked against any quality standards and should NOT be confused for an official TI software offering.

    Best,

    Nate

    function [indxRangeSorted, indxDopplerSorted, fftOut2DMagSqRx1, noiseMeanMat] = detections_after_2D_fft(radar_data_2dfft, detection_options)
    
    % Non coherent integration across antennas
    fftOut2D = squeeze(sum(radar_data_2dfft.*conj(radar_data_2dfft),1));
    
    % A bizarre matlab issue when there is only two dimensions, the squeeze
    % command doesn't work.
    if length(size(radar_data_2dfft)) == 2
    fftOut2D = fftOut2D';
    end
    
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%% Apply CA-CFAR for Object Detection %%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    
    threshWinSize = detection_options.cfar_window_size; % Number of samples on each side of test cell to use for noise estimation
    threshSkipSize = detection_options.cfar_guard_size; % Number of samples on each side of test cell to be skipped for noise estimation
    detThreshdB = detection_options.cfar_threshold_db; % Scaling of detection threshold w.r.t surrounding noise level computed
    
    %% 1D range dimension CFAR
    % CFAR threshold computation, detection, local max check, etc. (implemented without for loop)
    fftOut2DMagSqRx1 = squeeze(fftOut2D);
    
    if detection_options.use_log_cfar == 1
    fftOut2DMagSqRx1 = 10*log10(squeeze(fftOut2D));
    end
    
    if (size(fftOut2DMagSqRx1,1) > (2*threshWinSize+2*threshSkipSize+2)) && (detection_options.do_cfar_in_range == 1)
    fftOut2DXtended = [fftOut2DMagSqRx1(end-threshWinSize-threshSkipSize+1:end,:); fftOut2DMagSqRx1; fftOut2DMagSqRx1(1:threshWinSize+threshSkipSize,:)];
    % Construct in one-shot the cell-average( a.k.a mean noise floor) for each cell in the 2D Array.
    noiseMeanMat = construct_noise_mean_mat(detection_options.cfar_method, threshWinSize, threshSkipSize, fftOut2DXtended);
    % threshMat is a matrix of thresholds for each cell (size of threshMat is same as size of fftOut2D)
    if detection_options.use_log_cfar == 1
    threshMat = detThreshdB + noiseMeanMat;
    else
    threshMat = 10^(detThreshdB/10)*noiseMeanMat;
    end
    % Detection is based on cell exceeding threshold, as well as being a local maxima (in both dimensions)
    threshDecisionMat = fftOut2DMagSqRx1 > threshMat;
    
    else
    threshDecisionMat = true(size(fftOut2DMagSqRx1 ));
    noiseMeanMat = true(size(fftOut2DMagSqRx1 ));
    end
    
    %% Local Maxima
    if detection_options.detect_only_local_maxima_in_range == 1
    fftOut2DMagSqRx1Shiftm1 = [fftOut2DMagSqRx1(end,:); fftOut2DMagSqRx1(1:end-1,:)];
    fftOut2DMagSqRx1Shift1 = [fftOut2DMagSqRx1(2:end,:); fftOut2DMagSqRx1(1,:)];
    localMaxMat1D = and(fftOut2DMagSqRx1>fftOut2DMagSqRx1Shiftm1, fftOut2DMagSqRx1>fftOut2DMagSqRx1Shift1);
    else
    localMaxMat1D = true(size(fftOut2DMagSqRx1));
    end
    
    if detection_options.detect_only_local_maxima_in_doppler == 1
    fftOut2DMagSqRx1Shiftm1 = [fftOut2DMagSqRx1(:,end) fftOut2DMagSqRx1(:,1:end-1)];
    fftOut2DMagSqRx1Shift1 = [fftOut2DMagSqRx1(:,2:end) fftOut2DMagSqRx1(:,1)];
    localMaxMat2D = and(fftOut2DMagSqRx1>fftOut2DMagSqRx1Shiftm1, fftOut2DMagSqRx1>fftOut2DMagSqRx1Shift1);
    else
    localMaxMat2D = true(size(fftOut2DMagSqRx1));
    end
    
    %% 2D vel dimension CFAR
    if (size(fftOut2DMagSqRx1,2) > (2*threshWinSize+2*threshSkipSize+2)) && (detection_options.do_cfar_in_doppler == 1)
    % CFAR threshold computation, detection, local max check, etc. (implemented without for loop)
    fftOut2DMagSqRx1t = fftOut2DMagSqRx1';
    fftOut2DXtended = [fftOut2DMagSqRx1t(end-threshWinSize-threshSkipSize+1:end,:); fftOut2DMagSqRx1t; fftOut2DMagSqRx1t(1:threshWinSize+threshSkipSize,:)];
    % Construct in one-shot the cell-average( a.k.a mean noise floor) for each cell in the 2D Array.
    noiseMeanMat_trans = construct_noise_mean_mat(detection_options.cfar_method, threshWinSize, threshSkipSize, fftOut2DXtended);
    % threshMat is a matrix of thresholds for each cell (size of threshMat is same as size of fftOut2D)
    if detection_options.use_log_cfar == 1
    threshMat = detThreshdB + noiseMeanMat_trans;
    else
    threshMat = 10^(detThreshdB/10)*noiseMeanMat_trans;
    end
    % Detection is based on cell exceeding threshold, as well as being a local maxima (in both dimensions)
    threshDecisionMat2D = fftOut2DMagSqRx1t > threshMat;
    threshDecisionMat2D = threshDecisionMat2D';
    
    % Only accept cells if threshold is exceeded and local maxima in both dimensions
    localMaxMat = and(localMaxMat1D, localMaxMat2D);
    detDecisionMat = and(threshDecisionMat, threshDecisionMat2D);
    detDecisionMat = and(detDecisionMat, localMaxMat);
    else
    localMaxMat = and(localMaxMat1D, localMaxMat2D);
    detDecisionMat = and(threshDecisionMat, localMaxMat);
    end
    
    
    % Detected Target Processing %
    [indxRange, indxDoppler] = find(detDecisionMat);
    
    [indxRangeSorted, sortedIdx] = sort(indxRange);
    indxDopplerSorted = indxDoppler(sortedIdx);
    
    end