View on GitHub

mmWave Radar Sensor Project Documentation Site

A site full of our findings and documentation for the mmWave Radar Sensor Project with Texas Instruments

MVP Release - Our Findings So Far

Table of Contents

Introduction

This document details the setup, compilation, and testing process for running machine learning models on Texas Instruments’ radar.

Installation Guide

  1. These instructions are for Ubuntu 22.04 LTS either natively or running in WSL2.
  2. Download the MMWAVE-L-SDK for xWRL6432 from https://www.ti.com/tool/MMWAVE-L-SDK. Install it in C:/ti on Windows or ~/ti on Ubuntu.
  3. Download SysConfig from https://www.ti.com/tool/SYSCONFIG. Install it in C:/ti on Windows or ~/ti on Ubuntu.
  4. Download the TI CLANG Compiler Toolchain from https://www.ti.com/tool/TI-CLANG. Install it in C:/ti on Windows or ~/ti on Ubuntu.
  5. Download and install Python 3.10 from https://www.python.org/downloads/. Make sure to add it to your path.
  6. Make sure the Python package manager pip is installed.
  7. Install the packages needed for the flashing tools with pip install pyserial xmodem tqdm.
  8. Install the packages needed for the model training with pip install torch pandas scikit-learn torchmetrics matplotlib torchinfo onnx_tool.
  9. If on Ubuntu, install mono runtime with sudo apt install mono-runtime.
  10. Download Code Composer Studio (CCS) from https://www.ti.com/tool/CCSTUDIO.
  11. Install CCS by running the installer file after unzipping the package.
    • Keep the default installation path.
    • Select the component “mmwave” to install xWRL6432 support.
    • Launch CCS with the default workspace.
    • Go to Window > Preferences > Code Composer Studio > Products and make sure SysConfig is listed.
    • Go to Window > Preferences > Code Composer Studio > Build > Compilers and make sure TI Clang is listed.
  12. Install the TVM compiler from a wheel using pip install ti_tvm-0.16.0-cp310-cp310-linux_x86_64.whll --force-reinstall.
  13. Confirm tvmc is on the path by running tvmc --version.
  14. Download the TI cross-compiler for the cortexM4 using wget https://dr-download.ti.com/software-development/ide-configuration-compiler-ordebugger/MD-ayxs93eZNN/2.1.2.LTS/ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin.
  15. Install the cross-compiler by running chmod +x ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin and then ./ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin.

Getting To Know the Hardware

The board has 4 different modes controlled by the switches on the board:

Hello World Test

  1. Create the target configuration in CCS.
  2. Open a UART terminal and connect to the board.
  3. Build the hello world example from the SDK.
  4. Flash an empty appimage to the board using the visualiser tool.
  5. Launch the target configuration.
  6. Load the hello world binary on to the CPU.
  7. Run the program.
  8. Flash the program onto the board so it can run without CCS.

Training the Model

  1. Decide if you’re going to train on the CPU or the GPU. Texas Instruments recommends the CPU as the overhead of copying the data into graphics memory is not worth the speedup.
  2. Load the data from the provided datasets.
  3. Preprocess the data by normalising it and turning it into tensors.
  4. Split the data into training and testing sets.
  5. Define the model architecture.
  6. Train the model.
  7. Export the model to an ONNX file.

Compiling the Model

  1. Simply, set the options for the TVM compiler commandline tool.
  2. Then, run the command to compile the model.
  3. Confirm devc.o, lib0.c, lib1.c, mod.a, and tvmgen_default.h are generated.

Testing the Model

  1. Set up board and connect via UART.
  2. Copy dataset files (CCS_dry_data.bin, CCS_wet_data.bin) into CSS project.
  3. Modify the CreateFeatureVector function to match the PyTorch flow.
  4. Test on device and compare results with PyTorch metrics.
  5. Check accuracy via UART output.
  6. Benchmark model timing.