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

Add support to set nRF24l01 LNA gain #1392

Open
BLLuis opened this issue Jan 17, 2025 · 2 comments
Open

Add support to set nRF24l01 LNA gain #1392

BLLuis opened this issue Jan 17, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@BLLuis
Copy link

BLLuis commented Jan 17, 2025

Implementing a channel scanner and due to the lack of nRF24l01 signal meter I turn off the LNA to reduce in 1.5 db signal sensitivity getting at least 3 levels for signal strength.
The library don't have a function to set LNA or sensitivity so I'm using RADIOLIB_GODMODE and RADIOLIB_LOW_LEVEL to have acces to Module pointer using getMod and writting to nRF24 to change this setting.

These are some lines of my code as example:

`

#define RADIOLIB_NRF24_RF_LNA_OFF                           0b00000000  //  0     0   LNA gain: Off
#define RADIOLIB_NRF24_RF_LNA_ON                            0b00000001  //  0     0             On

/*
getMod is available defining

#define RADIOLIB_GODMODE    (1)
#define RADIOLIB_LOW_LEVEL  (1)

in component/src/BuildOptUser.h file
*/

Module * pModuleRadio0 = m_pRadio0->getMod();
radioState = pModuleRadio0->SPIsetRegValue(RADIOLIB_NRF24_REG_RF_SETUP, RADIOLIB_NRF24_RF_LNA_ON, 0, 0);

`

This is good not only to reduce sensitivity but also to reduce current consumption in 0.8ma, my code is not tested on a real device yet.
Wish to see this in the library to avoid using God mode.

@jgromes
Copy link
Owner

jgromes commented Jan 18, 2025

I'm not against adding this; the API can be quite simple, int16_t nRF24::setLNA(bool enable);. Once this is tested on real hardware, feel free to open a PR adding this - thanks!

@jgromes jgromes added the enhancement New feature or request label Jan 18, 2025
@BLLuis
Copy link
Author

BLLuis commented Jan 19, 2025

Tested on two radios, can't measure current consumption due to my limited hardware at the moment, but got changes counting channels with carrier.

`I (4485) main: Test LNA

I (4485) main: Testing LNA consumption
I (4485) main: LNA Off
I (9495) main: LNA On
I (14495) main: LNA Off
I (19495) main: LNA On

I (24495) main: Testing LNA gain
I (49495) main: R0 Ch count with LNA:4 No LNA:0
I (49495) main: R1 Ch count with LNA:5 No LNA:2
`

Will do a PR soon to add this function.
Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants