SmartRC-CC1101-Driver-Lib icon indicating copy to clipboard operation
SmartRC-CC1101-Driver-Lib copied to clipboard

esp32-c3-supermini - cc1101 v2 hanging on init

Open luupux opened this issue 10 months ago • 6 comments

Hello, I'm checking to switch from esp32-wroom to esp32-c3-supermini but I went in stuck, I tried different approach then I was not able to understand what I'm doing wrong and I decide to open an issue for help Mainly the code is in stuck in the init phase, I already reviewed multiple time the code, wiring and tested the code in two different board an cc1101 so I don't know what else do

#include <ELECHOUSE_CC1101_SRC_DRV.h> #include "driver/gpio.h" #include <SPI.h>

#define PIN_SCK 3 #define PIN_MISO 5 #define PIN_MOSI 6 #define PIN_CS 10

void setup() { Serial.begin(115200); delay(500);

Serial.println("🔧 Starting transmitter (v2.5.7)..."); Serial.println("Test SPI"); SPI.begin(); Serial.println("ELECHOUSE_cc1101.setSpiPin"); ELECHOUSE_cc1101.setSpiPin(PIN_SCK, PIN_MISO, PIN_MOSI, PIN_CS); Serial.println("Test Init"); ELECHOUSE_cc1101.Init();
Serial.println("test secCCMode"); ELECHOUSE_cc1101.setCCMode(1); // set config for internal transmission mode. ELECHOUSE_cc1101.setModulation(0); // set modulation mode. 0 = 2-FSK, 1 = GFSK, 2 = ASK/OOK, 3 = 4-FSK, 4 = MSK. ELECHOUSE_cc1101.setMHZ(433.92); // Here you can set your basic frequency. The lib calculates the frequency automatically (default = 433.92).The cc1101 can: 300-348 MHZ, 387-464MHZ and 779-928MHZ. Read More info from datasheet. ELECHOUSE_cc1101.setSyncMode(2); // Combined sync-word qualifier mode. 0 = No preamble/sync. 1 = 16 sync word bits detected. 2 = 16/16 sync word bits detected. 3 = 30/32 sync word bits detected. 4 = No preamble/sync, carrier-sense above threshold. 5 = 15/16 + carrier-sense above threshold. 6 = 16/16 + carrier-sense above threshold. 7 = 30/32 + carrier-sense above threshold. ELECHOUSE_cc1101.setCrc(1); // 1 = CRC calculation in TX and CRC check in RX enabled. 0 = CRC disabled for TX and RX. Serial.println("Rx Mode"); }

void loop(){ Serial.println("amicici"); }

Then this is the output 12:14:38.705 -> 🔧 Starting transmitter (v2.5.7)... 12:14:38.705 -> 12:14:38.705 -> Test SPI 12:14:38.705 -> 12:14:38.705 -> ELECHOUSE_cc1101.setSpiPin 12:14:38.705 -> 12:15:26.217 -> 🔧 Starting transmitter (v2.5.7)... 12:15:26.217 -> Test SPI 12:15:26.217 -> ELECHOUSE_cc1101.setSpiPin 12:15:26.217 -> Test Init

luupux avatar Apr 05 '25 10:04 luupux

Hey I have the same problem, have found a solution yet ??

MaxiKn avatar Jun 10 '25 15:06 MaxiKn

Did #160 or #161 fix this?

thechiefs avatar Aug 24 '25 06:08 thechiefs

Did #160 or #161 fix this?

Doesn't look like it - I just wrote a sketch with the same board and radio, and I'm having the same error. SetSPIPins succeeds (if (ELECHOUSE_cc1101.getCC1101()) { }; returns true), but ELECHOUSE_cc1101.Init(); hangs, then the c3 supermini reboots.

I tried a few different pin configuirations as the C3SuperMini is notoriously annoying with pins, but sadly I got no success. Tested with multiple boards and radios.

Windyo avatar Sep 22 '25 15:09 Windyo

Have it narrowed down to the SpiWriteReg(CC1101_FSCTRL1, 0x06); line.

08:57:41.851 -> [ELECHOUSE] SPI Write Reg FSCTRL...
08:57:41.851 -> [  6187][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x42010f84
08:57:41.851 -> [  6187][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 6 successfully set to type INIT (0) with bus 0x0
08:57:41.851 -> [  6188][D][esp32-hal-spi.c:208] spiDetachBus(): Stopping SPI bus
08:57:41.851 -> [  6188][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 2 successfully set to type INIT (0) with bus 0x0
08:57:41.851 -> [  6189][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 10 successfully set to type INIT (0) with bus 0x0
08:57:41.851 -> [  6189][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 6 successfully set to type INIT (0) with bus 0x0
08:57:41.851 -> [  6190][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 6 successfully set to type GPIO (1) with bus 0x7
08:57:41.851 -> [  6190][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x42010f84
08:57:41.851 -> [  6191][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 10 successfully set to type GPIO (1) with bus 0xb
08:57:41.897 -> [  6191][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x42010f84
08:57:41.897 -> [  6192][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 2 successfully set to type GPIO (1) with bus 0x3

And then the crash. Unsure why exactly.

Windyo avatar Sep 23 '25 06:09 Windyo

Editing the library to set the SPI.End() before the RegConfig fixes the init. I'll test to see if the module works correctly.

Windyo avatar Sep 23 '25 07:09 Windyo

If you still have some issues you can try my fork https://github.com/Viproz/SmartRC-CC1101-Driver-Lib I added some timeouts to some while loops which could cause crashes if the CC1101 does not behave exactly as expected. I also merged the fix for the RegConfig issue.

Viproz avatar Sep 25 '25 15:09 Viproz