Transmission delay and hang issues with arduino uno and CC1101 module (E07-M1101D)

I'm currently working on a project that involves an Arduino Uno and a CC1101 module (E07-M1101D). However, I've encountered some challenges with transmission delays and the module hanging after a few loops. I would greatly appreciate any guidance or suggestions to help me overcome these issues.

The primary problem I'm facing is a significant delay between consecutive SendData function calls. Moreover, after a few loops, the CC1101 module stops sending signals entirely. I have attempted to adjust the transmission settings, introduce delays, and reset the module, but the issue persists.

Here's the Arduino code I'm using:

#include <ELECHOUSE_CC1101_SRC_DRV.h>

#define preambleBytes 10
byte preamble[preambleBytes] = {0x01, 0xFF, 0xFF, 0xFF, 0xFF};

#define codeBytes 10
byte code[codeBytes] = { 0x09, 0x24, 0xD3, 0x6D, 0x34, 0x9A, 0x4D, 0xA3, 0x49, 0xA4 };

void setup() {
    Serial.begin(9600);
    
    if (ELECHOUSE_cc1101.getCC1101()) {
        Serial.println("Connection OK");
    } else {
        Serial.println("Connection Error");
    }
 
    ELECHOUSE_cc1101.Init();
    ELECHOUSE_cc1101.setCCMode(1);
    ELECHOUSE_cc1101.setModulation(2);
    ELECHOUSE_cc1101.setMHZ(434.70);
    ELECHOUSE_cc1101.setSyncMode(0);
    ELECHOUSE_cc1101.setCrc(0);
    ELECHOUSE_cc1101.setDRate(3.044);
    ELECHOUSE_cc1101.setChannel(0);
    ELECHOUSE_cc1101.setSyncMode(0);
    ELECHOUSE_cc1101.setWhiteData(0);
    ELECHOUSE_cc1101.setPktFormat(0);
    ELECHOUSE_cc1101.setLengthConfig(1);
    ELECHOUSE_cc1101.setPacketLength(0);
    ELECHOUSE_cc1101.setCrc(0);
    ELECHOUSE_cc1101.setCRC_AF(0);
    ELECHOUSE_cc1101.setDcFilterOff(0);
    ELECHOUSE_cc1101.setManchester(0);
    ELECHOUSE_cc1101.setFEC(0);
    ELECHOUSE_cc1101.setPRE(0);
    ELECHOUSE_cc1101.setPQT(0);
    ELECHOUSE_cc1101.setAppendStatus(0);

    Serial.println("Tx Mode");
}

void loop() {
    ELECHOUSE_cc1101.SendData(preamble, preambleBytes);
    ELECHOUSE_cc1101.SendData(code, codeBytes);
}

I would be immensely grateful for any insights, suggestions, or troubleshooting steps that could help me resolve this issue.

that's a machine gun :slight_smile:

what happens if you add a delay in the loop, to send only once per second for example and if you get rid of all the special selections and use the defaults?

    ELECHOUSE_cc1101.setCCMode(1);
    ELECHOUSE_cc1101.setModulation(2);
    ELECHOUSE_cc1101.setMHZ(434.70);
    ELECHOUSE_cc1101.setSyncMode(0);
    ELECHOUSE_cc1101.setCrc(0);
    ELECHOUSE_cc1101.setDRate(3.044);
    ELECHOUSE_cc1101.setChannel(0);
    ELECHOUSE_cc1101.setSyncMode(0);
    ELECHOUSE_cc1101.setWhiteData(0);
    ELECHOUSE_cc1101.setPktFormat(0);
    ELECHOUSE_cc1101.setLengthConfig(1);
    ELECHOUSE_cc1101.setPacketLength(0);
    ELECHOUSE_cc1101.setCrc(0);
    ELECHOUSE_cc1101.setCRC_AF(0);
    ELECHOUSE_cc1101.setDcFilterOff(0);
    ELECHOUSE_cc1101.setManchester(0);
    ELECHOUSE_cc1101.setFEC(0);
    ELECHOUSE_cc1101.setPRE(0);
    ELECHOUSE_cc1101.setPQT(0);
    ELECHOUSE_cc1101.setAppendStatus(0);

That is unlikely, so please explain how you know this.

You need to describe the entire setup, both TX and RX. Please post links to the modules and a wiring diagram, with pins and connections clearly labeled. Hand drawn is preferred.

I strongly doubt that this will work as you expect, and that you are using the library correctly. Study the library documentation and examples more carefully,

    ELECHOUSE_cc1101.SendData(preamble, preambleBytes);
    ELECHOUSE_cc1101.SendData(code, codeBytes);

