This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3582497909a wireless/cc1101: Add Kconfig option to bypass strict 
version check
3582497909a is described below

commit 3582497909a515cdc8222e7872492ab44caead6a
Author: Chip L. <[email protected]>
AuthorDate: Fri Feb 27 02:56:59 2026 +0800

    wireless/cc1101: Add Kconfig option to bypass strict version check
    
    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. <[email protected]>
---
 drivers/wireless/Kconfig  | 13 +++++++++++++
 drivers/wireless/cc1101.c | 17 +++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/wireless/Kconfig b/drivers/wireless/Kconfig
index 08e93a28e40..1eb791f7f77 100644
--- a/drivers/wireless/Kconfig
+++ b/drivers/wireless/Kconfig
@@ -28,6 +28,19 @@ config CC1101_SPIDEV
 
 endif
 
+config WL_CC1101_IGNORE_VERSION
+       bool "Ignore CC1101 Version Check (Allow Clone Chips)"
+       default n
+       depends on WL_CC1101
+       ---help---
+               Some third-party CC1101 clone silicon hardcodes the VERSION
+               register to 0x00. Enabling this option bypasses the strict
+               version verification, allowing these compatible chips to
+               initialize.
+
+               Warning: Enabling this may cause false-positives if the SPI
+               MISO line is shorted to GND.
+
 config WL_GS2200M
        bool "Telit GS2200M Wi-Fi support"
        default n
diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c
index dcc366f7356..31a5a71c7c0 100644
--- a/drivers/wireless/cc1101.c
+++ b/drivers/wireless/cc1101.c
@@ -817,10 +817,27 @@ int cc1101_checkpart(struct cc1101_dev_s *dev)
 
   wlinfo("CC1101 cc1101_checkpart 0x%X 0x%X\n", partnum, version);
 
+#ifndef CONFIG_WL_CC1101_IGNORE_VERSION
+  /* Strict official silicon validation */
+
   if (partnum == CC1101_PARTNUM_VALUE && version == CC1101_VERSION_VALUE)
     {
       return OK;
     }
+#else
+  /* Bypass for third-party clone silicon (e.g., VERSION == 0x00) */
+
+  if (partnum == CC1101_PARTNUM_VALUE)
+    {
+      if (version != CC1101_VERSION_VALUE)
+        {
+          wlwarn("WARNING: Unofficial CC1101 version 0x%02x detected.\\n",
+            version);
+        }
+
+      return OK;
+    }
+#endif
 
   return -ENOTSUP;
 }

Reply via email to