Comments (11)
This bugs me. Why? Because users shouldn't have to use special measure to make this work.
I recreated the issue between a Nano and a Due, then just added a simple delay call. Now it works.
I added delay(1)
just before this line
I believe that the constant SPI polling via available is hindering the radio's attempts at handling the ACKS, Data, and switching between RX/TX. Lots of stuff going on internally.
@pfpp89 Please test this out if you can.
while (!radio.available()) { // wait for response
if (millis() - start_timeout > 200){ // only wait 200 ms
break;
}
delayMicroseconds(200);
}
from rf24.
Hello
First of all, thank you very much for your confirmation that the sample is working fine, and for your suggestions. I only had little doubt about the sample, but I decided to confirm it anyway. According to my research, this sample does not seem to be the most used, and there seems to be a surprisingly small amount of people that used it as a basis for their projects and shared information about it online.
Due to the time-criticality mentioned by @2bndy5, I am decided to build a proper adaptor to interface the nRF24L01 and the Arduino, and have it built from something like PCBWay. This order may, however, take some time.
I will also consider a cap (something on the range 10uF to 100uF?) between VCC and GND mentioned almost everywhere, as close as possible to the module.
As for the missing cap on the antenna, also mentioned by @2bndy5, my module is somewhat different from the one on the image from the ITEAD website. However, the cap seems to also be missing from mine (image below).
I admit I disregarded this information because it mainly pertains PA+LNA versions (which I'm not using here), and touching mine doesn’t seem to help in any way. I will also save this tip for last, since these are microscopic components, and I honestly do not have the material nor the skill to handle them properly.
Thank you very much for your help!
PFPP
from rf24.
Hello again!
Ok, my PCBs arrived today from JLCPCB, and I couldn’t wait to make a quick test. There is indeed a huge improvement., thanks a lot @2bndy5!
The sample does not yet work 100%, but the message round-trip is complete, the TX node receives the response correctly and is very consistent.
My only remaining issue, which is persistently gnawing at my inner perfectionist, is the “Response failed” written systematically by the RX side, as shown on the following picture:
Reading the code, the issue seems to come from the txStandBy which, for some reason, keeps sending false:
radio.writeFast(&payload, sizeof(payload)); // load response to TX FIFO
bool report = radio.txStandBy(150); // keep retrying for 150 ms
According to the documentation, it should send false if a payload has been sent by the RX but not acknowledged with an ACK packet by the TX. It also states that it can only be reported if the auto-ack feature is on, which, to my understanding is the case since we never call “setAutoAck(false)” on this sample, and it is enabled by default.
I show below the diagram I hastily designed last Sunday, and a preview of the PCB, in the case you think the issue may still related with the setup\hardware (and I am sorry if the board is not perfect, I am absolutely not an electronics\PCB design expert in any way).
The cap I settled with is 100uF electrolytic (without which almost every message fails).
Thank you very much for your help!
PFPP
from rf24.
We should probably add a comment to explain why the delayMicroseconds()
is needed.
while (!radio.available()) { // wait for response
if (millis() - start_timeout > 200){ // only wait 200 ms
break;
}
delayMicroseconds(200); // relax probing of available()
}
Honestly, I hadn't thought to tweak the TX side. Probably better to use the IRQ pin (+ radio.maskIrq()
) instead of radio.available()
for this problem.
from rf24.
Hello!
@pfpp89 Please test this out if you can.
while (!radio.available()) { // wait for response if (millis() - start_timeout > 200){ // only wait 200 ms break; } delayMicroseconds(200); }
Thank you very much for the tip @TMRh20, I tested it as soon as I could, and it works like a charm!
See for yourself. Same setup as yesterday, no more “Response failed.” from the TX node:
![Success](https://private-user-images.githubusercontent.com/12188458/309371189-187aec7c-e874-42b7-b82b-c82d32b856a5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTE2ODY0MDMsIm5iZiI6MTcxMTY4NjEwMywicGF0aCI6Ii8xMjE4ODQ1OC8zMDkzNzExODktMTg3YWVjN2MtZTg3NC00MmI3LWI4MmItYzgyZDMyYjg1NmE1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzI5VDA0MjE0M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNjYTQyYWQ3ZjgxZGZlY2Y1NzIxMzYzYzI1ZTJkOTNkMDU3MWMzYWE4OTg1ZGJjZGIzZjAwOWQxMTZiZjkzYmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ew0EyvfNIm9omSVt_N5kToen60k5KAyqrs5bXVZM1hM)
Also a big thanks to @2bndy5 for the first tips related to my initial hardware setup, which were definitely the cause of my original problem.
One last question @TMRh20: I noticed you changed the issue state to “bug”. Should I leave the issue open for now, even if I consider my issue solved (not using the “close with comment”)? Or do you wish me to close it?
Again, thanks a lot for your help, I can finally continue my project!
PFPP
from rf24.
The examples are generally well tested, especially on AVR devices.
Since you've tried multiple radios, I would suggest reading the common issues doc
a: Try using a capacitor connected to the GND and VCC pins
b: Try calling radio.setPALevel(RF24_PA_MIN,0);
This is likely not a problem with the library but a hardware or power supply related issue, so not much we can do. This type of question would typically go in an Arduino or other such forum.
from rf24.
The example is very time-critical. In testing it on my hardware (typically on ATSAMD21 or some other cortex processor or RPi) with known good non-PA/LNA radios, I never really got a 100% success rate (more like ~98%).
After playing with the example's code and TMRh20 reporting 100% on ATMega328p, I just left it as it is now.
Using auto-ACKs with ACK payloads is preferable to me since I don't have to deal with rewriting built-in functionality (like manual-ACKs). But, bad clones (like Si24R1) do present problems with auto-ACK.
from rf24.
From ITEAD site:
- Voltage: 3-3.6V (recommended 3.3V) V
- Maximum output power: +20dBm
- Emission mode current(peak): 115mA
- Receive Mode Current(peak): 45mA
- Power-down mode current: 4.2uA
The Max PA output seems inaccurate for radio's with builtin antennas (and the given peak emission current)... I can see from the pictures that they also skipped putting a capacitor by the antenna.
This means it would probably work better when you touch it with your finger (a problem also noted in the COMMON_ISSUES doc), in which case a suitable capacitor should be the answer.
from rf24.
I will also consider a cap (something on the range 10uF to 100uF?)
Maybe try both in parallel. We can't say for certain what values would work since it highly depends on how the module is manufactured. IIRC, the COMMON_ISSUES doc blindly recommends 100uF.
touching mine doesn’t seem to help in any way
Thanks for reporting. You shouldn't need to monkey with SMD caps yourself; just play with various capacitance on the VCC & GND lines.
PA_LEVEL, which doesn’t seem to change anything
Yeah, lowering the PA level is a software hack that is supposed to reduce the required current needed to transmit (including auto-ack packets). This is really beneficial for PA/LNA modules, but we have seen it occasionally help avoid an unstable power supply for non-PA/LNA modules.
from rf24.
bool report = radio.txStandBy(150);
This is the line I usually have to tweak. Remember when I said the example is very time critical? Now, you know why. Try playing with a higher value, like 200 instead of 150.
from rf24.
from rf24.
Related Issues (20)
- namespace for utility drivers HOT 3
- Multiple I2C buses In ESP 32 with multiple ports
- ESP32 and two Infrared Temperature Sensors (MLX90614) HOT 1
- Calling radio.available() after failed transmission when using writeFast or startWrite causes interrupt loop HOT 10
- 'make' errors, and RF24 on RPi, aarch64-linux-gnu HOT 18
- [Question] NRF24 Transmitter get "stuck" when powered from wall power outlet HOT 2
- RPi5 uses different gpio pin numbers (per Linux kernel update) HOT 48
- Radio.printDetails(); does nothing for MKR1010 but Radio.sprintfPrettyDetails(buffer); works fine???? HOT 4
- Pipe is sometimes returned at "255". HOT 15
- Is there a known ESP32 Deep Sleep issue with radio.powerDown()? [Question] HOT 19
- Can RF24 library be used with WiFi? HOT 2
- Can RF24 library be used with WiFi? HOT 4
- [Question] setChannel & setDataRate not read correctly by printPrettyDetails ? HOT 4
- ESP32 Core Panic on radio 0; No panic on Radio number 1, same wiring. How to troubleshoot?[Question] HOT 22
- Use Linux kernel's character device API to implement IRQ capability HOT 113
- [Question] R24.h, testRPD(void) "Strong signal > 64dBm" : "Weak signal < 64dBm" HOT 5
- Multiple senders one receiver HOT 1
- reorganize examples HOT 5
- revise MRAA driver's GPIO
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rf24.