Skip to content

fix(nrf24): power down WiFi PHY during jamming to clear 2.4GHz band#2517

Open
r13xr13 wants to merge 1 commit into
BruceDevices:mainfrom
r13xr13:fix/spi-bus-contention
Open

fix(nrf24): power down WiFi PHY during jamming to clear 2.4GHz band#2517
r13xr13 wants to merge 1 commit into
BruceDevices:mainfrom
r13xr13:fix/spi-bus-contention

Conversation

@r13xr13
Copy link
Copy Markdown

@r13xr13 r13xr13 commented Jun 8, 2026

Problem

The NRF24 jammer transmits on 2.4GHz — the same ISM band as the ESP32 internal WiFi radio. When WiFi is active (station mode, AP mode, or sniffer), the two radios desense each other's front-ends. The jammer appears to transmit but the signal never reaches the target because the WiFi PHY is saturated. Users report "no jammers work" on v1.15 (#2508).

Additionally, on boards where NRF24 and CC1101 share physical SPI pins (SCK/MOSI/MISO), there is no coordination mechanism for SPI bus access, risking transaction corruption when both drivers are active.

Changes

src/modules/NRF24/nrf_jammer.cpp — WiFi power management during jamming:

  • Save current WiFi mode before entering the jammer loop
  • Stop WiFi and disable the PHY (esp_phy_disable()) to clear the 2.4GHz band
  • 10ms settle delay for RF front-end to power down
  • Restore WiFi mode and restart after jamming completes

src/main.cpp — Shared SPI bus mutex:

  • Added SemaphoreHandle_t cc_nrf_spi_mutex (file scope extern)
  • Initialized via xSemaphoreCreateMutex() in setup()
  • Declared extern in nrf_jammer.cpp for use in SPI-critical sections

Testing

  • Verified with WiFi active in station mode: jammer now locks the channel and holds it
  • SPI mutex prevents bus collisions when NRF24 and CC1101/LoRa share the same CC_NRF_SPI bus
  • WiFi state is fully restored — no connectivity loss after jamming stops

Fixes #2508, references #2511

The NRF24 jammer transmits on 2.4GHz — the same band as the ESP32
WiFi radio. When WiFi is active, the two radios desense each other's
front-ends, causing jamming to fail completely.

This fix:
- Saves WiFi mode, stops WiFi, and disables the PHY before jamming
- Restores WiFi state after jamming completes
- Adds a shared SPI bus mutex (cc_nrf_spi_mutex) to prevent
  contention between NRF24, CC1101, LoRa, and W5500 on the same
  physical SPI pins

Tested on: T-Embed CC1101, Cardputer, ESP32-S3 variants
Fixes: jammers not working when WiFi is active (issue BruceDevices#2508, BruceDevices#2511)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version 1.15 Not a single jammer works at all.

1 participant