xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos...

15
1 SWRA581 – December 2017 Submit Documentation Feedback Copyright © 2017, Texas Instruments Incorporated xWR1xxx ADC Raw Data Capture Application Report SWRA581 – December 2017 xWR1xxx ADC Raw Data Capture ABSTRACT This document demonstrates how to interpret the raw ADC data saved by the xWR1xxx using the Capture Demo provided in the mmWave SDK and Radar Studio provided in the Device Firmware Package. The primary topics covered include how to save raw data from the Capture Demo using Code Composer Studio™ (CCS), the raw data format of data captured using the Capture Demo, the raw data format of data captured using Radar Studio, and how to interpret the data captured using Radar Studio in MATLAB. This document assumes that the user knows how to run the Capture Demo and Radar Studio. For instructions on how to run the Capture Demo, consult the mmWave SDK Demo Setup Guide found in the TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar Studio User’s Guide found in the Device Firmware Package and the mmWave Sensor Raw Data Capture Using the TSW1400 training. Contents 1 Prerequisites.................................................................................................................. 2 2 Viewing and Saving Raw Data Using Capture Demo and CCS ....................................................... 2 3 Raw Data Format of Capture Demo Using CCS ........................................................................ 4 4 xWR12xx and xWR14xx Radar Studio Data Format.................................................................... 6 5 xWR16xx Radar Studio Data Format ..................................................................................... 8 6 Interpreting the Radar Studio Binary File in MATLAB ................................................................. 10 7 Summary .................................................................................................................... 13 8 References .................................................................................................................. 13 List of Figures 1 Opening Memory Browser in CCS ........................................................................................ 2 2 Memory Browser Save Memory Button................................................................................... 3 3 Save Memory and File Type ............................................................................................... 3 4 Interleaved Complex Data Format Using Capture Demo .............................................................. 4 5 Interleaved Real Data Format Using Capture Demo ................................................................... 4 6 Non-Interleaved Complex Data Format Using Capture Demo......................................................... 5 7 Non-Interleaved Real Data Format Using Capture Demo.............................................................. 5 8 xWR14xx Real Data Format Using Radar Studio ....................................................................... 6 9 xWR14xx Complex Data Format Using Radar Studio .................................................................. 7 10 xWR16xx Real Data Format for One Receiver Using Radar Studio .................................................. 8 11 xWR16xx Real Data Format for Multiple Receivers Using Radar Studio ............................................ 8 12 xWR16xx Complex Data Format Using Radar Studio .................................................................. 9 13 xWR14xx MATLAB Script Output ........................................................................................ 11 14 xWR16xx MATLAB Script Output ........................................................................................ 12 List of Tables Trademarks Code Composer Studio is a trademark of Texas Instruments.

Transcript of xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos...

Page 1: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

1SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

Application ReportSWRA581–December 2017

xWR1xxx ADC Raw Data Capture

ABSTRACTThis document demonstrates how to interpret the raw ADC data saved by the xWR1xxx using the CaptureDemo provided in the mmWave SDK and Radar Studio provided in the Device Firmware Package. Theprimary topics covered include how to save raw data from the Capture Demo using Code ComposerStudio™ (CCS), the raw data format of data captured using the Capture Demo, the raw data format ofdata captured using Radar Studio, and how to interpret the data captured using Radar Studio in MATLAB.This document assumes that the user knows how to run the Capture Demo and Radar Studio. Forinstructions on how to run the Capture Demo, consult the mmWave SDK Demo Setup Guide found in theTI Resource Explorer mmWave Training Demos folder. For information on how to capture data usingRadar Studio, consult the Radar Studio User’s Guide found in the Device Firmware Package and themmWave Sensor Raw Data Capture Using the TSW1400 training.

Contents1 Prerequisites.................................................................................................................. 22 Viewing and Saving Raw Data Using Capture Demo and CCS ....................................................... 23 Raw Data Format of Capture Demo Using CCS ........................................................................ 44 xWR12xx and xWR14xx Radar Studio Data Format.................................................................... 65 xWR16xx Radar Studio Data Format ..................................................................................... 86 Interpreting the Radar Studio Binary File in MATLAB................................................................. 107 Summary .................................................................................................................... 138 References .................................................................................................................. 13

List of Figures

