Samples in and out¶
Previous: Crystal calibration · Up: esp-sdr-zephyr · Next: Burst capture
Part 2 takes the samples from the ADC and the DAC of The radio to the host and back. It covers the sample words, the hardware that moves them, the memory that hardware takes and the paths each chip offers. Modulation and coding starts from the complex baseband samples this part delivers.
The digital chain¶
The flowchart follows apps/stream: receive from the ADC to a host sample, transmit from a host
sample to the DAC. Its labels name that app’s path (vrt_rx.c, transport_udp.c, USB CDC-NCM);
the packet types and sample formats are in stream. The analog
blocks before the ADC and after the DAC are in Transceiver.
flowchart LR
subgraph RX["RX: radio to host sample"]
direction TB
R1["`**Analog receive path**
The radio, Part 1`"]
R2["`**ADC**
10-bit I/Q`"]
R3["`**Capture engine**
HW fills a DRAM bank`"]
R4["`**esp_sdr_rx**
raw / CIC decimate / fold`"]
R5["`**iq_pack**
8/12/16-bit packing`"]
R6["`**vrt_rx.c**
VITA 49.2 packet`"]
R7["`**transport_udp.c**
UDP/IPv6 send`"]
R8["`**USB CDC-NCM**
cdc_ncm_eth0 + UDC dwc2`"]
R9["`**Host NIC**
esdr0`"]
R10["`**esp_sdr_lab.py / vrt_rx.py**
decode to IQ samples`"]
R1 --> R2 --> R3 --> R4 --> R5 --> R6 --> R7 --> R8 --> R9 --> R10
end
subgraph TX["TX: host sample to radio"]
direction TB
T1["`**esp_sdr_lab.py txstream / vrt_tx.py**
encode VITA packets`"]
T2["`**Host NIC**
esdr0`"]
T3["`**USB CDC-NCM**
UDC dwc2 + cdc_ncm_eth0`"]
T4["`**vrt_tx.c**
UDP recv, decode, timestamp`"]
T5["`**PSRAM ring buffer**
sample queue`"]
T6["`**Bank fill**
leader filler, PIE/C interp
into the idle bank`"]
T7["`**2 DAC banks**
loop mode, bank flip`"]
T8["`**DAC**
10-bit I/Q`"]
T9["`**Analog transmit path**
The radio, Part 1`"]
T1 --> T2 --> T3 --> T4 --> T5 --> T6 --> T7 --> T8 --> T9
end
Receive chain¶
The capture engine writes raw I/Q words straight into the selected DRAM bank, and the CPU touches
no sample until the burst is complete (Burst capture). esp_sdr_rx then reads the
words raw, CIC-decimated or folded, and iq_pack packs them into 8, 12 or 16-bit items.
vrt_rx.c puts the items into VITA 49.2 packets, and transport_udp.c sends them over UDP/IPv6
through USB CDC-NCM (cdc_ncm_eth0 on the dwc2 device controller). On the host they arrive at the
network interface esdr0, where esp_sdr_lab.py or vrt_rx.py decode them to I/Q samples.
Host transports describes the link.
Transmit chain¶
On the host, esp_sdr_lab.py txstream or vrt_tx.py encode VITA packets and send them through
esdr0 and USB CDC-NCM. vrt_tx.c receives them over UDP, decodes them, places them by their
timestamps and queues the samples in a ring buffer in PSRAM.
The bank fill (the leader’s filler, interpolating with PIE or in C) writes the idle one of two DAC banks, and the DAC plays the banks in loop mode, flipping between them. The mechanism is in Gapless streaming.
Sample word formats¶
The capture engine writes, and the DAC engine plays, 32-bit words with two 10-bit fields:
Word |
Bits 9:0 |
Bits 19:10 |
Bits 31:20 |
ESP32-S3 evidence |
ESP32-C6 evidence |
|---|---|---|---|---|---|
Receive, in the dump bank |
Q (assumed on the C6) |
I (assumed on the C6) |
S3: unused here; upstream reads 27:20 as gain metadata (unverified). C6: not stated |
measured |
the same helpers as on the S3 ( |
Transmit, played by the DAC (engine) |
I |
Q |
0 |
measured |
measured bench 2026-10-11 (tone side and image) |
Each field is 10-bit two’s complement, -512 to 511.
Packed form: IQ8 is bits 19:12 then 9:2 (I then Q;
include/esp_sdr/esp_sdr_rx.h:231-238).
Receive orientation¶
The orientation was found on the S3 by detuning only the receive LO against a known carrier: with I taken from the low field, a tone below the LO showed up above it.
Upstream’s code comments call the low field I (
modules/lib/esp-sdr/main/targets/esp32s3/s3_unpack.S:7, carried intolib/esp_sdr/src/esp_sdr_ring_fir.S:12).Upstream’s docs say the raw ring comes out spectrally inverted, so hosts conjugate (
modules/lib/esp-sdr/docs/iq-stream.md:32-35): the same finding from the other side.The ring keeps upstream’s kernels, filters
j conj(z)and swaps the outputs (lib/esp_sdr/src/esp_sdr_ring.c:214-216).
Hardware that moves samples¶
Four pieces of hardware move samples between the radio and memory or the CPU. Each gets one paragraph here; the pages of this part have the details.
Dump engine¶
The capture and the DAC playback use the Wi-Fi MAC’s undocumented dump engine (layout from
upstream esp-sdr, see lib/esp_sdr/src/esp_sdr_priv.h). In one-shot mode it fills a bank with a
burst and stops (Burst capture). In circular mode it writes a ring without a stop
while the CPU follows its write index (Gapless receive).
On the DAC side it plays words out of memory once, in a loop, or (C5 and S31) a number of times (Transmit). The register fields are on ESP32-S3 registers and ESP32-C6 registers.
IQ estimator¶
The modem’s IQ estimator sums the 80 MHz baseband samples in hardware, and the CPU reads the running sums and takes their differences. Three paths use it:
paced receive, for its samples (Paced streams);
the C6 trigger, for its power windows (Triggered snapshots);
the C6 gapless ring, to choose what it keeps (Gapless receive).
TX DC value register¶
The TX DC value register drives the DAC once the vendor tone path has turned the transmit chain on. The CPU writes it at each sample instant (Paced streams). Its word is the transmit layout above (I in bits 9:0, Q in 19:10), which the S31’s replay engine also plays (Transmit).
Modem diagnostic bus¶
The modem’s diagnostic bus (MODEM_DIAG) carries the I and Q fields of the dump word. Looped
through pads into the PARLIO receiver and collected by a GDMA ring, it gives a gapless stream: 4+4
bits at 40 MS/s on the C5, 8+8 bits on the S31 (Gapless receive).
SRAM bank ownership¶
The engine writes or reads one SRAM bank (64 KiB on the S3), selected one-hot in
MAC_DUMP_USAGE.While it does, the CPUs cannot reach any of that bank, so nothing else may live there.
Linker snippets reserve the banks. A link error “DRAM image overlaps the … bank(s)” means the image grew into one.
ESP32-S3¶
The engine’s 64 KiB banks and the ESP_SDR_HIGH_RAM region sit at the top of internal DRAM, laid
out by the linker snippets lib/esp_sdr/esp_sdr_bank*.ld (picked in
lib/esp_sdr/CMakeLists.txt).
Bank |
Address |
Use |
Reserved by |
|---|---|---|---|
0 |
0x3fcb0000 |
the ring (banks 0 to 2) |
|
1 |
0x3fcc0000 |
second DAC and capture bank; the ring |
|
2 |
0x3fcd0000 |
always the capture bank; the ring |
always |
|
the capture bank’s end up to |
buffers placed there |
|
Each snippet lowers
_heap_sentryto its lowest bank, so the libc heap stays below it.Each snippet fails the link if the DRAM image grows into a bank.
The bank-by-bit table is on ESP32-S3 registers; the limits of the rest of internal RAM are in Code placement.
ESP32-C6¶
The C6 engine takes a whole 128 KiB block.
The gapless rotation needs two (blocks 1 and 2), and an image with the Wi-Fi driver fills blocks 0 and 1. So the gapless ring needs the radio without the Wi-Fi driver (below), whose image fits block 0.
The ownership register
HP_SYSTEM_SRAM_USAGEis on ESP32-C6 registers.
ESP32-C5¶
SRAM_USAGE(0x60095004bits 11:8) = 2 withMAC_DUMP_ALLOC(bit 16) puts the samples at 0x40830000, 64 KiB into block 1.The CPU loses all of block 1, 128 KiB (0x40820000 to 0x4083ffff): reads return the last word it read there, writes are dropped, nothing faults.
Blocks 0 and 2 stay with the CPU. Block 2 holds the ROM’s data, so block 1 is the only capture bank.
The replay engine owns all of block 1 while it plays: no diagnostic-bus ring meanwhile.
How the image is split around the bank is in Code placement.
ESP32-S31¶
The S31’s engine works in the TCM’s 128 KiB groups. Group 2 is the one at 0x2F040000
(lib/esp_sdr/Kconfig, ESP_SDR_S31_GROUP2); group 3, the upper group, holds the ROM’s data
and the capture bank.
Path |
Group it takes |
When |
What it means for the CPU |
|---|---|---|---|
Bursts (Burst capture) |
the whole upper group, ROM data at the top included |
while the engine writes |
interrupts off, code and stack below the group, no ROM or PHY calls |
Dump-engine ring (Gapless receive) |
group 2 for its units; group 3 only while it copies a unit out of group 2 |
group 2 for the whole run but for the turns; group 3 during a turn, up to 21 us |
in group 2 CPU reads give the engine’s words and CPU writes are lost; the other core waits in its stall interrupt during a turn |
Replay (Transmit) |
the group at 0x2F040000 ( |
while it plays |
the image must end below 0x2F040000 ( |
diag16 ring (Gapless receive) |
shares the replay’s group |
while it runs |
as for replay |
Ring stage of the Pcap engine (Gapless receive) |
the capture bank (group 3), past the dump ring’s words |
during a dump-ring run |
written from IRAM |
The upper group with the ROM data stays the CPU’s for replay: the engine never plays it.
A capture or the ring would write the ownership register, hence the -EBUSY while replay plays.
Radio without the Wi-Fi driver¶
CONFIG_ESP_SDR_PHY_ONLY brings the PHY up without the Wi-Fi driver. The C6 needs it for the
gapless ring, the S3 gains RAM from it, and the S31 always runs this way.
ESP32-S3¶
The option brings the PHY up as on the C6 below, with the S3’s Wi-Fi clock enable for the modem
clock and CONFIG_ESP_PHY_ENABLE_USB: the USB controller runs from the PLL the PHY calibrates.
Unlike on the C6, the level does not drop. Against the same builds with the driver on an S3 devkit:
Measure |
With the Wi-Fi driver |
Without it |
|---|---|---|
Noise floor on the AGC ( |
about -33 dBFS |
the same within 0.7 dB |
Noise floor at a forced gain |
about -55 dBFS |
the same within 0.7 dB |
|
no overflows |
no overflows; filter cycles and 1.25 M samples transmitted the same |
|
frames and ACKs both ways |
the same |
DRAM image end below bank 0, before shrinking the heap |
|
|
Signed image |
about 300 KB smaller |
|
Kernel heap peak in |
about 12 KB |
2184 bytes |
apps/multiappandapps/ubertoothselect it on the S3; Ubertooth followed connections with the same stream loss either way.The other standalone S3 apps keep the driver.
ESP32-C6¶
CONFIG_ESP_SDR_PHY_ONLYbrings the PHY up through the HAL (esp_timer_init(), the Wi-Fi power domain and modem clock,esp_phy_enable(),phy_wifi_enable_set()) in about 70 ms.The image fits block 0.
Without the driver nothing sets a receive gain: the level stays some 20 dB low until one is forced.
The driver’s periodic receive glitch is gone.
ESP32-S31¶
Without the Wi-Fi driver’s start, the S31’s receiver enable bit must be set by hand (Transceiver).
Sample paths per chip¶
Each chip offers a different set of paths. The first table names them, the second gives their rates and tuning ranges chip by chip.
Paths, headers and Kconfig¶
Path |
Header |
Kconfig |
Chips |
Page |
|---|---|---|---|---|
Bursts |
|
|
S3, C6, C5, S31, ESP32 |
|
Triggered snapshots |
|
|
C6 |
|
Ring of three banks |
|
|
S3 |
|
Channelized bursts |
|
|
S3 |
|
Gapless 80 MS/s ring |
|
|
C6 |
|
Diagnostic-bus ring, 4+4 bit |
|
|
C5 |
|
Diagnostic-bus ring, 8+8 bit |
|
|
S31 |
|
Dump-engine ring |
|
|
S31 |
|
Playback and loop |
|
|
S3 |
|
Gapless transmit stream |
|
|
S3 |
|
Replay |
|
|
C5, S31 |
|
Carrier |
|
S31 |
||
Paced receive |
|
|
C6, C5 |
|
Paced transmit |
|
|
C6, C5, S31 |
Rates per chip¶
Each cell line reads path: instantaneous / average. The instantaneous rate is the rate at which a path moves samples while it runs; the average rate counts the samples delivered over a whole run, gaps included, per second. Tuning shows where the PLL locks and the LO reaches, not the 100 to 6000 MHz the API accepts.
Instantaneous rates are the rates a path is set to. Averages and run results were measured unless marked (derived), arithmetic on other figures, or (stated), a limit given by the code or a page rather than a run. “nm” means not measured.
Chip |
Tuning range |
Capture, burst |
Capture, continuous |
Replay, burst |
Replay, continuous |
|---|---|---|---|---|---|
ESP32-S3 |
Direct: PLL locks on air 2180 to 2793 MHz; VCO window (no -ERANGE) 2193 to 2781 MHz |
|
|
|
|
ESP32-C6 |
Direct: PLL locks on air 2128 to at least 2856 MHz; VCO window 2140 to 2884 MHz |
|
|
No DAC-engine replay in the library; a transmission that drains ( |
|
ESP32-C5 |
No divider, no PLL lock flag: never -ERANGE |
|
|
|
|
ESP32-S31 |
No divider: 2200 to some 2900 MHz; -ERANGE below 2200 MHz |
|
|
|
|
ESP32 (MCH2022 badge) |
Divider below 2210 MHz in the code; no -ERANGE (PLL status not mapped) |
|
No gapless path. |
None (no transmit) |
None |
ESP32-P4 (WHY2025 badge, transport only) |
No radio; it uses the C6’s |
C6 snapshots pass through at 5.6 a second |
Over high-speed USB: C6 paced 2 MS/s at 4.0 MB/s gapless; C6 gapless 3.9 M pairs/s; the P4 channelizer dropped nothing at 8 MB/s kept; SDIO 11.6 MB/s raw, about 13 MB/s within a transfer |
Forwards to the C6 |
Forwards the C6’s 250 kS/s (stated) |
The S31 also transmits a carrier from the PHY’s tone generator (Carrier).
Rate sources¶
Each number in the table lives on the pages below, with its date and setup; code paths name the header or source file that states a limit.
Chip |
Tuning |
Capture |
Replay |
|---|---|---|---|
ESP32-S3 |
Tuning (VCO window and lock limits, bench 2026-10-09); Crystal calibration (about 1865 MHz); Scan in micropython (2026-11-10); |
Burst capture; Gapless receive; capture; stream; osmosdr; chancap; pcap internals; |
Transmit; stream; osmosdr; IEEE 802.15.4; Testing; |
ESP32-C6 |
Tuning (bench 2026-10-09); Crystal calibration; Scan in micropython; Paced streams |
Burst capture; Paced streams; Gapless receive; Host transports; osmosdr_serial; osmosdr_bridge; Testing; |
Paced streams; Host transports; |
ESP32-C5 |
Burst capture; Gapless receive; Testing; |
Transmit; Paced streams; Host transports; Testing; micropython |
|
ESP32-S31 |
Tuning; Scan in micropython; osmosdr_hs; |
Burst capture; Gapless receive; Impairments (one burst a frame near PSRAM-clock lines); osmosdr_hs; micropython; |
Transmit; Paced streams; Testing; |
ESP32 |
|
MCH2022 badge (burst times, stream rates); osmosdr_serial; micropython; |
|
ESP32-P4 |
Host transports; osmosdr_bridge; pcap internals; micropython |
Derived values¶
S3 Scan: 64 hops of 8192 samples in 0.54 s a sweep give 0.97 MS/s; in 0.65 s with the display, 0.81 MS/s.
S3 decimated bursts: 200 kS/s times 30 % coverage gives 60 kS/s.
S3
esp_sdr_tx_play_for(): a 1.35 us hole is 108 samples at 80 MS/s, so 16380 / 16488 x 80 = 79.5 MS/s; at 40 MS/s it is 54 samples, 39.87 MS/s.C6 snapshots: 52 x 16320 = 0.85 MS/s; ceiling 16320 / (4 ms + 0.205 ms), about 3.9 MS/s; through the bridge 5.6 x 16320 = 91 kS/s.
C6 gapless: the samples kept in a 20 s survey (21.3 M and 37.4 M at 80 MS/s, 42.0 M and 46.1 M at 40 MS/s) divided by 20 s. Reading the figures per survey matches the 2.2 M a second at 40 MS/s the P4 measured; the source does not confirm it.
C5 diagnostic-bus ring: 40 MS/s / 16 (box16) / 8 (CIC) = 312.5 kS/s.
C5 replay restarted from the CPU: 16383 / (16383 + 37) x 80 = 79.8 MS/s.
S31 display stream: 0.42 x 20 = 8.4 MS/s and 0.49 x 20 = 9.8 MS/s.
S31 paced buffer: 26628 pairs / (0.1065 s + 0.036 s) = 187 kS/s.
ESP32: a burst cycle (capture, CIC, packing) takes 3025, 2436, 2138 and 1905 us at 2 MS/s, 1 MS/s, 500 kS/s and 125 kS/s; its outputs, 16380 / m - 3, are 2044, 1020, 508 and 124 samples (
include/esp_sdr/esp_sdr_rx.h). Raw: 16380 / 3.025 ms = 5.41 MS/s.
Conflicting figures¶
C5 transmit at 250 kS/s: “keeps up on the C5” against “starves on the C5 too”, both in Host transports.
S3 low LO edge: 1817 and 1828 MHz (
esp_sdr.h, Tuning), about 1865 MHz (Crystal calibration), 1840 MHz (Scan grid).S3 high LO edge: the S3 locks up to 2793 MHz, yet the C6 measurement had the S3 transmitter reach at least 2856 MHz (Tuning). These may be different boards; the sources do not say.
S31 high edge: “some 2900” MHz stated, 2870 MHz reached by the VIEWE Scan.
Not measured¶
The classic ESP32’s LO range, and the C5’s edges (no sweep, no lock flag). The C5’s 1900 MHz direct step (capture) is not shown to receive.
The average of a pure burst cycle on every chip, of S3
esp_sdr_tx_play()andesp_sdr_tx_sweep(), and of a single S31 replay pass. The restart hole was measured on the C5 only.The C6 snapshot ceiling (3.9 MS/s is derived); the 52 a second were limited by the traffic on air.
Pages in this part¶
The pages run from the engine’s paths (bursts, rings, playback and replay) to the CPU-paced paths and then to the links that carry samples to a host.
Burst capture: one-shot captures, their lengths, rates and modes, and the C6’s triggered snapshots.
Gapless receive: the rings that stream without a gap on each chip.
Transmit: playback, gapless streaming, replay, the carrier and the turnaround.
Paced streams: receive and transmit paced by the CPU through two registers.
Host transports: the links to a host and what each carries.
Previous: Crystal calibration · Up: esp-sdr-zephyr · Next: Burst capture