ESP-SDR on Zephyr¶
Next: The radio
A software defined radio on the Wi-Fi radio of the ESP32-S3, ESP32-C6, ESP32-C5, ESP32-S31 and the classic ESP32, for Zephyr: I/Q capture from the receiver, and I/Q playback through the transmit DAC on all but the classic ESP32, which only receives.
Ported from ESPARGOS esp-sdr and extended. The repository is a west manifest repository and a Zephyr module, laid out like example-application.
Safety¶
Warning
This project is neither intended nor qualified for productive use!
The main purpose of this project is “Spaß am Gerät”.
Operating limits¶
This project views safe operating parameters as suggestions:
Radios may be driven beyond their design specifications.
Generated signals may not be compliant with your local regulations.
Spectrum etiquette¶
Be a good neighbor in the spectrum:
Don’t perform radiative tests.
For development you can connect two devices through coaxial cable with a 30 to 60 dB attenuator.
Tainted devices¶
The firmware may permanently alter the radios’ analog characteristics:
Devices that ran any firmware from this project should be regarded as tainted.
This disqualifies the device from any future use in certified products.
It is recommended to mark any used devices in a visible way.
Getting started¶
west init -m https://github.com/cyber-murmel/esp-sdr-zephyr esp-sdr-ws
cd esp-sdr-ws
west update
west blobs fetch hal_espressif
west blobs fetch esp-sdr-zephyr
west build --pristine --sysbuild --board xiao_esp32s3/esp32s3/procpu esp-sdr-zephyr/apps/multiapp
west flash
west dfu --storage
This puts multiapp on a XIAO ESP32S3. On its USB shell multiapp list shows the apps and
multiapp run <name> starts one, for example multiapp run osmosdr
(multiapp).
Each app also builds on its own. Applications has the steps all apps share and how an app’s configuration splits into SoC and board files. Releases carry the multiapp image and the SoapySDR module for gqrx and GNU Radio.
The library¶
lib/esp_sdr gives raw I/Q access to the radio. This section sums it up; the guides
(Documentation) teach it part by part.
Chips and rates¶
Per chip, the highest rate at which each kind of sample path moves samples while it runs. Samples in and out has the full matrix: every path with its average rate, Kconfig option and source. The radio has each chip’s boards and radio.
Chip |
PLL lock range |
Capture, burst |
Capture, continuous |
Replay, burst |
Replay, continuous |
|---|---|---|---|---|---|
ESP32-S3 |
1817 to 2793 MHz |
80 MS/s |
16 MS/s (ring) |
80 MS/s |
80 MS/s (loop) |
ESP32-C6 |
1774 to at least 2856 MHz |
80 MS/s |
80 MS/s (pruned) |
none |
250 kS/s (paced) |
ESP32-C5 |
not measured (no lock flag) |
80 MS/s |
40 MS/s (4+4 bit) |
80 MS/s |
80 MS/s (loop) |
ESP32-S31 |
2200 to some 2900 MHz |
80 MS/s |
40 MS/s (8+8 bit) |
80 MS/s |
80 MS/s (loop) |
ESP32 |
not measured |
80 MS/s |
none |
none |
none |
The lock range is the LO’s reach on air: the PLL directly from 2210 MHz up and, below it, through the 5/6 divider on the S3, the C6 and the ESP32; the C5 and the S31 have none.
“Loop” repeats a waveform held in memory, “pruned” keeps the windows above the noise, “paced” moves one sample at a time from the CPU.
Sources disagree on the S3’s edges and the S31’s high edge: Samples in and out keeps all figures under “Conflicting figures”.
Capabilities¶
Tuning: 100 to 6000 MHz in the API, but the PLL locks over a chip-specific range (the table above);
-ERANGEwhen the VCO is out of range. TuningGain: AGC or a fixed index; the fixed gain and the transmit power steps use
librftest.a. GainCapture: bursts of 256 to 16380 samples through the analog low-pass filter, with optional CIC decimation. Burst capture
Gapless receive: rings without a gap; on the S3 ring, a grid of channels with one capture per packet (
esp_sdr_chancap.h,CONFIG_ESP_SDR_CHANCAP). Gapless receive, ChannelizerTransmit: playback, waveform loops and gapless streaming at 40 MS/s / n (
CONFIG_ESP_SDR_TX, needslibrftest.aand PSRAM), 18 power steps. TransmitPaced transmit: CPU-paced transmit on the C6, C5 and S31. Paced streams
Enabling it¶
CONFIG_NETWORKING=y
CONFIG_WIFI=y
CONFIG_ESP32_WIFI_STA_POWER_SAVE_NONE=y
CONFIG_ESP_SDR=y
esp_sdr_init() takes over the radio the Wi-Fi driver brought up; do not scan, connect or start
an access point while using it.
Some sample paths run without the Wi-Fi driver: Samples in and out lists them under “Radio without the Wi-Fi driver”. Chip details are in The radio.
Documentation¶
Published at https://cyber-murmel.github.io/esp-sdr-zephyr. The guides come in five parts, each building on the one before:
The radio: the analog receive and transmit paths, tuning, gain, filters, impairments and crystal calibration.
Samples in and out: how samples enter and leave the radio: burst capture, gapless receive, transmit, paced streams and host transports.
Modulation and coding: the channelizer, IEEE 802.15.4, GFSK and Bluetooth LE, burst detection, QAM and OFDM, error correction.
Applications: the apps, their internals and the MCH2022 badge.
Reference: chip notes, code placement, testing, the ZigBit reference and the register pages.
The API reference documents the headers.
Building the site¶
cd esp-sdr-zephyr/doc
doxygen
make html
The site is in doc/_build_sphinx/html, with the API reference in its doxygen/ folder. CI
builds it with warnings as errors (SPHINXOPTS=-W) and publishes it.
Repository layout¶
Path |
What |
|---|---|
|
The libraries (below) |
|
Their API headers (below) |
|
The apps (below) |
|
The test tiers (below) |
|
Boards defined in this repository (below) |
|
Guides, register pages, the Doxygen and Sphinx build (Documentation) |
|
|
|
|
|
The workspace pins (Dependencies) |
Libraries¶
Library |
Kconfig |
What |
Guide |
|---|---|---|---|
|
|
The library: raw I/Q receive and transmit |
|
|
|
Software O-QPSK PHY and Zephyr radio driver |
|
|
|
Zigbee coordinator stack (MAC, NWK, APS, security) behind the Z-Stack ZNP protocol, portable C |
API headers¶
include/esp_sdr/: the API. The API reference lists its headers by group.include/zigbee/: the Zigbee stack’s headers.
Apps¶
Each app is a Zephyr application in apps/<name>; apps/common holds what they share.
Applications lists them by group with the chips each runs on.
Tests¶
tests/ holds unit (host), host (the Python tools, pytest), integration (one board)
and regression (two boards); the smoke tier is each app’s sample.yaml.
Testing has what each tier covers.
Boards¶
Two boards live in boards/; the others are Zephyr boards from the fork in modules/zephyr
(Dependencies). Each chip’s radio is described in The radio.
Board |
Chip |
Defined in |
|---|---|---|
|
ESP32-C5 |
|
|
RP2040 |
|
|
ESP32-S3 |
Zephyr fork |
|
ESP32-P4 with an ESP32-C6 |
Zephyr fork |
|
ESP32 |
Zephyr fork |
|
ESP32-S31 |
Zephyr fork |
|
ESP32-S31 |
Zephyr fork |
Versioning¶
VERSION(Zephyr’s format) versions the library and the apps; each app prints it at boot.Major for breaking API changes, minor for compatible extensions, patch for fixes.
A tag
v<VERSION>makes a GitHub release.
Dependencies¶
west.yml pins these projects. A fork carries this project’s changes on its zsdr branch.
Project |
Fork or upstream |
Used for |
|---|---|---|
fork |
ESP32-S3 SMP (zephyrproject-rtos/zephyr#120082), CDC-NCM aggregation, llext and Xtensa changes for multiapp, the Communicator, WHY2025 and MCH2022 badges with their drivers |
|
fork |
The HAL side of the SMP port, the ESP32-P4 flash erase fix |
|
fork |
VITA 49.2 |
|
upstream, unmodified |
Receiver helper headers |
|
upstream |
The ESP32-S3 FFT kernels for |
|
MicroPython zsdr (a Zephyr module) |
fork |
|
micropython-lib |
upstream |
|
LVGL |
upstream |
|
fork |
|
|
pycparser |
upstream |
|
License¶
GPL-3.0-or-later, like upstream esp-sdr; images that enable the library are subject to the GPL.
Next: The radio