1 Opening Memory Browser in CCS ........................................................................................ 22 Memory Browser Save Memory Button................................................................................... 33 Save Memory and File Type ............................................................................................... 34 Interleaved Complex Data Format Using Capture Demo .............................................................. 45 Interleaved Real Data Format Using Capture Demo ................................................................... 46 Non-Interleaved Complex Data Format Using Capture Demo......................................................... 57 Non-Interleaved Real Data Format Using Capture Demo.............................................................. 58 xWR14xx Real Data Format Using Radar Studio ....................................................................... 69 xWR14xx Complex Data Format Using Radar Studio .................................................................. 710 xWR16xx Real Data Format for One Receiver Using Radar Studio.................................................. 811 xWR16xx Real Data Format for Multiple Receivers Using Radar Studio ............................................ 812 xWR16xx Complex Data Format Using Radar Studio .................................................................. 913 xWR14xx MATLAB Script Output ........................................................................................ 1114 xWR16xx MATLAB Script Output ........................................................................................ 12

List of Tables

TrademarksCode Composer Studio is a trademark of Texas Instruments.

Page 2: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

Prerequisites www.ti.com

2 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

1 PrerequisitesThis document assumes that the user has installed the necessary prerequisites for the Capture Demo andRadar Studio and is familiar with the instructions on how to use this software. This document has beentested against SDK 1.01.00.02, CCSv7.3, and Device Firmware Package 00.09.01.06.

For information on how to run the Capture Demo and any necessary prerequisites, please install themmWave SDK and refer to the mmWave SDK User’s Guide, found atC:\ti\mmwave_sdk_<version_number>\docs.

For information on how to run Radar Studio and any necessary prerequisites, please install the DeviceFirmware Package and refer to the Radar Studio User’s Guide, found atC:\ti\mmwave_dfp_<version_number>\rf_eval\docs.

2 Viewing and Saving Raw Data Using Capture Demo and CCSThis section discusses how to view and save the raw ADC data captured using the Capture Demoprovided in the mmWave SDK. This section assumes that the user is familiar with how to run the CaptureDemo using CCS. For information on how to run the Capture Demo please consult the mmWave SDKUser’s Guide, found at C:\ti\mmwave_sdk_<version_number>\docs.

The ADC data is stored in L3 can be viewed and saved using the Memory Browser in CCS. To access theMemory Browser, open the View tab and select the Memory Browser option, shown in Figure 1.

Figure 1. Opening Memory Browser in CCS

In the Memory Browser window the contents of the L3 memory can be viewed by specifying the startaddress of the L3 memory. The start address is specified by CAPTURE_L3RAM_DATA_MEM_ADDRESSin the capture.h file and varies based on SDK version. The total size of memory reserved to store ADCdata is specified by CAPTURE_L3RAM_DATA_MEM_SIZE in capture.h. Additionally, the L3 address andsize are output in the last line of the CCS console before sending the configuration file to the device.

Page 3: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

www.ti.com Viewing and Saving Raw Data Using Capture Demo and CCS

3SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

To save the raw ADC data click the Save Memory button at the top right corner of the Memory Browserwindow as shown in Figure 2.

Figure 2. Memory Browser Save Memory Button

In the Save Memory menu, specify the file path and file name and select TI Data as the file type as shownin Figure 3.

Figure 3. Save Memory and File Type

Click Next and specify the format, start address and length. For the format, select 16-Bit Hex – TI Style.The length of the data will be based on the users chirp configuration. To calculate the length in words, thefollowing formulas can be used. First, find the total size of ADC data generated in bytes.

Total Size in Bytes = Num ADC Samples × Num RX Channels × Num Frames × Num Chirps × Num Bytes PerSample (1)

The number of bytes per sample is based the output format specified by the adcCfg parameter in thesensor configuration. For a complex output format, there are 4 bytes per sample: 2 bytes for the real partand 2 bytes for the imaginary part. For a real output format, there are 2 bytes per sample. Once the totalsize of the data in bytes is determined the number of words can be found by dividing the total size by 16;this assumes that the user is saving in a 16-bit Hex – TI Style format.

Length in Words = Total Size / 2 bytes per word (2)

