摘要
这篇应用报告展示了如何转译使用Capture Demo或者Mmwave Studio采集到的原始ADC数据。单独讨论了使用不同硬件配置采集到的原始ADC数据的格式。对于需要开发自制代码进行数据处理的工程师提供了Matlab snippet。
1.介绍
mmwave雷达(xWRxxxx)的原始数据能够使用mmWave SDK中提供的Capture Demo采集,或者使用Mmwave Studio GUI tools中提供的Mmwave Studio。涵盖的主要话题包括:如何使用 Code Composer StudioTM (CCS)从 Capture Demo 保存原始数据,使用Capture Demo采集的数据的格式,使用Mmwae Studio采集到的数据的格式,以及如何在MATLAB中翻译数据。这篇文件假设使用者知道如何使用Capture Demo以及Mmwave Studio。对于如何使用Capture Demo的指示,可以查阅TI Resource Explorer mmWave Training中的mmWave SDK Demo Setup Guide。兑入如何使用Mmwave Studio采集数据的有关信息,查询Mmwave Studio GUI tools中的Mmwave Studio User’s Guide。注意Mmwave Studio(以前也称作Radar Studio)支持两种不同的平台。其中一个是DCA1000EVM Data Capture Card User’s Guide ,它有xWRxxxx EVM的接口,可以让使用者将ADC数据通过Ethernet传输。另一个平台是TSW140x High Speed Data Capture/Pattern Generator Card,它需要Mmwave devPack EVM以及High Speed Data Converter Pro GUI User’s Guide。TSW1400 EVM通过Serial Peripheral Interface(SPI)传输采集到的数据到电脑上(通过板载USB到SPI的转换器)。Radar Studio(旧版本的Mmwave Studio)仅支持带HSDC Pro的TSW1400 EVM。需要更多信息,查看Device Firmware Package的Radar Studio User’s Guide以及mmWave Sensor Raw Data Capture Using the TSW1400 Board的教学视频。
对于Mmwave Studio中对DCA1000 EVM以及TSW1400用户接口的不同,可以看Mmwave Studio User Guide。DCA1000的设计基于Lattice FPGA,LVDS数据通过Ethernet传输。TSW1400 EVM基于Altera FPGA,使用不同的格式采集LVSD数据。数据格式也依赖于mmwave设备的种类。因此,需要区别讨论不同的格式。
本篇应用报告结构如下- Section 2列出了要求,Section 3描述了如何使用capture demo以及CCS存储ADC数据。Section 4讨论了通过capture demo以及CCS保存的数据格式。Section 5,Section 6,Section 7以及Section 8有使用DCA 1000以及TSW 1000通过Mmwave Studio对不同的xWRxxxx设备保存下来的数据的格式的详细描述。Section 9提供了用于处理Mmwave Studio采集到数据的Matlab脚本样例。
2.Prerequisites
文章假设使用者已经安装了必要的Capture Demo、Mmwave Studio的先决条件,并且假设用户熟悉如何使用这些软件。本文已针对 SDK 1.01.00.02、CCSv7.3、Mmwave Studio 1.0.0.0 进行了测试
对于关于如何使用Capture Demo以及任何必要先决条件的信息,安装mmWave SDK。也可以看mmWave SDK User’s Guide,在C:\ti\mmwave_sdk_<version_number>\docs可以找到
对于关于如何使用Mmwave Studio以及任何必要先决条件的信息,安装Mmwave Studio GUI tools。可以看Mmwave Studio User’s Guide,在C:\ti\mmwave_studio_<version_number>\docs中可以找到。
3.使用Capture Demo以及CCS查看以及保存原始数据。
本小节讨论如何使用mmWave SDK中提供的Capture Demo查看以及保存采集的原始ADC数据。本小节假设用户熟悉如何使用CCS跑Capture Demo。关于如何跑Capture Demo的信息,查阅mmWave SDK User’s Guide,可以在 C:\ti\mmwave_sdk_<version_number>\docs中找到。
存储在L3中的ADC数据可以通过CCS中的Memory Browser查看以及保存。为了访问Memory Browser,打开view选项然后选择Memory Browser选项,在图一中展示。
In the Memory Browser window, the contents of the L3 memory can be viewed by specifying the start address of the L3 memory. The start address is specified by CAPTURE_L3RAM_DATA_MEM_ADDRESS in the capture.h file and varies based on SDK version. The total size of memory reserved to store ADC data is specified by CAPTURE_L3RAM_DATA_MEM_SIZE in capture.h. Additionally, the L3 address and size are output in the last line of the CCS console before sending the configuration file to the device.
To save the raw ADC data click the Save Memory button at the top right corner of the Memory Browser
window as shown in Figure 2.
In the Save Memory menu, specify the file path and file name and select TI Data as the file type as shown in Figure 3.
Click Next and specify the format, start address and length. For the format, select 16-Bit Hex – TI Style. The length of the data is based on the users chirp configuration. To calculate the length in words, the following formulas can be used. First, find the total size of ADC data generated in bytes.
$$
Total\ Size\ in\ Bytes = Num\ ADC\ Samples \times Num\ Rx\ Channels\times Num\ Frames\times Num\ Chirps\times Num\ Bytes\ Per\ Sample \tag1
$$
The number of bytes per sample is based the output format specified by the adcCfg parameter in the sensor configuration. For a complex output format, there are 4 bytes per sample: 2 bytes for the real part and 2 bytes for the imaginary part. For a real output format, there are 2 bytes per sample. Once the total size 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 \tag2
$$
Once the data is saved, it can be viewed in MATLAB using the capture_demo.m file located at C:\mmwave_sdk_<version_number>\packages\ti\demo\xwr14xx\capture\gui for the xWR1xx, and located at C:\ti\mmwave_sdk_01_00_00_05\packages\ti\demo\xwr16xx\capture\gui for the xWR16xx. This file plots the raw ADC data and the 1D FFT of the ADC data. This code can be modified to complete additional post processing on the data. To do further post processing, you must understand how the output data is formatted, as shown in Section 4.
4. Raw Data Format of Capture Demo Using CCS
Data captured using the Capture Demo can be stored in interleaved or non-interleaved mode, as specified by the adcbufCfg command in the sensor configuration. For xWR14xx devices, interleaved mode is recommended but non-interleaved mode can also be used. For xWR16xx/IWR6843 devices only non- interleaved mode can be used. By default the xWR14xx is configured for interleaved mode and the xWR16xx/IWR6843 is configured for non-interleaved mode. For more information about interleaving, see the AWR1xxx Data Path Programmer’s Guide 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 RX antennas.
Figure 4 represents how the data is saved when using 16-bit Hex – TI Style when the file is saved as a TI data format file. In Figure 4, RX0 I(0) represents the first sample of real data received at RX0, and RX0 Q(0) represents the first sample of imaginary data received at RX0. RX0 I(1) represents the second sample 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 mode with real data for 4 RX, 3 RX, and 2 RX antennas.
Data can also be stored in a non-interleaved format. For the xWR16xx/IWR6843, data can only be stored in non-interleaved format. However, for the xWR14xx, interleaved mode is recommended. Figure 6 shows the output format of the data for non-interleaved complex data.
In non-interleaved format, all of the data for a given RX is stored in a single block of memory followed by all of the data for the next RX in another block of memory. For example, all of the RX0 data is stored sequentially, 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\times Num\ Frames\times Num\ Chirps\times Num\ Bytes\ Per\ Sample\tag3
$$
For complex data, there are four bytes per sample. For real data, there are two bytes per sample. For non-interleaved data, the number of words per RX can be determined using Equation 4.
$$
Words\ per\ RX=Bytes\ per\ RX/2\ bytes\ per\ word\tag4
$$
Figure 7 shows the output format of the data for non-interleaved real data.
Similar to the non-interleaved mode with complex data, in non-interleaved mode with real data, all of the data for a given RX is stored in a single block of memory followed by all of the data for the next RX in the next block of memory. For example, if there are 1024 words per RX channel, all 1024 words for RX0 will be stored first, followed by all 1024 words for RX1, and so on.
5.xWR12xx and xWR14xx With DCA1000 Data Format
除了Capture Demo,ADC数据也可以使用Mmwave Studio保存。本小节讨论了使用Mmwave Studio以及为xWR12xx和xWR14xx设计的DCA1000 EVM保存下来的数据的格式。
对于xWER12xx以及xWR14xx社别,数据通过4个LVDS通道采集并以交错格式存储在二进制文件中。DCA1000采集到的数据样本有两个字节长,采用二进制补码的形式。每个LVDS通道都与一个提供的receiver相关联。对于实部数据,每一个LVDS中的一个实部样本会被保存(one real sample from each LVDS lane will be stored)。如果一共有M个chirps,数据将会从第一个chirp开始保存,直到第M个chirp结束。图8显示了当启用四个接收器时,如何将数据存储在二进制文件中,以获取 M 个chirp和每个chirp的N 个 ADC 样本的真实数据。
任何未使用的LVDS通道都将填充为0.开启的接收天线的数量应当与开启的LVDS通道的数量相匹配。接收天线在LVDS通道的分配从最低编号接收天线开始,并在最高编号天线结束。例如,如果天线1和3被开启,并且LVDS2和3被开启,那么LVDS通道2将包含天线1的数据,LVDS通道3将包含来自接收天线3的数据。通道1和4将会使用零填充。图9展示了存储复数数据的二进制文件的数据存储格式。
对于复数数据格式,每一个样本包含一个实部以及一个虚部,并且每个LVDS通道捕获每个接收天线的复数样本(each sample consists of both a real and an imaginary part and each LVDS lane captures the complex samples per receiver)。如果在Mmwave Studio中“IQ Swap”选项中的“I first”选项被选择,每个接收天线的实部将会被先存储,然后接着存储每个接收天线的虚部部分。任何未使用的LVDS通道都将使用0填充。例如,如果接收天线1和3被开启,LVDS通道1和2被开启,那么LVDS通道1将包含来自接收天线1的数据,LVDS2将会包含来自接收天线3的数据。通道3和4将使用0填充。
6. xWR16xx and IWR6843 With DCA1000 Data Format
本小节讨论使用Mmwave Studio以及DCA1000保存的来自xWR16xx/IWR6843的数据格式。对于xWR16xx/IWR6843设备,数据通过两个LVDS通道捕获,并且用非交错的方式存储在一个二进制文件中。通过DCA1000采集的数据样本有2 bytes长,使用二进制补码格式。因为只有两个LVDS通道被使用,xWR16xx/IWR6843使用3个接收天线捕获的数据并不能获取。只有开启1个,2个和4个天线的能够被使用。
图10展示了如何存储4个接收器的实部数据。每个chirp按照接收天线的顺序存储,从最低编号的天线开始,到最高序号的天线结束。通道1发送来自每个接收天线的奇数样本,通道2发送来自每个接收天线的来自每个天线的偶数样本。如果总共有M个chirps,数据会从第一个chirp开始存储,到第M个chirp结束。对于任何被关闭的接收天线,图10中与被关闭天线相关的部分可以被去掉。
对于复数数据,通道1包含样本的实部数据,通道2包含样本的虚部数据。如图11,当4个接收天线被开启,文件以接收天线的顺序存储,从最低编号的天线开始到最高编号的天线结束。被保存的文件有非交错的格式,从每两个样本的实部数据开始,紧跟着每两个样本的虚部数据。如果一共有M个chirps,数据从第一个chirp 开始保存到第M个chirp结束。对于每一个被关闭的接收器,可以从图中删除对应于禁用接收器的部分,以确定总数据输出。
7. xWR12xx and xWR14xx With TSW1400 Data Format
ADC data can also be saved using Mmwave Studio and the TSW1400 EVM with HSDCPro. This section discusses the data format of data saved using Mmwave Studio for xWR12xx and xWR14xx.
For xWR12xx and xWR14xx devices, data is captured over four LVDS lanes and is stored in a binary file. The TSW1400 captured data samples are two bytes long and in the ‘offset binary format’. This means that 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 will capture the real and imaginary part per receiver. Figure 12 shows how data is stored in the binary file for real data for M number of chirps and N number of ADC samples per chirp.
Eeach LVDS lane corresponds to a given receiver. If all four receivers are enabled, data will be stored as seen in Figure 12. Any unused LVDS lanes will be populated with zeros. For example, if receivers 1 and 3 are enabled then LVDS lane 1 will contain the data from receiver 1 and LVDS lane 2 will contain the data from receiver 3. Lanes 3 and 4 will be populated with zeros. Figure 13 shows the data storage format of the binary file for complex data.
The complex data format differs from the real data format in that each LVDS lane now only captures one sample per receiver. Each sample consists of both a real and an imaginary part. Similarly to the real data format, any unused LVDS lanes will be populated with zeros. For example, if receivers 1 and 3 are enabled then LVDS lane 1 will contain the data from receiver 1 and LVDS lane 2 will contain the data from receiver 3. Lanes 3 and 4 will be populated with zeros.
8.xWR16xx and IWR6843 With TSW1400 Data Format
This section discusses the data format of data saved using TSW1400 with xWR16xx/IWR6843. For xWR16xx/IWR6843 devices, data is captured over two LVDS lanes and is stored in a binary file. Data samples captured by TSW1400 via HSDCPro are 2 bytes long and in the ‘offset binary format’. This means that 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. Because only two LVDS lanes are used, data capture using 3 receivers is not available with the xWR16xx/IWR6843. Only 1, 2, and 4 enabled receivers can be used. Figure 14 shows how real data is captured for one receiver.
When only one receiver is enabled only the first LVDS lane is used. Data sent from the second LVDS lane is populated with zeros. If there are N number of ADC samples and M number of chirps, the data is stored beginning with samples 1 through N of the first chirp through to samples 1 through N of the Mth chirp. If multiple receivers are enabled the data is stored in a different format, shown in Figure 15.
When multiple receivers are enabled both LVDS lanes are used, with lane 1 sending the odd samples from each receiver and lane 2 sending the even samples from each receiver. If there is a total of M number of chirps, the data is stored beginning with first chirp and ending with the Mth chirp. Each chirp is stored in the order of the receiver, beginning with the lowest number receiver and ending with the highest number receiver. For complex data, each LVDS lane sends a real part and an imaginary part. The format for complex data is shown in Figure 16.
When multiple receivers are enabled, the complex data is stored in a non-interleaved format beginning with the real part followed by the imaginary part as shown in Figure 16. For each chirp, data is saved in the order of receiver, beginning with the lowest number receiver and ending with the highest number receiver. If there is a total of M number of chirps, the data is stored beginning with first chirp and ending with the Mth chirp. For any receivers that are disabled, the section corresponding to the disabled receivers can be removed from the diagram in Figure 16 to determine the total data output.
9.Interpreting Binary File in MATLAB
使用Mmwave Studio采集的数据可以通过Mmwave Studio GUI进行处理。然而,任何自制的后处理方式需要使用者创建自制脚本。本小节包含MATLAB代码片段帮助使用者翻译使用xWR14xx and xWR16xx捕获的二进制文件,来进行自定义的后处理。
使用Mmwave保存的数据文件位于安装路径下的PostProc文件夹,默认是adc_data.bin。对于TSW1400,数据直接保存为adc_data.bin。对于DCA1000,在点击了“DCA1000 AEM”以及“Trigger Frame”之后,原始名称为“adc_data_RAW_0.bin”的数据文件首先被保存。由于Ethernet协议,通过DCA000 EVM接收的文件可能不会包含正确顺序的UDP数据包。可能存在数据确实的场景并且在文件中没有被捕获。需要运行packet reorder以及zero fill utility来扫描采集到的原始文件并以正确的顺序重新排列数据包,以防任何丢失的数据包;它将文件中填充相同数量的0。此utility还删除元数据,输出现在包含由 xWRxxxx 设备传输的原始 ADC 数据。通过点击“PostProc”按钮,adc_data_RAW_0.bin将通过packet reorder和zero fill,并最终被保存为adc_data.bin。通过运行Packet_Reorder_Zerofill.exe也可以获得相同的结果,正如Mmwave Studio User’s Guide中指示的。接下来的所有matlab脚本都是为了解码adc_data.bin数据文件——通过xWRxxxx设备传送的原始ADC数据。
¶9.1 DCA1000 With xWR12xx and xWR14xx MATLAB Example
接下来的MATLAB代码中的函数能够读取使用Mmwave Studio和xWR14xx通过DCA1000保存的文件。
1 | %%% This script is used to read the binary file produced by the DCA1000 |
之前代码片段中的函数将返回一个将左右接收天线数据保存在行中的矩阵。numADCBits和isReal的值应当根据使用的传感器配置修改。numLanes的值不能修改,因为始终都会有4个LVDS通道使用。未使用的LVDS通道会使用0填充。
使用以上函数返回的矩阵应看起来和图17相似。
第一行包含来自第一个接收天线的所有信息,第二行来自第二个接收天线,第三行来自第三个接收天线,第四行来自第四个接收天线。对于特定接收天线被关闭的情况,相关的行将被填充为0。每一行的列数都和每个chirp的ADC采样数乘以总chirp数相等。这些列由chirp组织(The columns are organized by chirps)。例如,如果有256ADC样本和1280个chirps(128 chirps/frame x 10 frames),每一行会包括327680列。最开始的256列与第一个chirp相关,紧接着的256列和第二个chirp相关,以此类推。开始的32768列与第一帧的chirps有关,以此类推。这些数据然后可以如使用者的意图进行处理。
9.2 DCA1000 With x16xx and IWR6843 MATLAB Example
在接下来的MATLAB代码例子里的函数可以被用来读取保存使用DCA1000和Mmwave Studio保存的xWR16xx的文件。IWR6843的数据格式与xWR16xx相同。
1 | %%% This script is used to read the binary file produced by the DCA1000 |
前面代码片段中的函数将返回一个将所有接收天线存在行中的矩阵。numADCBits和isReal的值应当根据传感器使用的配置进行修改。numLanes的值不应当被修改,因为总是会有两个LVDS通道被使用。
函数返回的矩阵应当看起来像图18.
第一行包含来自第一个接收天线的所有数据,第二行来自第二个接收天线,第三行来自第三个接收天线,第四行来自第四个接收天线。对于特定天线被关闭的情况,相应的行将被去除。每一行的列数=每个chirp的ADC样本数乘以总的chirp个数。列由chirps组织(The columns are organized by chirps)。例如,如果有256个ADC样本数以及总共16个chirps(8 chirps/frame x 2 frames),每一行将包含4096列。最开始的256列与第一个chirp相关,接下来的256列与第二个chirp相关,以此类推。最开始的2048列与第一帧的chirps相关,以此类推。这些数据然后可以根据用户的意图进行处理。
¶9.3 TSW1400 With xWR12xx and xWR14xx MATLAB Example
The function in the following MATLAB code example can be used to read files saved with the xWR14xx and TSW1400.
1 | %%% This script is used to read the binary file produced by the TSW1400 |
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. The value for numLanes should not be modified as there will always be four LVDS lanes used. Unused lanes will be populated with zeros.
The returned matrix of the function should look similar to Figure 19.
In Figure 19, row 1 contains all of the data from the first receiver, row 2 from the second receiver, row 3 from 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 to the number of 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 so on. The data can then be processed as the user desires.
¶9.4 TSW1400 With xWR16xx MATLAB Example
The function in the following MATLAB code example can be used to read files saved with the xWR16xx and TSW1400.
1 | %%% This script is used to read the binary file produced by the TSW1400 |
The function in the above code snippet will return a matrix with all of the receiver data stored in rows. The values for numADCSamples, numADCBits, numRX and isReal should be modified based on the sensor configuration used. The value for numLanes should not be modified as there will always be two LVDS lanes used. Unused lanes will be populated with zeros.
The returned matrix of the function should look similar to Figure 20.
In Figure 20, row 1 contains all of the data from the first receiver, row 2 from the second receiver, row 3 from 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 number of 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 8 chirps, each row will contain 2048 columns. 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.
10 Summary
这篇文档概述了如何转换Capture Demo或者Mmwave Studio采集的原始ADC数据。对于Capture Demo的捕获的数据,使用mmWave SDK提供的capture_demo.m文件能够被使用和修改来处理数据。对于使用Mmwave Studio采集的数据,提供的MATLAB代码片段能够被用来读取二进制文件,并按照接收器把数据组织为行。然后你也可以添加代码俺需要处理数据。
11 References
- DCA1000EVM Data Capture Card User’s Guide
- TSW140x High Speed Data Capture/Pattern Generator Card
- High Speed Data Converter Pro GUI User’s Guide
- AWR1xxx Data Path Programmer’s Guide
- Industrial Radar Family Technical Reference Manual
- mmWave Sensor Raw Data Capture Using the TSW1400 Board
- mmWave Device Firmware Package
- mmWave Software Development Kit
- mmWave Studio



















