#radar #bgt60tr13c #bgt60utr11aip #fmcw #60ghz

no-std bgt60trxx

An async and no_std library for the XENSIV™ BGT60TRxx 60 GHz FMCW radar sensors from Infineon

2 unstable releases

Uses new Rust 2024

new 0.2.0 Apr 14, 2025
0.1.0 Apr 6, 2025

#253 in Embedded development

Download history 60/week @ 2025-03-31 55/week @ 2025-04-07

115 downloads per month

MIT license

39KB
774 lines

bgt60trxx

Crate API

An async and no_std rust library to interface via SPI with the XENSIV™ BGT60TRxx 60 GHz FMCW radar sensors from Infineon.

Supported Sensors

  • BGT60TR13C
  • BGT60UTR11AIP

What works

  • Reading and writing registers
  • Resetting hardware, software, FIFO and fsm
  • Parsing GSR0 register and returning matching errors
  • Configuring the radar
  • Burst reading FIFO
  • Test mode and test word generation
  • Converting the raw FIFO buffer into a correctly-shaped ndarray (requires alloc feature)

Features

  • alloc: enables get_frames method which returns FIFO data in a dynamically allocated 3D ndarray in the shape of [rx_antenna, chirp, adc_sample]
  • debug: prints some debugging information via log

Basic Usage

use bgt60trxx::{Radar, Variant, config::Config as RadarConfig};

// let sclk = ...
// let miso = ...
// let mosi = ...
// let cs = ...
// let rst = ...
// let irq = ...

// let spi_bus = ...
// let spi_device = ... (see embedded-hal-bus, e.g. ExclusiveDevice)
// let delay = ...

// if you want to use ndarray, alloc is required
// also make sure to enable the alloc feature of bgt60trxx-rs
extern crate alloc;

let mut radar = Radar::new(Variant::BGT60TR13C, spi_device, rst, irq, delay).await.unwrap();
info!("Radar initialized!");

let config = RadarConfig::default();
info!("Configuring radar with: {}", config);

radar.configure(config).await.unwrap();
info!("Radar configured!");

radar.start().await.unwrap();
info!("Radar frame generation started!");

loop {
    let frames = radar.get_frames(&mut buffer, &mut output).await.unwrap();
    // TODO: Post-processing of ADC data (adc -> hanning window -> range fft -> doppler fft -> ...) 
}

Generating a new config

To generate a new config, use the below JSON template (taken from https://github.com/Infineon/sensor-xensiv-bgt60trxx), adjust it accordingly, and run it through bgt60-configurator-cli: ./bgt60-configurator-cli -c settings.json -o settings.h

{
    "device_config": {
        "fmcw_single_shape": {
            "rx_antennas": [3], 
            "tx_antennas": [1], 
            "tx_power_level": 31, 
            "if_gain_dB": 60, 
            "lower_frequency_Hz": 61020098000, 
            "upper_frequency_Hz": 61479902000, 
            "num_chirps_per_frame": 32, 
            "num_samples_per_chirp": 128, 
            "chirp_repetition_time_s": 7e-05, 
            "frame_repetition_time_s": 5e-3, 
            "sample_rate_Hz": 2330000
        }
    }
}

This will generate a C header file with defines and a list of registers, which you can use to construct a config struct, see Config::high_framerate_preset().

Note: The bgt60-configurator-cli has a bug where XENSIV_BGT60TRXX_CONF_NUM_RX_ANTENNAS is fixed to 1, even when the JSON config says 3. Make sure to keep rx_antennas as 3 if that is the case.

Modules

BGT60TR13C

There are a couple of ready-made modules with the BGT60TR13C that include all required supporting components:

  • KITCSKBGT60TR13CTOBO1 (from which you only need the radar wing)
  • SHIELDBGT60TR13CTOBO1
  • DEMOBGT60TR13CTOBO1 (which includes SHIELDBGT60TR13CTOBO1)
  • CY8CKIT-062S2-AI with CY8CKIT-062S2-AI-PASSTHROUGH firmware (highly experimental)

BGT60UTR11AIP

  • todo

Dependencies

~0.3–1.2MB
~25K SLoC