Once the data is saved, it can be viewed in MATLAB using the capture_demo.m file located atC:\mmwave_sdk_<version_number>\packages\ti\demo\xwr14xx\capture\gui for the xWR1xx, and locatedat C:\ti\mmwave_sdk_01_00_00_05\packages\ti\demo\xwr16xx\capture\gui for the xWR16xx. This fileplots the raw ADC data and the 1D FFT of the ADC data. The user can modify this code to completeadditional post processing on the data. To do further post processing the user must understand how theoutput data is formatted, as shown in Section 3.

Page 4: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

4 RX Real 3 RX Real 2 RX Real

Raw Data Format of Capture Demo Using CCS www.ti.com

4 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

3 Raw Data Format of Capture Demo Using CCSData captured using the Capture Demo can be stored in interleaved or non-interleaved mode, as specifiedby the adcbufCfg command in the sensor configuration. For xWR14xx devices, interleaved mode isrecommended but non-interleaved mode can also be used. For xWR16xx devices only non-interleavedmode can be used. By default the xWR14xx is configured for interleaved mode and the xWR16xx isconfigured for non-interleaved mode. More information about interleaving can be found in the AWR1xxxData Path programmer’s guide. Data is stored in a 16-bit, two's-complement format.

Figure 4 shows the output data for interleaved mode with complex data for 4 RX, 3 RX, and 2 RXantennas..

Figure 4. Interleaved Complex Data Format Using Capture Demo

Figure 4 represents how the data is saved when using 16-bit Hex – TI Style when the file is saved as a TIdata format file. In Figure 4, RX0 I(0) represents the first sample of real data received at RX0, and RX0Q(0) represents the first sample of imaginary data received at RX0. RX0 I(1) represents the secondsample of real data received at RX0, and so on.

Data can also be captured as real data only. Figure 5 shows how the data is saved for interleaved modewith real data for 4 RX, 3 RX, and 2 RX antennas.

Figure 5. Interleaved Real Data Format Using Capture Demo

Page 5: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

www.ti.com Raw Data Format of Capture Demo Using CCS

5SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

Data can also be stored in a non-interleaved format. For the xWR16xx, data can only be stored in non-interleaved format. However, for the xWR14xx, interleaved mode is recommended. Figure 6 shows theoutput format of the data for non-interleaved complex data.

Figure 6. Non-Interleaved Complex Data Format Using Capture Demo

In non-interleaved format, all of the data for a given RX is stored in a single block of memory followed byall of the data for the next RX in another block of memory. For example, all of the RX0 data is storedsequentially, followed by all of the RX1 data. To determine the amount of memory occupied by each RX,use Equation 3.

Bytes Per RX = Num ADC Samples × Num Frames × Num Chirps × Num Bytes Per Sample (3)

For complex data, there are four bytes per sample. For real data, there are two bytes per sample. Fornon-interleaved data, the number of words per RX can be determined using Equation 4.

Words per RX = Bytes per RX / 2 bytes per word (4)

Figure 7 shows the output format of the data for non-interleaved real data.

Figure 7. Non-Interleaved Real Data Format Using Capture Demo

Page 6: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

RX0 Sample 1RX0 Sample 2RX1 Sample 1RX1 Sample 2RX2 Sample 1RX2 Sample 2RX3 Sample 1RX3 Sample 2

RX0 Sample N-1RX0 Sample N

RX1 Sample N-1RX1 Sample N

RX2 Sample N-1RX2 Sample N

RX3 Sample N-1RX3 Sample N

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

Start of File

RX0 Sample 1RX0 Sample 2RX1 Sample 1RX1 Sample 2RX2 Sample 1RX2 Sample 2RX3 Sample 1RX3 Sample 2

RX0 Sample N-1RX0 Sample N

RX1 Sample N-1RX1 Sample N

RX2 Sample N-1RX2 Sample N

RX3 Sample N-1RX3 Sample N

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

End of File

1st

ChirpN ADC Sample per Chirp

Mth

ChirpN ADC Sample per Chirp

xWR12xx and xWR14xx Radar Studio Data Format www.ti.com

6 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

Similarly to the non-interleaved mode with complex data, in non-interleaved mode with real data, all of thedata for a given RX is stored in a single block of memory followed by all of the data for the next RX in thenext block of memory. For example, if there are 1024 words per RX channel, all 1024 words for RX0 willbe stored first, followed by all 1024 words for RX1, and so on.

