nRF24 / RF24Mesh

OSI Layer 7 Mesh Networking for RF24Network & nrf24L01+ & nrf52x devices
http://nrf24.github.io/RF24Mesh
GNU General Public License v2.0
422 stars 153 forks source link

RF24Mesh master-base node communication delay #105

Closed somnathbm closed 4 years ago

somnathbm commented 7 years ago

I'm trying to build a mesh network using 4 nRF24L01 modules directly connected with Arduino Uno where 1 module is master node and the rest are base nodes.

The workflow is exactly as follows

I'm sending a command in the Arduino IDE serial monitor. The master node receives this command and send it to other base nodes. There's no problem receiving the command on the base node side (from master node) as well as sending the command on the master node side (to base nodes). Upon receiving the command from the master node, base nodes successfully able to read the command and send the response. No problem at all.

But when the master node receives the response status from the base node(s), there's the problem. Master node is not receiving the data immediately. I have to send the command from the Arduino serial monitor repeatedly and on the 10th time, the master node is able to read the response status from the base node(s). Exactly on the 10th times every time.

Here's the link of the Arduino Stackexchange question thread.

http://arduino.stackexchange.com/questions/31964/rf24mesh-master-base-node-communication-delay

TMRh20 commented 7 years ago

RF24NetworkHeader header(mesh.addrList[j].address, OCT); This line on master might be the problem. Try replacing OCT with a 1 so master sends unacknowledged payload. Always a good idea if nodes are responding to requests, since ack is not necessary. (Node response is effectively an ack)

somnathbm commented 7 years ago

@TMRh20 - I have changed the OCT to 1, as you just suggested. But the problem is still there.

TMRh20 commented 7 years ago

Ok I'll prob have to test to see. It might take me some time.

somnathbm commented 7 years ago

@TMRh20 - Yeah that's fine.

I'm sending the command 100% or 0% in the Arduino serial monitor. If I send 100%, base node sends back response 1 and 0 if I send 0%. There's no problem in the base node(s). But master node always getting 1. I don't know where this 1 comes from. Master should get the value that the base is sending i.e. 1 or 0 respectively.

P.S. : This is happening from the beginning, even before the change from OCT to 1.

janLo commented 7 years ago

I have a similar issue. I use the examples RF24Mesh_Example_Master_To_Nodes.ino and RF24Mesh_Example.ino for debugging and on the master after every sent packet the first N packets cannot be received. I spend two nights debugging and finally got a working solution without exact knowledge what I'm doing. My observation was, that the master was always broken after he sent a packet. So I concentrated myself on the switch between sending and receiving.

I got the best result (error almost completely gone) by adding a delay(1) before radio.startListen() at https://github.com/TMRh20/RF24Network/blob/master/RF24Network.cpp#L963.

I'm not exactly sure, what this changes, I guess, its some timing issue on the RF24. I'm also aware, that a delay is not a sufficient solution but maybe its a direction to debug into. My modules are bzw these: https://www.amazon.de/gp/product/B00XSYION0/ref=oh_aui_search_detailpage?ie=UTF8&psc=1

janLo commented 7 years ago

PS: I use two Arduino Nano boards. @somnathbm , can you test, if this delay fixes your issue as well?

Avamander commented 7 years ago

FYI I had problems like these with some fake modules. I gave up and bought new ones.

ricgyver commented 7 years ago

I have the same problem. The nodes can send messages to the master without any issue but the master is not able to write to the nodes any message. unfortunately the delay(1) suggested does not work for my configuration... Any suggestion?

Avamander commented 7 years ago

Does it hang? Do the messages get sent? More information would be incredibly more helpful.

ricgyver commented 7 years ago

The message is correctly received by the node, but on the master the result of mesh write is false. It doesn't hang.

Il 31 dicembre 2016 17:20:16 CET, Avamander notifications@github.com ha scritto:

Does it hang? Do the messages get sent? More information would be incredibly more helpful.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/TMRh20/RF24Mesh/issues/105#issuecomment-269871779

-- Inviato dal mio dispositivo Android con K-9 Mail. Perdonate la brevità.

Avamander commented 7 years ago

You can implement custom check to verify that the message is received by replying with something. It would take quite a bit of code more to do that transparently and for most that is not an issue.

ricgyver commented 7 years ago

Yes it is possible. But it's a strange behavior since in previous releases this issue was not present at all...

ricgyver commented 7 years ago

Ok I found that by using the latest MASTER version (not the last official release) things are better. There are still missing packets but not so much. However I cannot setup 250kbps as data rate, useful to achieve longer distances. I'm forced to use 1MBPS.

mamama1 commented 7 years ago

not being able to use 250kbps usually means counterfeits or not the + version of the NRF24L01.

ricgyver commented 7 years ago

With the same modules I was able to send messages correctly even @ 250kbps... But something changed with latest releases of RF24, RF24Network and RF24Mesh I think...

On 01/15/2017 01:33 AM, mamama1 wrote:

not being able to use 250kbps usually means counterfeits or not the + version of the NRF24L01.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TMRh20/RF24Mesh/issues/105#issuecomment-272664421, or mute the thread https://github.com/notifications/unsubscribe-auth/ANYPkYvS5Zyjpe2CreBsGHkwlftIHX5Fks5rSWlMgaJpZM4LFFsu.

Avamander commented 7 years ago

Clones indeed have trouble with ACK (for ex. their ACK bit is flipped so that clone+original don't work together), that might be why it isn't that stable.