esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
Loading...
Searching...
No Matches
Diagnostic-bus ring

Gapless 40 MS/s receive through the modem diagnostic bus and PARLIO, ESP32-C5 (esp_sdr_diag.h, CONFIG_ESP_SDR_DIAG). More...

Data Structures

struct  esp_sdr_diag_cfg
struct  esp_sdr_diag_stats

Macros

#define ESP_SDR_DIAG_PINS   8U
#define ESP_SDR_DIAG_BLOCK   8192U
#define ESP_SDR_DIAG_RING   57344U
#define ESP_SDR_DIAG_LSB_AUTO   0xffU
#define ESP_SDR_DIAG_LSB_MAX   6U
#define ESP_SDR_DIAG_DECIM_MIN   8U

Typedefs

typedef void(* esp_sdr_diag_sink_t) (void *user, const uint8_t *blk, size_t n, uint64_t index)
typedef void(* esp_sdr_diag_iq_sink_t) (void *user, const int32_t *iq, size_t n, uint64_t index)

Functions

int esp_sdr_diag_run (const struct esp_sdr_diag_cfg *cfg, struct esp_sdr_diag_stats *stats)
 Run the ring until the time is up, esp_sdr_diag_stop() or an overrun.
void esp_sdr_diag_stop (void)
 Ask a running esp_sdr_diag_run() to return.
bool esp_sdr_diag_active (void)
int esp_sdr_diag_level (uint8_t *lsb)
 The nibble window start that fits the current signal.
void esp_sdr_diag_armed_hook (void)
 Bench hook: called by esp_sdr_diag_run() once the dump engine runs, before the pads and the ring start. Weak and empty; a bench application can override it to change or record modem registers.

Detailed Description

Gapless 40 MS/s receive through the modem diagnostic bus and PARLIO, ESP32-C5 (esp_sdr_diag.h, CONFIG_ESP_SDR_DIAG).

Macro Definition Documentation

◆ ESP_SDR_DIAG_BLOCK

#define ESP_SDR_DIAG_BLOCK   8192U

Bytes per sink call: the unit of the ring.

◆ ESP_SDR_DIAG_DECIM_MIN

#define ESP_SDR_DIAG_DECIM_MIN   8U

Limits of cfg.decim.

◆ ESP_SDR_DIAG_LSB_AUTO

#define ESP_SDR_DIAG_LSB_AUTO   0xffU

cfg.lsb: pick the nibble window from the signal level at the start.

◆ ESP_SDR_DIAG_LSB_MAX

#define ESP_SDR_DIAG_LSB_MAX   6U

Highest nibble window start: I[9:6].

◆ ESP_SDR_DIAG_PINS

#define ESP_SDR_DIAG_PINS   8U

Data lines (PARLIO RX width on the C5).

◆ ESP_SDR_DIAG_RING

#define ESP_SDR_DIAG_RING   57344U

Ring size in bytes: 7 blocks, 1.43 ms at 40 MB/s.

Typedef Documentation

◆ esp_sdr_diag_iq_sink_t

typedef void(* esp_sdr_diag_iq_sink_t) (void *user, const int32_t *iq, size_t n, uint64_t index)

Receives decimated I/Q, called four times per ring block (every 51 us at 40 MB/s).

Parameters
usercfg.iq_user.
iqn interleaved I, Q pairs, valid only during the call, in raw 10-bit counts times 16 (full scale +-8192), a boxcar of 16 and a third-order CIC of cfg.decim down from 40 MS/s.
nComplex samples in this call (0 to 17).
indexIndex of the first sample since the start; a jump means blocks were skipped.

◆ esp_sdr_diag_sink_t

typedef void(* esp_sdr_diag_sink_t) (void *user, const uint8_t *blk, size_t n, uint64_t index)

Receives one block.

Parameters
usercfg.user.
blkESP_SDR_DIAG_BLOCK bytes, valid only during the call.
nBlock size in bytes.
indexByte index of the block since the start; a jump from the previous index plus size means the consumer fell behind and blocks were skipped.

Function Documentation

◆ esp_sdr_diag_active()

bool esp_sdr_diag_active ( void )
Returns
true while esp_sdr_diag_run() is in progress.

◆ esp_sdr_diag_level()

int esp_sdr_diag_level ( uint8_t * lsb)

The nibble window start that fits the current signal.

One 10-bit snapshot; the lowest start that does not wrap at the 99.9 % point of the I and Q magnitudes.

Parameters
lsbSet to 0 to ESP_SDR_DIAG_LSB_MAX.
Returns
0, or the error of esp_sdr_rx_capture().

◆ esp_sdr_diag_run()

int esp_sdr_diag_run ( const struct esp_sdr_diag_cfg * cfg,
struct esp_sdr_diag_stats * stats )

Run the ring until the time is up, esp_sdr_diag_stop() or an overrun.

Takes the radio, and SRAM bank 1, for the whole run. The receiver keeps its frequency, gain and filter. Needs the bank usage of the capture engine, so it cannot run with esp_sdr_rx_capture() on another thread.

Returns
0, -EINVAL for a bad configuration, -EAGAIN before esp_sdr_init(), -EBUSY when already running, -EOVERFLOW when the interrupt could not keep up with the ring (stats->overrun).