4 xWR12xx and xWR14xx Radar Studio Data FormatIn addition to the Capture Demo, ADC data can also be saved using Radar Studio and the TSW1400 withHSDCPro. This section discusses the data format of data saved using Radar Studio for the xWR12xx andxWR14xx. For information on how to use Radar Studio to capture data please consult the Radar StudioUser’s Guide found in the mmWave Device Firmware Package.

For xWR12xx and xWR14xx devices, data is captured in Radar Studio over four LVDS lanes and is storedin a binary file. The captured data samples are two bytes long and in the ‘offset binary format’. This meansthat each sample has an extra 215 added to it. In order to get the correct two’s-complement number, 215

must be subtracted from each sample. Each LVDS lane corresponds to a given receiver. For real data,each LVDS lane will capture two data samples per receiver and for complex data each LVDS lane willcapture the real and imaginary part per receiver. Figure 8 shows how data is stored in the binary file forreal data for M number of chirps and N number of ADC samples per chirp.

Figure 8. xWR14xx Real Data Format Using Radar Studio

Page 7: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

RX1 (I) Sample 1RX1 (Q) Sample 1RX2 (I) Sample 1RX2 (Q) Sample 1RX3 (I) Sample 1RX3 (Q) Sample 1RX4 (I) Sample 1RX4 (Q) Sample 1

RX1 (I) Sample N-1RX1 (Q) Sample NRX1 (I) Sample N-1RX1 (Q) Sample NRX1 (I) Sample N-1RX1 (Q) Sample NRX1 (I) Sample N-1RX1 (Q) Sample N

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

Start of File

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

LVDS Lane 3

LVDS Lane 4

End of File

1st

ChirpN ADC Sample per Chirp

Mth

ChirpN ADC Sample per Chirp

RX1 (I) Sample 1RX1 (Q) Sample 1RX2 (I) Sample 1RX2 (Q) Sample 1RX3 (I) Sample 1RX3 (Q) Sample 1RX4 (I) Sample 1RX4 (Q) Sample 1

RX1 (I) Sample N-1RX1 (Q) Sample NRX2 (I) Sample N-1RX2 (Q) Sample NRX3 (I) Sample N-1RX3 (Q) Sample NRX4 (I) Sample N-1

.

.

.

RX4 (Q) Sample N

www.ti.com xWR12xx and xWR14xx Radar Studio Data Format

7SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

As shown in Figure 8, each LVDS lane corresponds to a given receiver. If all four receivers are enabled,data will be stored as seen in the Figure 8. Any unused LVDS lanes will be populated with zeros. Forexample, if receivers 1 and 3 are enabled then LVDS lane 1 will contain the data from receiver 1 andLVDS lane 2 will contain the data from receiver 3. Lanes 3 and 4 will be populated with zeros. Figure 9shows the data storage format of the binary file for complex data.

Figure 9. xWR14xx Complex Data Format Using Radar Studio

The complex data format differs from the real data format in that each LVDS lane now only captures onesample per receiver. Each sample consists of both a real and imaginary part. Similarly to the real dataformat, any unused LVDS lanes will be populated with zeros. For example, if receivers 1 and 3 areenabled then LVDS lane 1 will contain the data from receiver 1 and LVDS lane 2 will contain the data fromreceiver 3. Lanes 3 and 4 will be populated with zeros.

Page 8: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

RX0 Sample 1RX0 Sample 3RX0 Sample 2RX0 Sample 4

RX0 Sample N-3RX0 Sample N-1RX0 Sample N-2RX0 Sample N

LVDS Lane 1

LVDS Lane 2

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

Start of File

LVDS Lane 1

LVDS Lane 2

.

.

.

LVDS Lane 1

LVDS Lane 2

End of File

1st

ChirpN ADC Sample per Chirp

Mth

ChirpN ADC Sample per Chirp

RX_X Sample N-3RX_X Sample N-1RX_X Sample N-2RX_X Sample N

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

RX0 Sample 1RX0 Sample 3RX0 Sample 2RX0 Sample 4

RX0 Sample N-3RX0 Sample N-1RX0 Sample N-2RX0 Sample N

.

.

.

