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.

CC2538: CC2592: Understanding the effects of high-gain mode on RSSI and CCA thresholds?

Part Number: CC2538
Other Parts Discussed in Thread: CC2592, Z-STACK, CC2591

Hi all,

So, my workplace has come up with a design that is based around a CC2538+CC2592 combination chipset for wireless communications, running the OpenThread stack, and for the most part it works reasonably well.  However, at a few sites we've suffered issues where a node has been seemingly "jammed", prevented from transmission, and we're wondering if maybe, it's a clear channel assessment related issue.

Our radio driver is more-or-less the standard OpenThread CC2538 driver: I actually contributed a lot of the CC2592 integration work upstream.

Reading the user manual for the CC2538, I see the CCA threshold is set in RFCORE_XREG_CCACTRL0; the least significant 8-bits is a signed integer representing the CCA threshold in dBm; with an offset of 73dBm applied.  It also later on discusses RSSI as having the same 73dBm offset.

The CC2538 datasheet talks about the power-on reset being inappropriate and suggesting a value of 0xf8 (which oddly enough, matches the "reset value" documented on that very page) which equates to around -81dBm.  This is 7dB above the supposed -88dBm receiver sensitivity described in the CC2538 datasheet.  I guess there needs to be some margin, but why 7dB margin?

On the CC2592 datasheet, it discusses the relative gain achieved with different HGM settings; nominally 11dB if turned on or 6dB if turned off.  In our application we're running from a fairly stable regulated power supply, and the temperature won't be changing wildly from typical room temperature, but we could be almost anywhere on the 2.4GHz band, so the ±2dB gain variation by frequency needs to be considered.  Apparently that variation assumes HGM=1, so 11dB gain could in fact be between 9dB and 13dB.  I'm not sure how the CC2592 behaves in this regard with HGM=0.

Now, AN130 (SWRA447) talks about how to get the CC2538 to play nice with a CC2592.  In it, it discusses the effect the LNA has on the RSSI values: if high-gain mode is enabled, the offset changes to 85dBm, whereas with it turned off, the value should be 81dBm.  I took care of that in this commit.

There's no discussion in this document about how CCA thresholds should be adjusted. if at all.  I've tried fiddling with some numbers with pen and paper, but gotten nowhere.

According to AN130, the CC2592 can add anywhere between 9dB and 13dB of gain, depending on frequency, voltage and ambient temperature.  Sensitivity apparently gets down to -99dBm (so ~11dB improvement on a "barefoot" CC2538) with high-gain mode off, or down to -101dBm (~13dBm improvement; the "best case").  I can see where the -101dBm (HGM=1) figure comes from, but not the -99dBm (HGM=0) figure.  From where I sit, there's a few possible options:

  1. I could just reduce the thresholds by 13dB when HGM=1 or 6dB(?) when HGM=0… so -8 (0xf8) becomes -21 (0xeb) when HGM=1 or -14 (0xf2) with HGM=0
  2. I could apply the offsets used with RSSI to the CCA thresholds and leave the "sensitivity" where it is; so -81 + 85 = 4 (0x04) with HGM=1 or -81 + 81 = 0 (0x00) with HGM=0
  3. I could just substitute the -81dBm sensitivity with the value from AN130; so -101 + 73 = -28 (0xe4) for HGM=1 or -99 + 73 = -26 (0xe6) with HGM=0

