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.

CC1120 rssi

hello

how can I read RSSI,I had read the document of RSSI,if i used AGC_GAIN_ADJUST.GAIN_ADJUSTMENT is 0x00 ,with the document,it means that it have a known sigal.but now I havenot kown tne input sigal Strength,how can i read RSSI?the config is same to the smart studio.

best regard.

  • hi,

    I haven't solve this problem.

    reg config is this:

      {CC112X_IOCFG3,            0xB0},
      {CC112X_IOCFG2,            0x06},
      {CC112X_IOCFG1,            0xB0},
      {CC112X_IOCFG0,            0x40},
      {CC112X_SYNC_CFG1,         0x08},
      {CC112X_DEVIATION_M,       0x48},
      {CC112X_MODCFG_DEV_E,      0x0D},
      {CC112X_DCFILT_CFG,        0x1C},
      {CC112X_IQIC,              0x00},
      {CC112X_CHAN_BW,           0x02},
      {CC112X_MDMCFG0,           0x05},
      {CC112X_DRATE2,      0x93},
      {CC112X_AGC_CS_THR,        0x19},
      {CC112X_AGC_CFG1,          0xA9},
      {CC112X_AGC_CFG0,          0xCF},
      {CC112X_FIFO_CFG,          0x00},
      {CC112X_FS_CFG,            0x14},
      {CC112X_PKT_CFG0,          0x20},
      {CC112X_PA_CFG0,           0x7B},
      {CC112X_PKT_LEN,           0xFF},
      {CC112X_IF_MIX_CFG,        0x00},
      {CC112X_FREQOFF_CFG,       0x22},
      {CC112X_FREQ2,             0x6C},
      {CC112X_FREQ1,             0x80},
      {CC112X_FS_DIG1,           0x00},
      {CC112X_FS_DIG0,           0x5F},
      {CC112X_FS_CAL1,           0x40},
      {CC112X_FS_CAL0,           0x0E},
      {CC112X_FS_DIVTWO,         0x03},
      {CC112X_FS_DSM0,           0x33},
      {CC112X_FS_DVC0,           0x17},
      {CC112X_FS_PFD,            0x50},
      {CC112X_FS_PRE,            0x6E},
      {CC112X_FS_REG_DIV_CML,    0x14},
      {CC112X_FS_SPARE,          0xAC},
      {CC112X_FS_VCO0,           0xB4},
      {CC112X_XOSC5,             0x0E},
      {CC112X_XOSC1,             0x03},

    init:

    unsigned char cc112xRssiOffset = 102;

      cc112xSpiWriteReg(CC112X_AGC_GAIN_ADJUST,&cc112xRssiOffset,1);

    //this code is read RSSI from TI document

    int Read8BitRssi(void){
      uint8 rssi2compl,rssiValid;
      uint8 rssiOffset = 102;
      int8 rssiConverted;
      // Read RSSI_VALID from RSSI0
      cc112xSpiReadReg(CC112X_RSSI0, &rssiValid, 1);
      // Check if the RSSI_VALID flag is set
      if(rssiValid & 0x01){
        // Read RSSI from MSB register
        cc112xSpiReadReg(CC112X_RSSI1, &rssi2compl, 1);
        rssiConverted = (int8)rssi2compl - rssiOffset;
        return rssiConverted;
      }
      // return 0 since new value is not valid
      return 0;
    }

    // this code in the main loop

    if (rxBytes != 0)                                     // Check that we have bytes in fifo
        {               
          cc112xSpiReadReg(CC112X_MARCSTATE, &marcStatus, 1);// Read marcstate to check for RX FIFO error,检测接收是否错误
                  
          if ((marcStatus & 0x1F) == RX_FIFO_ERROR){          // Mask out marcstate bits and check if we have a RX FIFO error            
            
            trxSpiCmdStrobe(CC112X_SFRX);                    // Flush RX Fifo
          }
          else{                                              // Read n bytes from rx fifo,接收到有效的数据包
            cc112xSpiReadRxFifo(radio_to_buffer, rxBytes);
            
            if(radio_to_buffer[rxBytes-1] & 0x80)
            {                      
              //buffer_to_uart[0] = rxBytes;
              temp = rxBytes;
              rxBufferuartlength = temp - 4;
              for(i = 0; i < temp; i++)
              {
                buffer_to_uart[i] = radio_to_buffer[i];        //提取RADIO有效数据                     
              }
              // Check CRC ok (CRC_OK: bit7 in second status byte)
              // This assumes status bytes are appended in RX_FIFO
              // (PKT_CFG1.APPEND_STATUS = 1.)
              // If CRC is disabled the CRC_OK field will read 1
              RSSI = Read8BitRssi();
              RSSI = ~RSSI+1; //read RSSI
              radio_to_buffer_flag = 1;                        //缓冲区有数据标志位,代表有 有效的RF数据接收到
              halLedSetRxled();                               //启动接收LED,串口发送完毕后关闭LED
            }
          }

    but i found the value is wrang.

    pls check what the problem in the code?

    best regard

    selina

  • - Could you please elaborate what you are measuring? What is "wrong value"?
    - Why this line ?: RSSI = ~RSSI+1; //read RSSI
  • when i used this function: RSSI = Read8BitRssi();
    debug with IAR,RSSI = 0XC6,it not a correct value.because it has a very Close distance,the modules are normally.
    RSSI = ~RSSI+1; //read RSSI , this is Negative into positive.
    so what i can do next?
  • 0xC6, is this after you have converted to a positive value? Could you please provide a table before conversion to positive numbers in decimal? Note that for a system that uses IF the saturated RSSI value is -9 dBm.
  • hi,

    when two module distance is 20cm,the rssiConverted = (int8)rssi2compl - rssiOffset; (rssiConverted = 0x39);

    when two module distance is 10cm,the rssiConverted = (int8)rssi2compl - rssiOffset; (rssiConverted = 0x43);

    when two module distance is 5cm,the rssiConverted = (int8)rssi2compl - rssiOffset; (rssiConverted = 0x49);

    when two module distance is 5cm,the rssiConverted = (int8)rssi2compl - rssiOffset; (rssiConverted = 0x50);

     I had test this,the module no PA.

     the result is wrong,the RSSI all are positive value.

    what wrong with this ?

    best regard

    selina

  • I pasted the Read8BitRssi(void) from your post directly into the easylink example and called RSSI = Read8BitRssi(); after reading the Rx buffer. I get correct negative values. Could be that you read the RSSI the wrong place in the code, try append status and see if you get the same results here.
  • Have you used this code in you project: cc112xSpiWriteReg(CC112X_AGC_GAIN_ADJUST,&cc112xRssiOffset,1);When i removed thie code,and make rssiOffset =70; I found the RSSI value maybe correct.could you stick your code on this post or send to my email,that i can check what's wrong with my project.

    On the way, I don't find  this code cc112xSpiWriteReg(CC112X_AGC_GAIN_ADJUST,&cc112xRssiOffset,1)  in the swrc219c docment,so I remove it.

    if you found ,please tell me.

    thks.

    best regards

    selina

  • I have used AGC_GAIN_ADJUST=0.


    How do you know if the RSSI is correct or not? Have you done conducted tests with known signal strength?

  • I ueed IAR debug,when I make two module very nearly,the RSSI is -9DBM,and the distance is farther,the RSSI is smaller, so I think it is correct.
    could you try to test the AGC_GAIN_ADJUST=102 and tell me the result.
    best regards
    selina