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

Counters, measurements and traces of the esp_sdr_154 device (ieee154_esp_sdr.h). More...

Data Structures

struct  ieee154_esp_sdr_stats
struct  ieee154_esp_sdr_measurement
struct  ieee154_esp_sdr_bench

Typedefs

typedef void(* ieee154_esp_sdr_rx_cb_t) (struct net_pkt *pkt)
typedef void(* ieee154_esp_sdr_dump_cb_t) (const int16_t *iq, size_t n, void *user)

Enumerations

enum  ieee154_esp_sdr_event

Functions

void ieee154_esp_sdr_set_rx_cb (ieee154_esp_sdr_rx_cb_t cb)
void ieee154_esp_sdr_set_invert (bool rx_inv, bool tx_inv)
int ieee154_esp_sdr_set_lo_above (bool above)
int ieee154_esp_sdr_measure (struct ieee154_esp_sdr_measurement *m)
int ieee154_esp_sdr_set_rx_gain (int index)
int ieee154_esp_sdr_dump (ieee154_esp_sdr_dump_cb_t out, void *user)
size_t ieee154_esp_sdr_get_trail (uint32_t *out, size_t max)
size_t ieee154_esp_sdr_get_stall (uint32_t *pc, uint32_t *ls, size_t max)
void ieee154_esp_sdr_get_stats (struct ieee154_esp_sdr_stats *stats)
int ieee154_esp_sdr_bench (struct ieee154_esp_sdr_bench *b)
 Time the ACK waveform build and the front end switches (radio taken meanwhile).
int ieee154_esp_sdr_set_ack_timing (uint32_t delay_us, uint32_t limit_us)
 ACK timing (CONFIG_ESP_SDR_IEEE802154_AUTO_ACK): first sample delay_us after the frame's end (192 us by the standard), none after limit_us.
int ieee154_esp_sdr_ack_test (uint8_t seq)
 Diagnostic: send one ACK with sequence number seq now (receive running).
void ieee154_esp_sdr_clear_stats (void)
 Zero the driver's counters.
int ieee154_esp_sdr_set_ring_unit (uint32_t pairs)
 Set the ring's unit length (ring receive), for latency measurements.
void * ieee154_esp_sdr_high_ram (size_t size)

Detailed Description

Counters, measurements and traces of the esp_sdr_154 device (ieee154_esp_sdr.h).

Typedef Documentation

◆ ieee154_esp_sdr_dump_cb_t

typedef void(* ieee154_esp_sdr_dump_cb_t) (const int16_t *iq, size_t n, void *user)

Receives the samples of ieee154_esp_sdr_dump(): n interleaved I/Q pairs.

◆ ieee154_esp_sdr_rx_cb_t

typedef void(* ieee154_esp_sdr_rx_cb_t) (struct net_pkt *pkt)

Frame sink without the 802.15.4 L2 (raw use of the radio API): receives each frame without its FCS, LQI set, and owns the packet. It runs on the PHY thread with the PHY lock held: it must not call back into the driver (transmit, channel, diagnostics).

Enumeration Type Documentation

◆ ieee154_esp_sdr_event

Driver state changes kept across resets (ieee154_esp_sdr_get_trail()).

Function Documentation

◆ ieee154_esp_sdr_dump()

int ieee154_esp_sdr_dump ( ieee154_esp_sdr_dump_cb_t out,
void * user )

Diagnostic: one 1 ms capture at the current channel as the PHY would see it (mixed down and filtered to 4 MS/s, interleaved I/Q, +-8192 full scale), handed to out while the driver still holds the radio.

Return values
0on success.
-ENETDOWNif the radio was never started.
<0an error of the capture (esp_sdr_rx_capture()).

◆ ieee154_esp_sdr_get_stall()

size_t ieee154_esp_sdr_get_stall ( uint32_t * pc,
uint32_t * ls,
size_t max )

Diagnostic: CPU 0 PCs (and last load/store addresses) sampled by the receive ring when the PHY thread made no progress for about a second, kept across resets. Returns the count (0 if no stall was seen, and always 0 without CONFIG_ESP_SDR_IEEE802154_RING).

◆ ieee154_esp_sdr_get_stats()

void ieee154_esp_sdr_get_stats ( struct ieee154_esp_sdr_stats * stats)

Copy the driver counters into stats.

◆ ieee154_esp_sdr_get_trail()

size_t ieee154_esp_sdr_get_trail ( uint32_t * out,
size_t max )

Copy the last driver events, oldest first: event in bits 31:28, CPU in bit 27, argument in bits 26:20, uptime in ms (modulo 2^20) in bits 19:0. Kept in RTC memory across resets. Returns the count.

◆ ieee154_esp_sdr_high_ram()

void * ieee154_esp_sdr_high_ram ( size_t size)

With CONFIG_ESP_SDR_IEEE802154_HIGH_RAM_APP, defined by the application: size bytes of 16-byte aligned internal RAM for the driver this boot, or NULL to leave it off. Called once, at device init.

◆ ieee154_esp_sdr_measure()

int ieee154_esp_sdr_measure ( struct ieee154_esp_sdr_measurement * m)

Diagnostic: one 1 ms capture at the current channel, its carrier offset against an O-QPSK signal filling it (within +-500 kHz) and its power.

Return values
0on success.
-ENETDOWNif the radio was never started.
<0an error of the capture (esp_sdr_rx_capture()).

◆ ieee154_esp_sdr_set_ack_timing()

int ieee154_esp_sdr_set_ack_timing ( uint32_t delay_us,
uint32_t limit_us )

ACK timing (CONFIG_ESP_SDR_IEEE802154_AUTO_ACK): first sample delay_us after the frame's end (192 us by the standard), none after limit_us.

Returns
0, -EINVAL, -ENOTSUP.

◆ ieee154_esp_sdr_set_invert()

void ieee154_esp_sdr_set_invert ( bool rx_inv,
bool tx_inv )

Conjugate received samples and/or the transmitted waveform (spectral inversion), to check another radio's I/Q convention. Both off at boot.

◆ ieee154_esp_sdr_set_lo_above()

int ieee154_esp_sdr_set_lo_above ( bool above)

Diagnostic: put the LO 4 MHz above the channel instead of below. Only the subsampling ring receive handles it (transmit and the ACK capture assume the LO below).

Return values
0on success, also before the radio is started (applied at start).
<0the retune failed (esp_sdr_set_freq()); the LO side is unchanged.

◆ ieee154_esp_sdr_set_ring_unit()

int ieee154_esp_sdr_set_ring_unit ( uint32_t pairs)

Set the ring's unit length (ring receive), for latency measurements.

Parameters
pairs0 for the driver's default (ESP_SDR_RING_UNIT_MIN), else see esp_sdr_ring_cfg::unit_pairs.
Returns
0 or -EINVAL.

◆ ieee154_esp_sdr_set_rx_cb()

void ieee154_esp_sdr_set_rx_cb ( ieee154_esp_sdr_rx_cb_t cb)

Set the frame sink used when CONFIG_NET_L2_IEEE802154 is off (ignored with it on).

◆ ieee154_esp_sdr_set_rx_gain()

int ieee154_esp_sdr_set_rx_gain ( int index)

esp_sdr_rx_set_gain() for the radio: stops the receive ring around the call, which otherwise waits for the radio lock a ring run holds. Calls into esp_sdr that take the radio go through the driver while it runs.