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

How to use multiple cc1101 correctly? (one sending, one receiving)

Open dracobucio opened this issue 2 years ago • 0 comments

I know this topic has been discussed before and the author will try to add an example later in the next update. However, I have tried to use the new features to send and receive, I found that I need to use a double initialization to be able to use 2 cc1101 modules with a teensy 4.0, using V2.5.7. This is my code:

void configure(){ ELECHOUSE_cc1101.Init(); ELECHOUSE_cc1101.setCCMode(1); ELECHOUSE_cc1101.setModulation(0); ELECHOUSE_cc1101.setMHZ(433.92); ELECHOUSE_cc1101.setDeviation(47.60); ELECHOUSE_cc1101.setChannel(0); ELECHOUSE_cc1101.setChsp(199.95); ELECHOUSE_cc1101.setRxBW(812.50); ELECHOUSE_cc1101.setDRate(99.97); ELECHOUSE_cc1101.setPA(10); ELECHOUSE_cc1101.setSyncMode(2); ELECHOUSE_cc1101.setSyncWord(211, 145); ELECHOUSE_cc1101.setAdrChk(0); ELECHOUSE_cc1101.setAddr(0); ELECHOUSE_cc1101.setWhiteData(0); ELECHOUSE_cc1101.setPktFormat(0); ELECHOUSE_cc1101.setLengthConfig(1); ELECHOUSE_cc1101.setPacketLength(0); ELECHOUSE_cc1101.setCrc(1); 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); }

void setup(){ Serial.begin(19200); ELECHOUSE_cc1101.addSpiPin(13, 12, 11, 10, 0); ELECHOUSE_cc1101.addGDO0(2, 0); ELECHOUSE_cc1101.addSpiPin(13, 12, 11, 9, 1); ELECHOUSE_cc1101.addGDO0(3, 1); ELECHOUSE_cc1101.setModul(0); configure();
ELECHOUSE_cc1101.setModul(1); configure();
}

If just using this initialization in the setup function doesn't work, I must add an initialization again to make it work inside the loop function:

if (conf == false){ ELECHOUSE_cc1101.setModul(0); configure(); ELECHOUSE_cc1101.setModul(1); configure(); conf = true; }

how to correctly use multiple cc1101 switching with the SPI without losing communication? An example of a cc1101 as a transmitter and another as a receiver on the same board would be greatly appreciated.

THANKS! :)

dracobucio avatar Mar 30 '22 09:03 dracobucio