esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
Loading...
Searching...
No Matches
esp_sdr_trig.h File Reference

ESP-SDR triggered snapshots (ESP32-C6): the full 80 MS/s, kept from before a burst. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  esp_sdr_trig_cfg
struct  esp_sdr_trig_snap

Macros

#define ESP_SDR_TRIG_RING   16384U
#define ESP_SDR_TRIG_RATE_HZ   80000000U
#define ESP_SDR_TRIG_WINDOW_US   10U
#define ESP_SDR_TRIG_WINDOWS   3U

Functions

int esp_sdr_trig_wait (const struct esp_sdr_trig_cfg *cfg, struct esp_sdr_trig_snap *snap)
 Run the ring until a burst, then freeze it.
void esp_sdr_trig_reset (void)
 Forget the baseline (after a change of frequency or gain).
void esp_sdr_trig_pack_iq8 (const struct esp_sdr_trig_snap *snap, uint32_t from, uint32_t n, int8_t *out)
 Pack n samples of a snapshot, from the from-th oldest, to int8 I, Q pairs (the top 8 of each 10-bit value) at out, 2-byte aligned.

Detailed Description

ESP-SDR triggered snapshots (ESP32-C6): the full 80 MS/s, kept from before a burst.

The dump engine writes the receive I/Q into SRAM block 2 as a ring of ESP_SDR_TRIG_RING samples (205 us at 80 MS/s), while the CPU watches the power the IQ estimator sums over the same 80 MHz input (sums of I^2, Q^2, I and Q, in hardware) in windows of ESP_SDR_TRIG_WINDOW_US, about each window's mean: the receiver's DC, larger than its noise and drifting after a retune, does not count. When ESP_SDR_TRIG_WINDOWS windows in a row rise past the threshold the engine keeps writing for the requested number of samples from the first of them, then stops: the ring holds the burst's start and what came before it.

The CPUs cannot reach block 2 while the engine owns it, so the ring is read only once it has stopped, and the engine writes only its lower half: the upper 64 KiB is the caller's scratch until the next esp_sdr_trig_wait(), for packing and sending the snapshot from.