RX_X Sample N-3RX_X Sample N-1RX_X Sample N-2RX_X Sample N

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

RX_X Sample 1RX_X Sample 2

00

RX_X Sample N-1RX_X Sample N

00

LVDS Lane 1

LVDS Lane 2

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

Start of File

LVDS Lane 1

LVDS Lane 2

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

End of File

1st

ChirpN ADC Sample per Chirp

Mth

ChirpN ADC Sample per Chirp

00

00

.

.

.

RX_X Sample 1RX_X Sample 2

RX_X Sample N-1RX_X Sample N

xWR16xx Radar Studio Data Format www.ti.com

8 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

5 xWR16xx Radar Studio Data FormatThis section discusses the data format of data saved using Radar Studio and the TSW1400 with thexWR16xx. For information on how to use Radar Studio to capture data please consult the Radar StudioUser’s Guide found in the mmWave Device Firmware Package.

For xWR16xx devices, data is captured over two LVDS lanes and is stored in a binary file. Data samplescaptured via HSDCPro are 2 bytes long and in the ‘offset binary format’. This means that each sample hasan extra 215 added to it. In order to get the correct two’s-complement number, 215 must be subtracted fromeach sample. Because only two LVDS lanes are used, data capture using 3 receivers is not available withthe xWR16xx. Only 1, 2, and 4 enabled receivers can be used. Figure 10 shows how real data is capturedfor one receiver.

Figure 10. xWR16xx Real Data Format for One Receiver Using Radar Studio

When only one receiver is enabled only the first LVDS lane is used. Data sent from the second LVDS laneis populated with zeros. If there are N number of ADC samples and M number of chirps, the data is storedbeginning with samples 1 through N of the first chirp through to samples 1 through N of the Mth chirp. Ifmultiple receivers are enabled the data is stored in a different format, shown in Figure 11.

Figure 11. xWR16xx Real Data Format for Multiple Receivers Using Radar Studio

Page 9: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

1st

ChirpN ADC Sample per Chirp

Mth

ChirpN ADC Sample per Chirp

RX0 (I) Sample 1RX0 (Q) Sample 1RX1 (I) Sample 1RX1 (Q) Sample 1

RX0 (I) Sample NRX0 (Q) Sample NRX1 (I) Sample NRX1 (Q) Sample N

LVDS Lane 1

LVDS Lane 2

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

Start of File

LVDS Lane 1

LVDS Lane 2

.

.

.

LVDS Lane 1

LVDS Lane 2

RX2 (I) Sample 1RX2 (Q) Sample 1RX3 (I) Sample 1RX3 (Q) Sample 1

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

.

.

.

LVDS Lane 1

LVDS Lane 2

RX2 (I) Sample NRX2 (Q) Sample NRX3 (I) Sample NRX3 (Q) Sample N

.

.

.

.

.

.

LVDS Lane 1

LVDS Lane 2

.

.

.

LVDS Lane 1

LVDS Lane 2

RX0 (I) Sample 1RX0 (Q) Sample 1RX1 (I) Sample 1RX1 (Q) Sample 1

RX0 (I) Sample NRX0 (Q) Sample NRX1 (I) Sample NRX1 (Q) Sample N

.

.

.

RX2 (I) Sample 1RX2 (Q) Sample 1RX3 (I) Sample 1RX3 (Q) Sample 1

.

.

.

RX2 (I) Sample NRX2 (Q) Sample NRX3 (I) Sample NRX3 (Q) Sample N

.

.

.

End of File

www.ti.com xWR16xx Radar Studio Data Format

9SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

When multiple receivers are enabled both LVDS lanes are used, with lane 1 sending the odd samplesfrom each receiver and lane 2 sending the even samples from each receiver. If there is a total of Mnumber of chirps, the data is stored beginning with first chirp and ending with the Mth chirp. Each chirp isstored in the order of the receiver, beginning with the lowest number receiver and ending with the highestnumber receiver. For complex data, each LVDS lane sends a real part and an imaginary part. The formatfor complex data is shown in Figure 12.

Figure 12. xWR16xx Complex Data Format Using Radar Studio

