Open Sinamajidi opened 3 months ago
Did you check that the power ($P = I * V
$) is sufficient? Most problems with PA/LNA modules are due to unstable or inadequate power supply, nothing the source code can fix.
FYI, if RF24::begin()
returns false then anything output by printDetails()
is useless because the SPI bus isn't working (which could also be a power problem).
@2bndy5
Well, I just connected it to my laptop USB port, which can supply 0.5A@5V, but I will test it with an adaptor. Thank you for mentioning that.
But here a question pops up: How can I know if the module has a problem physically, I mean, for example, the nRF IC is not working? Can I say the IC is working according to Serial monitor details or not? Bcz I have no idea about those details.
If its a power problem, then its a hardware problem. there's nothing the software can do to indicate this.
RF24::begin()
returns false when it fails to setup the radio using the SPI bus. printDetails()
uses the SPI bus to get information from the chip. There is a RF24::check_connection()
function, but it basically does the same thing RF24::begin()
does (with less repeated overhead): try to write then read the same value over SPI.
We have a section in the COMMON_ISSUES doc that talks about troubleshooting PA/LNA modules.
BTW, most ESP32 boards famously consume a lot of power. This often leaves little power left on the 3.3V bus for peripheral sensors (like external radios).
Its very common to use an adapter board that takes a dedicated 5V supply and regulates that into a stable 3.3V supply for PA/LNA radios. That's the only way I got mine to work during tests.
[!important] FYI, the ground wire needs to be shared between the MCU and an external power supply. Otherwise the 0V reference is inconsistent between different parts of the circuit and causes very strange behavior.
Thank you. I will use one to see whether the problem is solved.
@2bndy5
I used NRFLite library from the link below, and the problem has been solved for me. It looks like there are some problems with the nRF24 library.
What happened with the adapter board idea?
The only difference I see between RF24 and NRFLite is that NRFLite enables all TX features (dynamic payloads, ACK payloads, and allows NO_ACK flag) and puts the radio into active RX mode when the radio is initiated. There's some other limiting factors... That lib's SPI speed is hard coded to 4 MHz; it doesn't look like that can be changed to the radio's max 10 MHz.
@2bndy5
Maybe the SPI speed is a noticeable difference, but I don't know what the main cause is that my nrf module works well with that library and not this. I uploaded a sample program of both libraries to esp32 to check, but just nRFLite is working for me now.
ESP32 seems a bit finicky. I've recently had trouble init-ing the radio on a ESP32 board, but that was not using the Arduino framework (only the ESP-IDF support discussed in #925).
I delved into that lib's code, and I didn't see anything that looked different (behaviorally).
Maybe there is a problem with the init-ing, as you said with registers as an example or other parts, I don't know, but I suggest looking the different deeper, not just behaviorally.
About adapter idea that you just said Im still using laptop USB cable as main supply source and I'm not using any external regulator which is not appropriate setup, I know, it's still experimental, but with the same setup just that library has been worked well for me.
one interesting thing I noticed was that after I'm using a wrist ground band (I don't know its technical name), the packet loss ratio decreased a lot.
after I'm using a wrist ground band (I don't know its technical name), the packet loss ratio decreased a lot.
That's because laptops' power supply are usually not earth-grounded (due to use of a battery as primary power source). Your wrist is probably providing the path to earth ground. Some laptops' charging circuits might extend earth ground when plugged into the wall, but that feature wouldn't work if charging from a battery pack.
Yeah, you're right. I connected the wristband to the laptop USB port's ground as global ground in the modules and esp32, so I think it's okay.
About adapter idea that you just said Im still using laptop USB cable as main supply source and I'm not using any external regulator which is not appropriate setup, I know, it's still experimental, but with the same setup just that library has been worked well for me.
I would assume that the reason the other library works has to do with the configuration, not necessarily a problem with the RF24 library. This lib is designed for max performance by default, and I think you might have better luck with a better power supply.
The grounding problem leads me to believe that you have power supply issues also.
Have you seen our https://github.com/nRF24/RF24/blob/master/COMMON_ISSUES.md document? (Scroll down for the PA + LNA section)
I would suggest trying to apply the same settings/configuration in the RF24 library and see if that makes a difference.
RF24 radio(7, 8, 4000000);
radio.enableDynamicPayloads();
and experiment with the PA Level or LNA enable:
radio.setPALevel(RF24_PA_HIGH,0);
- to set PA to HIGH and disable the LNA.
This should get you working with the RF24 library in theory, but it is possible there is something different between the libraries that is causing this behaviour. I am curious to know whether it is a library issue or a settings issue, as I have never had a problem getting even bad clones like the SI24R1 to work with this library.
What radio module do you use?
nRF24L01 + PA/LNA
What driver board(s) do you use?
ESP32
If using Linux, what OS are you using?
No response
If using Linux, what RF24 driver did you select?
None
Describe your problem
I modified the Getting Started Example and attempted to send and receive one package using two different nRF24L01 + PA/LNA modules, one as the transmitter and the other as the receiver. However, I encountered an issue where no data was being sent or received, and the program seemed to get stuck after calling radio.begin(), which returned false for both modules. I thoroughly checked the wire connections, pins, and the program itself, but I couldn't find any problems. I suspect that the issue might be with the source code. Here is my code and the corresponding output from the serial monitor:
And here is the Serial Monitor Output: