Record Raw ADC Data for Offline Processing from TI mmWave Radar Board Using DCA1000EVM Capture Card
This example shows how to use Radar Toolbox Support Package for Texas Instruments® mmWave Radar Sensors to read and record raw ADC radar data (IQ data) from Texas Instruments (TI) radars in binary files and analyze the recorded data.
This example evaluates and visualizes the range response and range-doppler response using the ADC data recorded from the TI mmWave radar.
Required Products
MATLAB®
Radar Toolbox Support Package for Texas Instruments mmWave Radar Sensors
For information on installing the support package, see Install Support and Perform Hardware Setup for TI mmWave Hardware.
Required Hardware
One of the TI mmWave Radar Evaluation Modules (EVMs) that supports reading raw ADC data (IQ data) by connecting to DCA1000EVM (see Supported Boards)
USB Cable Type A to Micro B
5V, 3 A power adapter
DCA1000EVM capture card
Samtec cable
Ethernet cable
For more details regarding these hardware components, see Hardware Requirements for Acquiring ADC data Using TI mmWave Radar and DCA1000EVM.
Hardware Setup
You must set up the TI mmWave radar sensor before you can use it to read ADC data to MATLAB. Set up the sensor by completing the hardware setup procedure (as explained in the Hardware Setup screens). To launch hardware setup, execute the below command and follow the steps shown in the screens.
mmWaveRadarSetup
For information on launching the Hardware Setup screens, see Install Support and Perform Hardware Setup for TI mmWave Hardware.
Connect to mmWave Radar and DCA1000 Capture card
After the hardware setup process is completed successfully, you can connect to the TI Radar board and DCA1000 by specifying the board name. This example uses the IWR6843ISK EVM. If you are using a different EVM, change the board name accordingly.
dca = dca1000("IWR6843ISK");
If you have connected only one TI Radar board to the host computer, MATLAB detects the serial port details automatically. If you have connected more than one board or if MATLAB does not automatically populate the serial port details, specify the ConfigPort argument. For example:
dca = dca1000("IWR6843ISK",ConfigPort = "COM3")
Refer to Identifying Serial Ports for TI mmWave Radar Connection to identify the Config port corresponding to your board.
Configuring the TI Radar
To configure the TI mmWave radar board, you must send a sequence of commands to the board using the serial port. The sequence includes commands specifying the chirp profile, sampling rate, and so on. Use the ConfigFile property of the dca1000 object to send the sequence of commands to the board. For more information, see Configure Radar Using a Configuration (.cfg) File for Reading Raw ADC (IQ) Data.
In this example, we will be using a default configuration that ships with support package.
Record ADC data, compute and visualize range response and range doppler response for the recorded data
This section is divided into two parts:
1. Record the ADC data from TI Radar board using DCA1000EVM capture card
2. Read radar data cubes from the recorded files, and compute and visualize range response and range doppler response for the data
Record the ADC data from TI Radar board using DCA1000EVM capture card
The properties of dca1000
object can be used to set recording parameters (RecordDuration
, RecordLocation
, and so on). The function startRecording
of dca1000 object can be used to read and record the ADC data from the TI Radar board in binary format along with other metadata in the record location specified.
The below script reads and stores ADC data from the TI Radar board for 100s in the RecordLocation
specified.
Note: When you start the recording using the startRecording
function, a pop-up window appears. Do not close this window while the recording is in progress. The window closes automatically when the recording is stopped.
clear dca % Create connection to the TI Radar board and DCA1000EVM Capture card dca = dca1000("IWR6843ISK"); % Specify the duration to record ADC data dca.RecordDuration = 100; % Specify the location at which you want to store the recorded data along % with the recording parameters dca.RecordLocation = "C:\TIRadarADCData\dca1000Data"; % Start recording. % The function startRecording opens a window. Ensure that you do not % close this window. It will automatically close when the recording % finishes. startRecording(dca); % The startRecording function captures data in background. % While this is happening, you are free to utilize MATLAB for any other % tasks you might need to perform. The following code is designed to % prevent MATLAB from proceeding until the recording has finished. % The isRecording() function will return true if the recording is still % in progress. Once the recording has concluded or if it has not started, % the function will return false. while isRecording(dca) end % Remember the record location for post-processing. % In this example, we will save the recording location in a variable. recordLocation = dca.RecordLocation; % Clear the dca1000 object and remove the hardware connections if required clear dca
This image shows a sample of files generated along with the ADC data recordings.
Rather than setting a fixed duration for recording, you have the option to record flexibly for as long as you need. To enable this, configure the RecordDuration
property of the dca1000
object to inf
. When you are ready to stop recording, use the stopRecording
function of the dca1000
object.
Read radar data cubes from the recorded files, and compute and visualize range response and range doppler response for the data
To read the ADC data (IQ data) cubes from these recorded binary files, you can utilize the dca1000FileReader
System object. The phased.RangeResponse
System object™ is used to perform range filtering on fast-time (range) data, using an FFT-based algorithm. plotResponse
function of the phased.RangeResponse
is used to plot the range response of the input data. The phased.RangeDopplerScope
computes and displays the range-doppler response map.
% Load the recording parameters and Radar Configurations from the record % location. This data is stored as a .mat file in the record location temp = load(fullfile(recordLocation,'iqData_RecordingParameters.mat')); dcaRecordingParams = temp.RecordingParameters; % Define a variable to set the sampling rate in Hz for the % phased.RangeResponse object. Because the dca1000 object provides the % sampling rate in kHz, convert this rate to Hz. fs = dcaRecordingParams.ADCSampleRate*1e3; % Define a variable to set the FMCW sweep slope in Hz/s for the % phased.RangeResponse object. The dca1000 object provides the % sweep slope in GHz/us; convert this sweep slope to Hz/s. sweepSlope = dcaRecordingParams.SweepSlope * 1e15; % Define a variable to set the number of range samples nr = dcaRecordingParams.SamplesPerChirp; % Define a variable to set the center frequency in Hz for the % phased.RangeDopplerScope object. The dca1000 object provides the % center frequency in GHz; convert this rate to Hz. fc = dcaRecordingParams.CenterFrequency*1e9; % Define a variable to set the pulse repetition period in seconds for the % phased.RangeDopplerScope object. Because the dca1000 object provides the % chirp cycle time in us, convert this rate to seconds. The value is % multiplied by 2 since in the example we are plotting the data only for first % transmit channel out of 2 channels tpulse = 2*dcaRecordingParams.ChirpCycleTime*1e-6; % Pulse repetition interval prf = 1/tpulse; % Number of active receivers nrx = dcaRecordingParams.NumReceivers; % Number of chirps nchirp = dcaRecordingParams.NumChirps; % Create phased.RangeResponse System object that performs range filtering % on fast-time (range) data, using an FFT-based algorithm rangeresp = phased.RangeResponse(RangeMethod = 'FFT', ... RangeFFTLengthSource = 'Property', ... RangeFFTLength = nr, ... SampleRate = fs, ... SweepSlope = sweepSlope, ... ReferenceRangeCentered = false); % Create range doppler scope to compute and display the response map. rdscope = phased.RangeDopplerScope(IQDataInput=true, ... SweepSlope = sweepSlope,SampleRate = fs, ... DopplerOutput="Speed",OperatingFrequency=fc, ... PRFSource="Property",PRF=prf, ... RangeMethod="FFT",RangeFFTLength=nr, ... ReferenceRangeCentered = false); % Create a dca1000FileReader object that enables you to read ADC data (IQ data) cubes % from the binary files recorded using the object DCA1000 in MATLAB fr = dca1000FileReader(recordLocation = recordLocation); % Execute the loop till all the IQ data cubes are read from the record location while (fr.CurrentPosition <= fr.NumDataCubes) % Read a single IQ data cube from the binary file, % starting from the location previously accessed. iqData = read(fr,1); % The function read() return cell array of IQ data cube, % extract the radar data cube from it iqData = iqData{1}; % Get the data from first receiver antenna iqDataRx1 = squeeze(iqData(:,1,:)); % Plots the range response corresponding to the input signal, iqData. plotResponse(rangeresp, iqDataRx1); % Get the data from first receiver antenna and first transmitter antenna % (Every alternate pulse is from one transmitter antenna for this % configuration) iqDataRx1Tx1 = squeeze(iqData(:,1,1:2:end)); % Plots the range doppler response corresponding to the input signal, % iqData. rdscope(iqDataRx1Tx1); end