Or do combinations of the three above.  Question is, what is the correct approach here?  Or are we barking up the wrong tree and should be looking elsewhere for our comms issues?

  • Hi Stuart,

    Although you are not using this solution, Z-Stack 3.0.2 has a CC2538 + CC2592 solution applied when using the HAL_PA_LNA_CC2592 pre-define.  This sets the CCACTRL0 to a value of CCA_THR_HGM = 0x03 and furthermore assigns macRadioDefsRssiAdj values so I would recommend that you review the mac_rffrontend.c of this solution.

    You can also review the CSMA mechanism from the MAC PIB.  The maxCsmaBackoffs, minBe, and maxBe are values you could consider modifying.  Otherwise, "jammed" devices should be able to recover once the channel becomes less noisy.  Do you ever observe this happening and are you able to debug a faulty device?  It may be possible that a memory leak or corruption is causing the lockup issue.

    Regards,
    Ryan

  • Well, I'd look, but my understanding is that Z-Stack is restricted under a non-disclosure agreement so I'm legally not allowed to look at it, and as I work on wireless communications protocols outside of my work, I cannot afford the legal taint of doing so.

    How is the value of 0x03 arrived at?  Is this value dependent on the state of the HGM pin?

    As for memory issues, I have a task to put some code in that monitors the _sbrk pointer and the stack pointer to see how deep things are getting.  (Might have to do the stack pointer read from a timer interrupt, but that shouldn't be difficult.)  Memory corruption issues have not been ruled out, but then again, I'd expect to see the problem as being more widespread if it was a memory corruption issue.

  • The above are my hand-written notes trying to figure this out… I don't see where they get the figure 0x03 from.  Altering offsets suggests 0x04, why 0x03?  Is it still 0x03 if I turn high-gain mode off?

  • Z-Stack 3.0.2 is offered free to download and does not require an NDA.  The comments in the code are as such:

    /* CC2538-CC2591 has 6db gain whereas CC2538-CC2592 has 3db. Choosing the lower value for threshold */
    #define CCA_THR_HGM                   0x03UL   /* 3-76=-73dBm when CC2538 operated with CC2592 in HGM */

    Granted this is not a great description, however I also do not think that small variations of this value would account for larger CCA issues in the field.  Have you used SmartRF Studio to evaluate the performance of your modules?

    Regards,
    Ryan

  • Hi Ryan, many thanks for responding.

    I haven't tried SmartRF Studio as it doesn't work on my computer (it requires the legacy Microsoft Windows operating system).

    That said, your snippet there gives me a further hint: the CC2591 which is a different LNA/PA combo chip.  "Choosing the lower value for threshold" being the key here… the values used in Z-Stack clearly are not derived from the CC2592, but rather the CC2591.  Looking at the data sheets for both, they seem to have similar characteristics (11dB typical gain in high-gain mode, CC2592 with HGM off has more gain though: 6dB vs 1dB; variation is about the same in both).

    The figure -76 is a mystery though.  Quoting the CC2538 user guide (SWRU319C):

    This register should be updated to 0xF8, which translates to an
    input level of about -8 - 73 = -81 dBm.

    -8 is the signed integer value to be written to CCA_THR (0xf8 in two's compliment).  If I'm reading the datasheets correctly and taking the -73dBm value as "gospel" for a moment (no idea where this number comes from, there's 8dB difference between the two), we should be using a value of 0x00 not 0x03.

    There's some puzzle piece I'm not seeing at the moment for me to get the full picture.

  • Hi Stuart,

    Smart RF Studio 7 is supported in Windows 10.  Have you been able to evaluate the effectiveness of different values in your system?  Have you proven that this is the root cause of your devices being jammed?

    Regards,
    Ryan

  • I haven't tried changing any settings yet, as I want to try and understand the maths behind why the values are being chosen.  Each time we change a setting in this department, we have to roll out a release as unfortunately we aren't able to duplicate the issue in lab conditions.  Hence my hesitation of just blindly going in there and fiddling numbers with no understanding of what they're doing, the wrong values could well prevent me from rolling out further OTA updates and require a site visit.

    There's talk of one of my colleagues who does run the legacy Windows 10 operating system maybe having a look with SmartRF Studio, but as stated before, it "doesn't work on my computer".  My computer doesn't run Windows 10, never  has, never will, and the things I do day-to-day preclude me from using an OS that still can't decide if it's going to be CP/M or VMS.

  • So, the numbers out of SmartRF Studio…

      {CC2538_CCACTRL0,         0xF8},
      {CC2538_CCACTRL1,         0x1A},

    That looks awfully like the values we've been putting in all along.