This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1101: GDO0 continue toggling interrupt issue

Part Number: CC1101

Tool/software:

I am using the Interrupt configuration 0x06 
[6 (0x06) Asserts when sync word has been sent / received, and de-asserts at the end of the packet. In RX, the pin will also deassert when a packet is discarded due to address or maximum length filtering or RXFIFO_OVERFLOW state. In TX the pin will de-assert if the TX FIFO underflows.]

Establish two way communication between two devices  transmit and receive packet. interrupt based setting.

I have tried setting the chip into receive mode  GDO0 will toggle when I receive the chip a packet. However, even when I am not sending, the GDO0 pin will continually toggle on its own. 

same thing in the transmit mode toggling continues when transmitting packet or not also. 

 

Function shown below kindly check my steps.

// ISR function

void ELECHOUSE_CC1101::setGDO0(byte gdo0){
GDO0 = gdo0;
//GDO0=2;
GDO0_Set();
attachInterrupt(digitalPinToInterrupt(GDO0), isr1, FALLING);

}

void ELECHOUSE_CC1101::isr1(){
 interrupt=1;
}
// For transmit 
void ELECHOUSE_CC1101::SendData(char *txchar)
{
int len = strlen(txchar);
byte chartobyte[len];
for (int i = 0; i<len; i++){chartobyte[i] = txchar[i];}
SendData(chartobyte,len);
}
/****************************************************************
*FUNCTION NAME:SendData
*FUNCTION     :use CC1101 send data
*INPUT        :txBuffer: data array to send; size: number of data to send, no more than 61
*OUTPUT       :none
****************************************************************/
void ELECHOUSE_CC1101::SendData(byte *txBuffer,byte size)
{
  SpiWriteReg(CC1101_TXFIFO,size);
  SpiWriteBurstReg(CC1101_TXFIFO,txBuffer,size);      //write data to send
  SpiStrobe(CC1101_SIDLE);
  SpiStrobe(CC1101_STX);                  //start send
    while (!digitalRead(GDO0));               // Wait for GDO0 to be set -> sync transmitted  
    while (digitalRead(GDO0));                // Wait for GDO0 to be cleared -> end of packet
  SpiStrobe(CC1101_SFTX);                 //flush TXfifo
  trxstate=1;
}
// For Receive Flag 
/****************************************************************
*FUNCTION NAME:CheckReceiveFlag
*FUNCTION     :check receive data or not
*INPUT        :none
*OUTPUT       :flag: 0 no data; 1 receive data
****************************************************************/

byte ELECHOUSE_CC1101::CheckReceiveFlag(void)
{
  if(trxstate!=2){SetRx();}
  //if(digitalRead(GDO0))     //receive data
  if(interrupt==true)
  {interrupt=false;
    while (digitalRead(GDO0));
    return 1;
  }
  else              // no data
  {
    return 0;
  }
}

byte ELECHOUSE_CC1101::ReceiveData(byte *rxBuffer)
{
  byte size;
  byte status[2];

  if(SpiReadStatus(CC1101_RXBYTES) & BYTES_IN_RXFIFO)  // 127
  {
    size=SpiReadReg(CC1101_RXFIFO);
    SpiReadBurstReg(CC1101_RXFIFO,rxBuffer,size); // Read data rx fifo
    SpiReadBurstReg(CC1101_RXFIFO,status,2);
    SpiStrobe(CC1101_SFRX);  // Flush rx fifo buffer. Only issue SFRX in IDLE or RXFIFO_OVERFLOW states.
    SpiStrobe(CC1101_SRX);  //Enable RX. Perform calibration first if coming from IDLE and MCSM0.FS_AUTOCAL=1
    return size;
  }
 
  else
  {
    SpiStrobe(CC1101_SFRX);
    SpiStrobe(CC1101_SRX);
    return 0;
  }

}
//  Send and receive  main function 
 
int main(){
void loop(){
int button = digitalRead(0);
if(button==LOW){
ELECHOUSE_cc1101.SendData("Hello World, hi how are this side from transmitter");
delay(200);
}
   //Checks whether something has been received.
  if (ELECHOUSE_cc1101.CheckReceiveFlag()){

   //CRC Check. If "setCrc(false)" crc returns always OK!
  if (ELECHOUSE_cc1101.CheckCRC()){

   //Rssi Level in dBm
    Serial.print("Rssi: ");
    Serial.println(ELECHOUSE_cc1101.getRssi());

   //Link Quality Indicator
    Serial.print("LQI: ");
    Serial.println(ELECHOUSE_cc1101.getLqi());

   //Get received Data and calculate length
    int len = ELECHOUSE_cc1101.ReceiveData(buffer);
    buffer[len] = '\0';

   //Print received in char format.
    Serial.println((char *) buffer);

   //Print received in bytes format.
    for (int i = 0; i<len; i++){
    Serial.print(buffer[i]);
    Serial.print(",");
    }
    Serial.println();
  }
  }
 
}
}
  • It is fully possible to receive data, even if you are not sending anything. This is the nature of RF (you have no control over what is actually present on the air).

    However, if you choose a proper sync word, it should be limited how much noise you trigger on.

    I have no info regarding what HW you are running on (our EMs or you custom HW) and not what settings etc. you are using.

    Our recommendation id to start your development on our HW and start with characterized settings, and make sure that everything works as expected there.

    Once you have verified this, you can start doing your custom changes to settings/application etc. 

    Once you have the radio working as you want, you can move your application over to your own HW.

    If you connect an EM to and EM and run some tests using SmartRF Studio (with characterized settings from Studio), you will see that you do not receive many "false" packets.

    BR

    Siri