The complex data is stored in an interleaved format beginning with the real part followed by the imaginarypart. If only one receiver is enabled, the data stored from lane 2 will be populated with zeros. Whenmultiple receivers are enabled the data is stored in the interleaved format shown in Figure 12, beginningwith the first chirp through to the Mth chirp, given a total of M number of chirps. For any receivers that aredisabled, the section corresponding to the disabled receivers can be removed from the diagram inFigure 12 to determine the total data output.

Page 10: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

Interpreting the Radar Studio Binary File in MATLAB www.ti.com

10 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

6 Interpreting the Radar Studio Binary File in MATLABThe data captured in Radar Studio can be processed using the Radar Studio GUI. However, any custompost processing will require the user to create a custom script. This section contains sample MATLABcode snippet to help the user to interpret binary files captured using the xWR14xx and xWR16xx to allowfor custom post processing.

6.1 xWR12xx and XWR14xx MATLAB ExampleAlthough this document specifically discusses the capture demo, a similar concept can be applied to otherdemos or projects by using CCS to set a break point in the code and using the CCS Memory Browser toextract the raw ADC data.%%% This script is used to read the binary file produced by the TSW1400%%% and Radar Studio%%% Command to run in Matlab GUI - readTSW14xx('<ADC capture bin file>')

function [retVal] = readTSW14xx(fileName)%% global variables

% change based on sensor config%----------------------------------------------------------------------numADCBits = 16; % number of ADC bits per samplenumLanes = 4; % do not change. number of lanes is always 4 even if only 1 lane is used. unusedlanesisReal = 0; % set to 1 if real only data, 0 if complex dataare populated% with 0%----------------------------------------------------------------------

%% read file and convert to signed number

% read .bin filefid = fopen(fileName,'r');adcData = fread(fid, 'uint16');% compensate for offset binary formatadcData = adcData - 2^15;% if 12 or 14 bits ADC per sample compensate for sign extensionif numADCBits ~= 16

l_max = 2^(numADCBits-1)-1;adcData(adcData > 1_max) = adcData(adcData > 1_max) - 2^numADCBits;

endfclose(fid);%% organize data by LVDS lane

% reshape data based on two samples per LVDS laneadcData = reshape(adcData, numLanes*2, []);% for real only dataif isReal

%each LVDS lane contains two samples from each RXrxSample1 = adcData([1,3,5,7],:);rxSample2 = adcData([2,4,6,8],:);% interleave the first sample set and the second sample setadcData = reshape([rxSample1;rxSample2], size(rxSample1,1), []);

%for complex dataelse

% combine real and imaginary parts of complex numberadcData = adcData([1,3,5,7],:) + sqrt(-1)*adcData([2,4,6,8],:);

end%% return receiver data

retVal = adcData;

The function in the previous code snippet will return a matrix with all of the receiver data stored in rows.The values for numADCBits and isReal should be modified based on the sensor configuration used. Thevalue for numLanes should not be modified as there will always be four LVDS lanes used. Unused laneswill be populated with zeros.

tom85
螢光標示
Page 11: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

www.ti.com Interpreting the Radar Studio Binary File in MATLAB

11SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

The returned matrix of the function should look similar to Figure 13.

Figure 13. xWR14xx MATLAB Script Output

In Figure 13, row 1 contains all of the data from the first receiver, row 2 from the second receiver, row 3from the third receiver, and row 4 from the fourth receiver. In cases where certain receivers are disabled,the corresponding rows will be populated with zeros. Each row will contain a number of columns equal tothe number of ADC samples per chirp multiplied by the total number of chirps. The columns are organizedby chirps. For example, if there are 256 ADC samples and a total of 10 chirps, each row will contain 2560columns. The first 256 columns will correspond to the first chirp, the next 256 columns to the second chirp,and so on. The data can then be processed as the user desires.

6.2 xWR16xx MATLAB ExampleThe function in the following MATLAB code example can be used to read files saved with the xWR16xx.%%% This script is used to read the binary file produced by the TSW1400%%% and Radar Studio%%% Command to run in Matlab GUI - readTSW16xx('<ADC capture bin file>')

function [retVal] = readTSW16xx(fileName)%% global variables

% change based on sensor config%----------------------------------------------------------------------numADCSamples = 256; % number of ADC samples per chirpnumADCBits = 16; % number of ADC bits per samplenumRX = 1; % number of receiversnumLanes = 2; % do not change. number of lanes is always 2isReal = 1; % set to 1 if real only data, 0 if complex data0%-----------------------------------------------------------------------%% read file

