Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] R24.h, testRPD(void) "Strong signal > 64dBm" : "Weak signal < 64dBm" #946

Closed
hrolofs opened this issue Feb 24, 2024 · 5 comments · Fixed by #948
Closed

[Question] R24.h, testRPD(void) "Strong signal > 64dBm" : "Weak signal < 64dBm" #946

hrolofs opened this issue Feb 24, 2024 · 5 comments · Fixed by #948

Comments

@hrolofs
Copy link

hrolofs commented Feb 24, 2024

Hi,

Just a question about the testRPD function. I am a little confused about the description of testRDP() in RF24.h

    /**
     * Test whether a signal (carrier or otherwise) greater than
     * or equal to -64dBm is present on the channel. Valid only
     * on nRF24L01P (+) hardware. On nRF24L01, use testCarrier().
     *
     * Useful to check for interference on the current channel and
     * channel hopping strategies.
     *
     * @code
     * bool goodSignal = radio.testRPD();
     * if(radio.available()){
     *    Serial.println(goodSignal ? "Strong signal > 64dBm" : "Weak signal < 64dBm" );
     *    radio.read(0,0);
     * }
     * @endcode
     * @return true if a signal less than or equal to -64dBm was detected,
     * false if not.
     */
    bool testRPD(void);

The mixing of positive and negative values confuses me. It would be easier if all values in this description were negative.

Please correct me if I am wrong.

-50dBm is better than -64dbm (-50 > -64)
-70dBm is worse than -64dBm (-70 < -64)
(all values are negative)

Shouldn't it then read:
Strong signal > -64dBm, Weak signal < -64dBm

This is also misleading for me.

     * Test whether a signal (carrier or otherwise) greater than
     * or equal to -64dBm is present on the channel.

     * @return true if a signal less than or equal to -64dBm was detected,

mixing "greater than or equal" and "less than or equal"

@2bndy5
Copy link
Member

2bndy5 commented Feb 24, 2024

Shouldn't it then read:
Strong signal > -64dBm, Weak signal < -64dBm

Yes, the example code should be updated. Although a "Weak signal" could also mean "no signal". We have no way of knowing given the nRF24L01's SPI intrerface.

     * @return true if a signal less than or equal to -64dBm was detected,
     * false if not.

This should read "greater than or equal" not "less than or equal".

(all values are negative)

This is not true for all radios that use the nRF24L01 chip. Certain manufacturers tweak the PA/LNA processing to achieve > 0 dBm (ebyte modules can get as high as +20dBm).

@TMRh20 TMRh20 self-assigned this Feb 24, 2024
@2bndy5
Copy link
Member

2bndy5 commented Feb 24, 2024

We have also found from using reverse engineering tactics (for sniffing packets from a non-nRF24L01 radios) that general listening can be more sensitive (> -80 dBm IIRC) than testRPD() reports.

The main discrepancy is that the RPD flag in the radio's registers was added for compliance testing mandated by government regulations. Meaning testRPD() satisfies the required carrier wave [hardware] tests, but it does not fully describe the actual performance during RX operation. We have a promiscuous-scanner branch to experiment with this (and improve the scanner examples).

TMRh20 added a commit that referenced this issue Feb 24, 2024
- Update the example code and return info for testRPD()
#946
@TMRh20
Copy link
Member

TMRh20 commented Feb 24, 2024

...a "Weak signal" could also mean "no signal". We have no way of knowing given the nRF24L01's SPI intrerface.

Hmm, I think one could call the available(); function immediately after calling testRPD(); or testCarrier();

        radio.startListening();
        delayMicroseconds(128);
        radio.stopListening();

        // Did we get a carrier?
        if (radio.testCarrier()) {
          ++values[i];
        }else
        if(radio.available()){
          ++weakValues[i];
        }

Not tested, but maybe it could work?

Incoming commit and PR, please verify I got it right this time lol. @2bndy5 @hrolofs

@TMRh20 TMRh20 mentioned this issue Feb 24, 2024
@TMRh20 TMRh20 linked a pull request Feb 24, 2024 that will close this issue
@2bndy5
Copy link
Member

2bndy5 commented Feb 24, 2024

I think it would work with a non-plus variant. The carrier wave test setup on non-plus variants was very much like sending a payload full of 0xFF with no ACKs.

@hrolofs
Copy link
Author

hrolofs commented Feb 24, 2024

Many thanks to everyone for the quick response to my questions and the fix in the documentation. :-)

TMRh20 added a commit that referenced this issue Feb 25, 2024
* Docs: testRPD
- Update the example code and return info for testRPD()
#946
* Docs: Tweak info output for testRPD()
---------
Co-authored-by: Brendan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants