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

ESP-SDR crystal calibration: measured against an LTE cell, kept in flash. More...

#include <errno.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  esp_sdr_cal_point
struct  esp_sdr_cal_record
struct  esp_sdr_lte_scan
struct  esp_sdr_lte_result

Macros

#define ESP_SDR_CAL_TEMP_UNKNOWN   INT16_MIN
#define ESP_SDR_CAL_POINTS   8
#define ESP_SDR_CAL_POINT_MERGE_DC   20
#define ESP_SDR_CAL_EXTRAPOLATE_DC   100
#define ESP_SDR_CAL_QUADRATIC_SPAN_DC   100
#define ESP_SDR_LTE_SCAN_DEFAULT

Functions

static void esp_sdr_cal_add_point (struct esp_sdr_cal_record *rec, int16_t temp_dc, int32_t ppb)
 Add a measurement to a record's points.
static int esp_sdr_cal_eval (const struct esp_sdr_cal_record *rec, int16_t temp_dc, int32_t *ppb)
 The crystal's error at a temperature, from a record's points.
int esp_sdr_set_freq_corr_model (const struct esp_sdr_cal_record *rec)
 Correct tuning with a record's temperature model.
void esp_sdr_get_freq_corr_model (struct esp_sdr_cal_record *rec)
 The calibration in force: the record esp_sdr_set_freq_corr_model() took, or for a constant correction (esp_sdr_set_freq_corr_ppb()) a record without points of that ppb.
int esp_sdr_cal_update (const struct esp_sdr_cal_record *meas, struct esp_sdr_cal_record *out)
 Take a measured crystal error into the correction in force, and store it.
int esp_sdr_lte_calibrate (const struct esp_sdr_lte_scan *scan, struct esp_sdr_lte_result *res)
 Measure the crystal's error against an LTE cell and apply it.

Detailed Description

ESP-SDR crystal calibration: measured against an LTE cell, kept in flash.

esp_sdr_lte_calibrate() measures the crystal's error from a base station's carrier (include/esp_sdr/esp_sdr_lte.h does the signal processing) and applies it with esp_sdr_set_freq_corr_ppb(). With CONFIG_ESP_SDR_CALSTORE the result lives in the storage partition and esp_sdr_init() applies it at every start.