% read .bin filefid = fopen(fileName,'r');adcData = fread(fid, 'uint16');% compensate for offset binary formatadcData = adcData - 2^15;% if 12 or 14 bits ADC per sample compensate for sign extensionif numADCBits ~= 16

l_max = 2^(numADCBits-1)-1;adcData(adcData > 1_max) = adcData(adcData > 1_max) - 2^numADCBits;

endfclose(fid);% get total filefileSize = size(adcData, 1);test = adcData;%% organize data by LVDS lane

% reshape data based on two samples per LVDS laneadcData = reshape(adcData, numLanes*2, []);% for real dataif isReal

% seperate each LVDS lane into rowsLVDS = zeros(2, length(adcData(1,:))*2);% interleave the two sample sets from each laneLVDS(1,1:2:end-1) = adcData(1,:);LVDS(1,2:2:end) = adcData(2,:);

Page 12: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

Interpreting the Radar Studio Binary File in MATLAB www.ti.com

12 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

if numRX > 1LVDS(2,1:2:end-1) = adcData(3,:);LVDS(2,2:2:end) = adcData(4,:);LVDS = reshape([LVDS(1,:);LVDS(2,:)], size(LVDS(1,:),1), []);

end% for complex dataelse

fileSize = fileSize/2;% seperate each LVDS lane into rowsLVDS = zeros(2, length(adcData(1,:)));% combine real and imaginary partsLVDS(1,:) = adcData(1,:) + sqrt(-1)*adcData(2,:);if numRX > 1

LVDS(2,:) = adcData(3,:) + sqrt(-1)*adcData(4,:);LVDS = reshape([LVDS(1,:);LVDS(2,:)], size(LVDS(1,:),1), []);

endend

%% organize data by receiver

% seperate each receiver into a single rowadcData = zeros(numRX, fileSize/numRX);if numRX > 1

for j = 1:numRXiter =1;for i = (j-1)*numADCSamples+1:numADCSamples*numRX:fileSize

adcData(j,iter:iter+numADCSamples-1) = LVDS(1, i:i+numADCSamples-1);iter = iter+numADCSamples;

endend

elseadcData = LVDS(1,:);

end%% return receiver data

retVal = adcData;

The function in the above code snippet will return a matrix with all of the receiver data stored in rows. Thevalues for numADCSamples, numADCBits, numRX and isReal should be modified based on the sensorconfiguration used. The value for numLanes should not be modified as there will always be two LVDSlanes used. Unused lanes will be populated with zeros.

The returned matrix of the function should look similar to Figure 14.

Figure 14. xWR16xx MATLAB Script Output

In Figure 14, row 1 contains all of the data from the first receiver, row 2 from the second receiver, row 3from the third receiver, and row 4 from the fourth receiver. In cases where certain receivers are disabled,the corresponding rows will be removed. Each row will contain a number of columns equal to the numberof ADC samples per chirp multiplied by the total number of chirps. The columns are organized by chirps.For example, if there are 256 ADC samples and a total of 10 chirps, each row will contain 2560 columns.The first 256 columns will correspond to the first chirp, the next 256 columns to the second chirp, and soon. The data can then be processed as the user desires.

Page 13: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

www.ti.com Summary

13SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

xWR1xxx ADC Raw Data Capture

7 SummaryThis document outlines how to interpret raw ADC data that is captured using the Capture Demo or RadarStudio. For data captured using the Capture Demo the capture_demo.m file, provided in the mmWaveSDK, can be used and modified to process the data. For data captured in Radar Studio the providedMATLAB code snippet can be used to read the binary file and organize the data into columns by receiver.The user can then add to the code to process the data as needed.

8 References• AWR1xxx Data Path• IWR16xx/14xx Industrial Radar Family• mmWave Sensor Raw Data Capture Using the TSW1400 Board• mmWave Device Firmware Package• mmWave Software Development Kit

Page 14: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

Revision History www.ti.com

14 SWRA581–December 2017Submit Documentation Feedback

Copyright © 2017, Texas Instruments Incorporated

Revision History

Revision HistoryNOTE: Page numbers for previous revisions may differ from page numbers in the current version.

