nRF24 / RF24Network

OSI Layer 3 Networking for nRF24L01(+) and nRF52x on Arduino and Raspberry Pi
https://nrf24.github.io/RF24Network/
GNU General Public License v2.0
353 stars 163 forks source link

NRF24 network node communication issue #197

Closed OTeknoloji closed 1 year ago

OTeknoloji commented 1 year ago

Hello everyone,

I am trying to do a project with NRF24. But somehow I can't receive data from all nodes. I have my main controller at level 0, a hub at level 1 and two devices at level 2. I am receiving and sending data from device 1, but the device cannot receive data at once. I would be glad if you help.

The codes are as follows:

Node_00.txt

Node_01.txt

Node_011.txt

Node_021.txt

2bndy5 commented 1 year ago

but the device cannot receive data at once

Which device cannot receive?

BTW, the nRF24L01 cannot simultaneously receive and send data. Furthermore, it cannot receive multiple payloads simultaneously either; it has to receive payloads individually (one after another).

2bndy5 commented 1 year ago

Just to be clear, the network level is related to the number of octal digits in the address, not the value of the octal digits in the address. So, for the nodes you describe, you would have a topology like so: graph0

OTeknoloji commented 1 year ago

Hi,

device 021. I do as this topology. https://nrf24.github.io/RF24Network/md_docs_tuning.html

I have two problems. One of them is that I get one node values at same time. Second whatt does it mean this code

define EXTERNAL_DATA_MAX_SIZE MAX_PAYLOAD_SIZE

2bndy5 commented 1 year ago

I fixed my graph in my previous comment. I just noticed you didn't upload a code sample for node 02.

I get one node values at same time

I don't know what you mean.

Second whatt does it mean this code

define EXTERNAL_DATA_MAX_SIZE MAX_PAYLOAD_SIZE

That's not really library code. I'm guessing you are referring to the RX priority example: https://github.com/nRF24/RF24Network/blob/b8324b3cbd7bcbec307b3a13b7c7d9cf0f13e981/examples/Network_Priority_RX/Network_Priority_RX.ino#L67-L73

OTeknoloji commented 1 year ago

yeah I am refering to RX priority. that is, when I run two devices at the same time, I can't get data from both. but if I run 011 or 021 one by one, I can get the data from one device. I don't think there is a problem with aders. I can't use it at the same time for another reason I don't know.

OTeknoloji commented 1 year ago

BTW, the nRF24L01 cannot simultaneously receive and send data. Furthermore, it cannot receive multiple payloads simultaneously either; it has to receive payloads individually (one after another).

this is exactly what i want to do how can i do this

2bndy5 commented 1 year ago

In your code for node 021 you use RF24Network::read(), but you tell it to fetch a maximum of 0 bytes.

  if (network.available()) {
    RF24NetworkHeader header;
    network.read(header, &dataBuffer, 0); // dataBuffer remains unchanged
  }

The lib is coded to retry for a number of milliseconds if sending fails. That is how sending data from many nodes to 1 node is handled. I think your code just needs to relax a little between transmissions. Without a deliberate delay between sending, a single node can be continuously spamming the network and end up occupying the network while others are trying to send data.

OTeknoloji commented 1 year ago

ok how can do this so min relax to transmissions

2bndy5 commented 1 year ago

This is done in the RX Priority example using a set interval of milliseconds: https://github.com/nRF24/RF24Network/blob/b8324b3cbd7bcbec307b3a13b7c7d9cf0f13e981/examples/Network_Priority_RX/Network_Priority_RX.ino#L109-L110

OTeknoloji commented 1 year ago

ok thank you so much for your helping I will try

OTeknoloji commented 1 year ago

Hi I tried but it is not working do you have any different idea?