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_lte.h File Reference

LTE downlink synchronization signals as a frequency reference. More...

#include <errno.h>
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <esp_sdr/esp_sdr_dsp.h>

Go to the source code of this file.

Data Structures

struct  esp_sdr_lte_iq
struct  esp_sdr_lte_work
struct  esp_sdr_lte_cell
struct  esp_sdr_lte_cand

Macros

#define ESP_SDR_LTE_DF   15000.0
#define ESP_SDR_LTE_SYNC_PERIOD_S   5e-3
#define ESP_SDR_LTE_SSS_LEAD_S   ((2048.0 + 144.0) / 30.72e6)
#define ESP_SDR_LTE_SC   62
#define ESP_SDR_LTE_L_MAX   272
#define ESP_SDR_LTE_RASTER_HZ   100e3
#define ESP_SDR_LTE_WORK_FLOATS(n_fft)

Functions

static void esp_sdr_lte_work_init (struct esp_sdr_lte_work *w, float *mem, uint32_t n_fft)
 Set up the work memory.
static int esp_sdr_lte_k (int idx)
static void esp_sdr_lte_pss (int n_id2, float *re, float *im)
 The PSS Zadoff-Chu sequence of a sector.
static void esp_sdr_lte_sss (int n_id1, int n_id2, int half, float *d)
 The SSS sequence of a cell group (3GPP TS 36.211, 6.11.2), +-1 per subcarrier.
static int esp_sdr_lte_demod (const struct esp_sdr_lte_iq *x, size_t n, double fs, double start, double f_hz, float *yr, float *yi)
 Demodulate the 62 synchronization subcarriers of one symbol.
static float lte_pss_metric (const float *yr, const float *yi, const float *dr, const float *di)
static int esp_sdr_lte_pss_search (const struct esp_sdr_lte_iq *x, size_t n, double fs, double max_offset_hz, struct esp_sdr_lte_work *w, struct esp_sdr_lte_cand *out, int max_out)
 Search the capture for a PSS.
static int esp_sdr_lte_detect (const struct esp_sdr_lte_iq *x, size_t n, double fs, double max_offset_hz, float min_ratio, struct esp_sdr_lte_work *w, struct esp_sdr_lte_cell *cell)
 Find a cell in a capture and measure its carrier offset.
static double esp_sdr_lte_ppb (double lo_hz, double offset_hz, double *raster_hz)
 Crystal error from a measured carrier.

Detailed Description

LTE downlink synchronization signals as a frequency reference.

A base station's carrier is accurate to a small fraction of a ppm and sits on the 100 kHz channel raster, so where a cell's carrier shows up in a capture tells how far the receiver's crystal is off. This finds the primary synchronization signal (PSS) in a capture of about 2 MS/s, decodes the cell with the secondary one (SSS), measures the carrier offset from the phase between the two symbols, then refines it from how the phase of the cell's reference signals (CRS) turns over the capture (frequency division duplex, normal cyclic prefix).

Header only, plain C and libm without Zephyr, like esp_sdr_dsp.h, so that the library, host tools and the native_sim tests share it. The caller supplies the work memory.