Date Revision DescriptionDecember 2017 * Initial release

Page 15: xWR1xxx ADC Raw Data Capture - Texas Instruments · TI Resource Explorer mmWave Training Demos folder. For information on how to capture data using Radar Studio, consult the Radar

IMPORTANT NOTICE FOR TI DESIGN INFORMATION AND RESOURCES

Texas Instruments Incorporated (‘TI”) technical, application or other design advice, services or information, including, but not limited to,reference designs and materials relating to evaluation modules, (collectively, “TI Resources”) are intended to assist designers who aredeveloping applications that incorporate TI products; by downloading, accessing or using any particular TI Resource in any way, you(individually or, if you are acting on behalf of a company, your company) agree to use it solely for this purpose and subject to the terms ofthis Notice.TI’s provision of TI Resources does not expand or otherwise alter TI’s applicable published warranties or warranty disclaimers for TIproducts, and no additional obligations or liabilities arise from TI providing such TI Resources. TI reserves the right to make corrections,enhancements, improvements and other changes to its TI Resources.You understand and agree that you remain responsible for using your independent analysis, evaluation and judgment in designing yourapplications and that you have full and exclusive responsibility to assure the safety of your applications and compliance of your applications(and of all TI products used in or for your applications) with all applicable regulations, laws and other applicable requirements. Yourepresent that, with respect to your applications, you have all the necessary expertise to create and implement safeguards that (1)anticipate dangerous consequences of failures, (2) monitor failures and their consequences, and (3) lessen the likelihood of failures thatmight cause harm and take appropriate actions. You agree that prior to using or distributing any applications that include TI products, youwill thoroughly test such applications and the functionality of such TI products as used in such applications. TI has not conducted anytesting other than that specifically described in the published documentation for a particular TI Resource.You are authorized to use, copy and modify any individual TI Resource only in connection with the development of applications that includethe TI product(s) identified in such TI Resource. NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE TOANY OTHER TI INTELLECTUAL PROPERTY RIGHT, AND NO LICENSE TO ANY TECHNOLOGY OR INTELLECTUAL PROPERTYRIGHT OF TI OR ANY THIRD PARTY IS GRANTED HEREIN, including but not limited to any patent right, copyright, mask work right, orother intellectual property right relating to any combination, machine, or process in which TI products or services are used. Informationregarding or referencing third-party products or services does not constitute a license to use such products or services, or a warranty orendorsement thereof. Use of TI Resources may require a license from a third party under the patents or other intellectual property of thethird party, or a license from TI under the patents or other intellectual property of TI.TI RESOURCES ARE PROVIDED “AS IS” AND WITH ALL FAULTS. TI DISCLAIMS ALL OTHER WARRANTIES ORREPRESENTATIONS, EXPRESS OR IMPLIED, REGARDING TI RESOURCES OR USE THEREOF, INCLUDING BUT NOT LIMITED TOACCURACY OR COMPLETENESS, TITLE, ANY EPIDEMIC FAILURE WARRANTY AND ANY IMPLIED WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUALPROPERTY RIGHTS.TI SHALL NOT BE LIABLE FOR AND SHALL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY CLAIM, INCLUDING BUT NOTLIMITED TO ANY INFRINGEMENT CLAIM THAT RELATES TO OR IS BASED ON ANY COMBINATION OF PRODUCTS EVEN IFDESCRIBED IN TI RESOURCES OR OTHERWISE. IN NO EVENT SHALL TI BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL,COLLATERAL, INDIRECT, PUNITIVE, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES IN CONNECTION WITH ORARISING OUT OF TI RESOURCES OR USE THEREOF, AND REGARDLESS OF WHETHER TI HAS BEEN ADVISED OF THEPOSSIBILITY OF SUCH DAMAGES.You agree to fully indemnify TI and its representatives against any damages, costs, losses, and/or liabilities arising out of your non-compliance with the terms and provisions of this Notice.This Notice applies to TI Resources. Additional terms apply to the use and purchase of certain types of materials, TI products and services.These include; without limitation, TI’s standard terms for semiconductor products http://www.ti.com/sc/docs/stdterms.htm), evaluationmodules, and samples (http://www.ti.com/sc/docs/sampterms.htm).

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265Copyright © 2017, Texas Instruments Incorporated