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.

Increase/decrease CS threshold in CC1101

Other Parts Discussed in Thread: CC1101

Hi, I'm trying to implement a wake on radio schema. Basically I have two devices synchronized so, the receiving device knows the time slot where an incoming packet could arrive. In order to optimize the RX at the time of receiving slot, I'm trying to asses the CS state for noise and, only if the CS is detected the RX continues otherwise the radio is put to sleep.

In the same time I'm using CCA before TX. CCA and CS are closely related (in fact they negate each other) but for different use cases I need different thresholds. I'm using AGCCTRL2 and AGCCTRL1 registers to control the sensitivity. Before TX I need a different CCA noise sensitivity (lower) than before wake on radio (higher).

The question is related with the proper use of the mentioned registers. Can I change them whatever radio state is at that moment? Should be radio put to sleep before changing the values? Do I have to wait some time before the new values apply?

Thanks,

Dragos

  • When doing normal RX (i.e not CCA) you should use the AGCCTRL2.MAX_DVGA_GAIN, AGCCTRL2.MAX_LNA_GAIN and AGCCTRL2.MAGN_TARGET valus you get from SmartRF Studio. This gives the best RX performance in terms of sensitivity and blocking

    If you want to reduce the CS level when doing CCA you should do the following:
    1) Use AGCCTRL2 settings from Studio and change the CS threshold through AGCCTRL1. CARRIER_SENSE_ABS_THR. Threshold can be changed by up to +/-7 dB
    2) If the above is not sufficient you can change AGCCTRL2.MAX_LNA_GAIN (or AGCCTRL2.MAX_DVGA_GAIN) to derive at the desired CS threshold. Note: if you do this, make sure to set the gain settings back to recommended values when doing normal RX. Table 32 and 33 in the CC1101 data sheet gives you an idea about the CS threshold for vs gain settings for 2 values of MAGN_TARGET (33 dB and 42 dB respectively).
  • Thanks for your reply.

    The thing is that I don't enter and maintain RX normally, in my implementation maintaining RX is always preceded by a CS evaluation. From my experiments if I have the standard GAIN settings given by SmartRF I never receive packets with RSSI less than ~ -98db which is less than -104db (the minimum value given by CC1101 datasheet where the maximum error rate is less than 1% for 38400bps). 

    This is the reason I tried to decrease the threshold before CS evaluation (and subsequently before the whole RX process). The results where promising at first (I frequently received successfully packets with -104--107 db, please note that my system is often exposed to situations where the signal is brutally affected by objects in between) but when I checked my statistics after running the system for days it looks like the overall situation is worse.

    I'm trying to understand why the situation is worse and how could I improve the system in order to be able to receive packets even with -104db RSSI.

    Best regards,

    Dragos

  • Dragos,

    I assume AGCCTRL2.MAX_DVGA_GAIN = 1 in you testing (this is what you get from Studio @38.4 kbps). Setting AGCCTRL2.MAX_DVGA_GAIN = 0 and AGCCTRL1. CARRIER_SENSE_ABS_THR = 9 should lower the CS threshold.
  • /*
    * Increase CS detection sensitivity
    */
    MRFI_WriteReg(AGCCTRL2, 0x03);
    MRFI_WriteReg(AGCCTRL1, 0x4c);
    AGCCTRL2.MAX_DVA_GAIN=0
    AGCCTRL1. CARRIER_SENSE_ABS_THR = 0x0c

    /*
    * Revert sensitivity to normal
    */
    MRFI_WriteReg(AGCCTRL2, 0x43);
    MRFI_WriteReg(AGCCTRL1, 0x40);

    AGCCTRL2.MAX_DVA_GAIN = 1
    AGCCTRL1. CARRIER_SENSE_ABS_THR = 0x00

    This indeed seems to work well, meaning that I can receive packets with very low RSSI. Overall, I can't figure out why, the system is not working better than with normal sensitivity values.

    The only answer I would like to have is if I can play with sensitivity without taking into account the current radio status. Is it OK to change the values during RX?

    Thanks,
    Dragos
  • The gain values should not be changed during RX.

    Just to make sure, please confirm that MDMCFG2.SYNC_MODE = 7 in your testing (i.e. sync word detection is gated by CS).

    Both the settings in you post should give the same sensitivity limit if the CS threshold is at or below -104 dBm. Thus, as long as the CS threshold does not limit the sensitivity level you simply use the "CS detection" settings and there is no need to switch to "normal" settings.

    I am somewhat confused by your statement " I can't figure out why, the system is not working better than with normal sensitivity values".
    Question: Using "CS detection" settings, is the sensitivity the same, and close to -104 dBm, when you gate with CS and when CS gating is disabled MDMCFG2.SYNC_MODE = 3?
  • I always have MDMCFG2.SYNC_MODE = 3 in my settings.

    I'm trying to minimize the energy consumption during RX by first checking if the cs is asserted, than check if the SYNC word is received. I have timeout values for each of these two events, if timeout the RX is stopped early. I put some code below it could give you a clue about what I'm trying to achieve.

    ---> these two lines alter the functionality. If exists, I can receive with -104, - 107dBm, if not - only -94, -98 dBm
    MRFI_WriteReg(AGCCTRL2, 0x03);
    MRFI_WriteReg(AGCCTRL1, 0x4c);
    <----
    BSP_StartMeasuringTime();
    MRFI_WakeUp();
    MRFI_RxOn();
    while (!csDetected && csDetectTime < CS_WAIT_TIME_US) {
    csDetectTime += BSP_GetLapsedTimeAndReset();
    csDetected = MRFI_IsCsAsserted();
    }
    BSP_StopMeasuringTime();

    if (csDetected) {
    bool syncWordReached = false;
    BSP_StartMeasuringTime();
    while (!pktReceived && !trailChanged(isCsReached())
    && noiseDetectTime <= MAX_PKT_SND_TIME_US) {
    if (syncWordReached) {
    pktReceived = pktCount != ism_getRxPktCount();
    } else {
    syncWordReached = MRFI_IsSyncWordStatusAsserted();
    if (syncWordReached) {
    noiseDetectTime = 0;
    }
    }
    noiseDetectTime += BSP_GetLapsedTimeAndReset();
    }
    BSP_StopMeasuringTime();
    if (syncWordReached) {
    ...
    } else {
    RX_OFF
    }
    /*
    * Revert sensitivity to normal
    */
    MRFI_WriteReg(AGCCTRL2, 0x43);
    MRFI_WriteReg(AGCCTRL1, 0x40);
  • Preceding sync search by CS is good design practice to minimize current consumption. However, there is no need to do the CS check in SW as this can be handled automatically by the chip itself by setting MDMCFG2.SYNC_MODE = 7. Use AGCCTRL2 = 0x3 and set CARRIER_SENSE_ABS_THR = 9 (or whatever value that ensures you will receive at -104 dBm). To find the proper value of CARRIER_SENSE_ABS_THR you use a signal generator as input source and monitor the CS flag on one of the GDO pins as the input power level is increased.