Dear all,
I have connected my Lolin-s2 mini to a CC1101 external module and using the SmartRC-CC1101-Driver-Lib library to interact with it.
My program runs perfectly and I can follow on the serial monitor all the steps. The radio signal sent, is what I expect.
When I disconnect the S2 from the usb connected to the pc and add it to a external power supply or power bank, the program runs until the below line
ELECHOUSE_cc1101.Init();
and it freezes (extensive debug to identify the blocking point). I also removed all serial connection and output.
Instead, if the S2 is connected to the usb of the pc is working regardless if there is a serial monitor open or not.
Below the pinout connection and the code snippet
+=============+===================+
| CC1101 Pin | ESP32-S2 Pin |
+=============+===================+
| 1 GND | GND |
+-------------+-------------------+
| 2 3V3 | 3V3 |
+-------------+-------------------+
| 3 GDO0 (TX) | GPIO-5 |
+-------------+-------------------+
| 4 CSN | GPIO-12 (FSPICLK) |
+-------------+-------------------+
| 5 SCK | GPIO-7 |
+-------------+-------------------+
| 6 MOSI | GPIO-11 (FSPID) |
+-------------+-------------------+
| 7 MISO | GPIO-9 (FSPIHD) |
+-------------+-------------------+
| 8 GDO2 (RX) | GPIO-3 |
+-------------+-------------------+
bool initCC1101(float mhz) {
ELECHOUSE_cc1101.Init(); // <--- CODE BLOCKS HERE, led does not turn off if not connected to pc
digitalWrite(LED_BUILTIN, LOW);
ELECHOUSE_cc1101.setGDO(TXPin, RXPin); // GDO0, GDO2
digitalWrite(LED_BUILTIN, LOW);
ELECHOUSE_cc1101.setSpiPin(SCKPin, MISOPin, MOSIPin, CSNPin);
ELECHOUSE_cc1101.setMHZ(mhz);
ELECHOUSE_cc1101.SetTx();
ELECHOUSE_cc1101.setModulation(2);
ELECHOUSE_cc1101.setDRate(512);
ELECHOUSE_cc1101.setPktFormat(3);
// Check the CC1101 Spi connection.
if (!ELECHOUSE_cc1101.getCC1101()) {
return false; // Failure
}
// Turn off tx
digitalWrite(TXPin, 0);
return true; // Success
}
Any ideas or suggestion please?
Kind regards,
dk
EDIT: using a usb power only cable (no data) seems not to block, but I have the feeling the range of the rf transmission is reduced