Help needed on Rf24Network Library

I am trying to use standard examples provided in RF24Network library.

  1. Have a Arduino UNO connected to NRF24L01 Module. (TX)
  2. and I have 4 Arduino Mega 2560 boards connected to NRF24L01 each. (RX)

I am trying to send transmit data to all 4 nodes in a loop, but only 3 of them are successfully receiving the data and 4th node always fails.

/******MY TX CODE *********/

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>

const uint16_t BASENODEADDRESS = 00;
const uint16_t NODEADDRESS[] = {01,02,03,04};
const char *TXSTRING[] = {"Hello to 01 from BASE","Hello to 02 from BASE","Hello to 03 from BASE","Hello to 04 from BASE"};
int CHILDNODES = 4;


char ACKSTRING[32]="";

RF24 radio(7,8); 
RF24Network network(radio);  


void setup() {
  Serial.begin(9600);
  SPI.begin();
  radio.begin();
  network.begin(90, BASENODEADDRESS);

}

void loop() {

 network.update();   
  
  // put your main code here, to run repeatedly:
 for (int i=0; i < CHILDNODES ; i++ )

  {
   Serial.println("++++++++++++++++++++++++++++++++");
   Serial.print("SENDING TO : 0");
   Serial.println(NODEADDRESS[i],OCT);
   Serial.println("++++++++++++++++++++++++++++++++");
   RF24NetworkHeader header(NODEADDRESS[i]);
   bool SENDOK = network.write(header,&TXSTRING[i],sizeof(TXSTRING[i]));
    if(SENDOK)
    {
      Serial.print("Sent to: 0");
      Serial.println(NODEADDRESS[i],OCT);
      bool RECOK = network.read(header,&ACKSTRING,sizeof(ACKSTRING));
      if(RECOK)
      {
        Serial.print("ACK RECEIVED from : 0");
        Serial.println(NODEADDRESS[i],OCT);
        Serial.println(ACKSTRING);
        Serial.println("++++++++++++++++++++++++++++++++\n\n\n\n\n\n\n");
      }
      else
        Serial.println("NO ACK RECEIVED");
    }

    else
      Serial.println("Sending Failed.");
   
   delay(5000);
    
  }


}

/********* MY RX CODE **********/

#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>


RF24 radio(30,31);                // nRF24L01(+) radio attached using Getting Started board 

RF24Network network(radio);      // Network uses that radio
const uint16_t MYADDRESS = 04;    // Address of our node in Octal format ( 04,031, etc)

// I AM USING 01,02,03 and 04 as node addresses

const uint16_t BASENODEADDRESS = 00;   // Address of the other node in Octal format




char RECStr[32] = "";
char ACKStr[15] = "Hey from: 04";

void setup(void)
{
  Serial.begin(9600); 
  SPI.begin();
  radio.begin();
  network.begin(90, MYADDRESS);
}

void loop(void){
  
  network.update();                  // Check the network regularly

  
  while ( network.available() ) {     // Is there anything ready for us?
    
    RF24NetworkHeader header;        // If so, grab it and print it out
    RF24NetworkHeader header2(BASENODEADDRESS);  
    payload_t payload;
    bool ok = network.read(header,&RECStr,sizeof(RECStr));
    if(ok)
    {
    Serial.println("Received from Base :");
    Serial.println(RECStr);
      bool ok2 = network.write(header2,&ACKStr,sizeof(ACKStr));
       if (ok2)
         Serial.println("ACK Sent to base");
       else
         Serial.println("ACK Failed");
    }
    else
    Serial.println("Nothing Received from Base");
  }
}

Please help.

Please describe the failure.

If all 4 are using the same code and only one doesn't work then it isn't the code. Look at the wiring.

Hello,

@jremington : The network.write() is failing. Please suggest if there is away to debug in detail.

@Delta_G

Yes all 4 nodes are using same code. I checked the wiring, looks good. I am trying to switch off nodes one by one, only and only when "ANY" 3 nodes are receivers(including the 4th Node 04), the configuration works. as soon as I switch on, the 4th node fails again. I hope I am able to explain properly.

The same happened when I was using RPi as base node with a RPi RFNetwork example and Receivers were the same.