Unfortunately, that produces the same result.

void setup() {
    ELECHOUSE_cc1101.Init();              // must be set to initialize the cc1101!
    ELECHOUSE_cc1101.setMHZ(434.70);   // 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.
}

void loop() {
    ELECHOUSE_cc1101.SendData(preamble, preambleBytes);
    ELECHOUSE_cc1101.SendData(code, codeBytes);
    delay(1000);
}

what's the receiving code?

they have a Tx and Rx example, does it work for you?

Why are you sending something called preamble?

  • it has the wrong size compared to what it's initialised with

I know it since i have an RTR SDR that shows me the signals coming out of the CC1101. Here is a screenshot I took of SDR#, the 2 dots in the middle are the 2 transmissions. After these two I do not observe any more transmissions.

Here is the wiring diagram I used:


I took them from here:
rtl_433_ESP/docs/E07-M1101D-TH_Usermanual_EN_v1.30.pdf at main · NorthernMan54/rtl_433_ESP · GitHub
and here:
SmartRC-CC1101-Driver-Lib/img/Nano_CC1101.png at master · LSatan/SmartRC-CC1101-Driver-Lib · GitHub

That does not mean necessarily mean or even imply that the radio is failing, as suggested by your comment.

It looks to me that you are just making up code, with little understanding of how the entire process should work.

It is better to start with library examples, and verify that they work as expected, before heading off into the unknown.

I want to mention that I slowed down the baudrate, and slightly change the code to this:

void loop() {
    ELECHOUSE_cc1101.SendData(code, codeBytes);
    delay(1000);
}

But I only see 2 pulses of tranmission and that's it, instead of continuous transmissions every 1 second.

The posted code looks like nonsense to me, and a "slight change" could have any imaginable effect.

I managed to finally solve the issue by adding a third parameter to SendData like so:

ELECHOUSE_cc1101.SendData(preamble, preambleBytes, 100);

The documentation does not explicitly explain the purpose of the parameter, but it does act like a delay that is taking place after the sending of the data. Here is the full working code:

#include <ELECHOUSE_CC1101_SRC_DRV.h>

#define preambleBytes 10
byte preamble[preambleBytes] = {0x01, 0xFF, 0xFF, 0xFF, 0xFF};

#define codeBytes 10
byte code[codeBytes] = { 0x09, 0x24, 0xD3, 0x6D, 0x34, 0x9A, 0x4D, 0xA3, 0x49, 0xA4 };

void setup() {
    Serial.begin(9600);
    
    if (ELECHOUSE_cc1101.getCC1101()) {
        Serial.println("Connection OK");
    } else {
        Serial.println("Connection Error");
    }
 
    ELECHOUSE_cc1101.Init();
    ELECHOUSE_cc1101.setCCMode(1);
    ELECHOUSE_cc1101.setModulation(2);
    ELECHOUSE_cc1101.setMHZ(434.70);
    ELECHOUSE_cc1101.setSyncMode(0);
    ELECHOUSE_cc1101.setCrc(0);
    ELECHOUSE_cc1101.setDRate(3.044);
    ELECHOUSE_cc1101.setChannel(0);
    ELECHOUSE_cc1101.setSyncMode(0);
    ELECHOUSE_cc1101.setWhiteData(0);
    ELECHOUSE_cc1101.setPktFormat(0);
    ELECHOUSE_cc1101.setLengthConfig(1);
    ELECHOUSE_cc1101.setPacketLength(0);
    ELECHOUSE_cc1101.setCrc(0);
    ELECHOUSE_cc1101.setCRC_AF(0);
    ELECHOUSE_cc1101.setDcFilterOff(0);
    ELECHOUSE_cc1101.setManchester(0);
    ELECHOUSE_cc1101.setFEC(0);
    ELECHOUSE_cc1101.setPRE(0);
    ELECHOUSE_cc1101.setPQT(0);
    ELECHOUSE_cc1101.setAppendStatus(0);

    Serial.println("Tx Mode");
}

void loop() {
    ELECHOUSE_cc1101.SendData(preamble, preambleBytes, 100);
    ELECHOUSE_cc1101.SendData(code, codeBytes, 100);
}

I was going into this direction thanks to @jremington pointing me back to library examples.

you might want to change

into

const byte preamble[] = {0x01, 0xFF, 0xFF, 0xFF, 0xFF};
const size_t preambleBytes = sizeof preamble;

const byte code[] = { 0x09, 0x24, 0xD3, 0x6D, 0x34, 0x9A, 0x4D, 0xA3, 0x49, 0xA4 };
const size_t codeBytes  = sizeof code;

so that you really take into account the exact number of bytes in the array.

1 Like