Skip to content

wireless/cc1101: Add Kconfig option to bypass strict version check#18463

Open
AuroraRAS wants to merge 1 commit intoapache:masterfrom
AuroraRAS:clone1101
Open

wireless/cc1101: Add Kconfig option to bypass strict version check#18463
AuroraRAS wants to merge 1 commit intoapache:masterfrom
AuroraRAS:clone1101

Conversation

@AuroraRAS
Copy link
Contributor

Summary

This PR introduces a Kconfig option (CONFIG_WL_CC1101_IGNORE_VERSION) to bypass strict version validation in the CC1101 driver, allowing the initialization of third-party clone silicon.

Problem:
The cc1101_checkpart() function in drivers/wireless/cc1101.c strictly enforces the silicon version to match the official Texas Instruments value (CC1101_VERSION_VALUE == 0x14). Many low-cost CC1101 modules in the wild (such as those populated on the Evil Crow RF V2 hardware) utilize compatible clone silicon that hardcodes the VERSION register to 0x00. When the driver encounters these chips, it aborts initialization and returns -ENOTSUP (which propagates as -ENODEV).

Solution:
Added CONFIG_WL_CC1101_IGNORE_VERSION to drivers/wireless/Kconfig.
When enabled, the driver explicitly permits VERSION == 0x00 and issues a wlwarn indicating a clone chip was detected. The option defaults to n (disabled) to preserve the driver's ability to diagnose actual hardware faults, such as a MISO line shorted to GND (which also results in a 0x00 read).

Impact

  • Compatibility: Broadens hardware support for users utilizing third-party sub-GHz RF modules.
  • Stability: Zero impact on existing applications. The feature is strictly opt-in (default n).
  • Security: None.

Testing

Host Machine: Fedora 43 (x86_64)
Target Hardware: ESP32-PICO-D4 (Rev 1.1) on Evil Crow RF V2 board (containing two CC1101 clone modules).

Verification Procedure:

  1. Compiled NuttX with CONFIG_WL_CC1101=y and CONFIG_WL_CC1101_IGNORE_VERSION=y.
  2. Flashed the firmware to the ESP32.
  3. Verified the SPI probe and initialization sequence via syslog.
  4. Confirmed the successful registration of the character device nodes (/dev/radio0 and /dev/radio1) in NSH.

Logs:

cc1101_checkpart: CC1101 cc1101_checkpart 0x0 0x0
cc1101_checkpart: WARNING: CC1101 VERSION=0x00 detected. Proceeding with clone chip bypass.
esp32_spi_select: devid: 00060000 CS: select
esp32_spi_setmode: mode=0
esp32_spi_setbits: nbits=8
esp32_spi_poll_send: send=0x2 and recv=0xe
esp32_spi_poll_exchange: send=0x2e data_reg=0x3ff64080
...
NuttShell (NSH) NuttX-12.12.0
nsh> ls /dev
/dev:
 console
 mmcsd0
 nrf24l01
 null
 radio0
 radio1
 ttyS0
 zero

@github-actions github-actions bot added Area: Drivers Drivers issues Size: S The size of the change in this PR is small labels Feb 26, 2026
@acassis
Copy link
Contributor

acassis commented Feb 26, 2026

@AuroraRAS please run:

./tools/checkpatch.sh -f drivers/wireless/cc1101.c

Then fix the issues, create a new commit with the fix and squash in the previous commit, more info:
https://nuttx.apache.org/docs/latest/contributing/making-changes.html#how-to-include-the-suggestions-on-your-pull-request

Many third-party CC1101 modules (such as those populated on the Evil Crow
RF V2) feature clone silicon that hardcodes the VERSION register to 0x00
instead of the official 0x14.

Previously, the cc1101_checkpart() function strictly enforced
VERSION == 0x14, which caused cc1101_register() to return -ENODEV (-19)
and abort initialization on these compatible modules.

This commit introduces the CONFIG_WL_CC1101_IGNORE_VERSION Kconfig option.
- When disabled (default), the driver maintains strict official silicon
  validation. This preserves the diagnostic ability to catch hardware
  faults, such as a MISO line shorted to GND (which also reads as 0x00).
- When enabled, the driver explicitly permits VERSION == 0x00, allowing
  successful initialization and interoperability with clone chips while
  printing a warning to the syslog.

Signed-off-by: Chip L. <chplee@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants