Sending Multiple Acknowledge Packets with the NRF24L01+

I am using the NRF24L01+ as a master and slave set up for two Arduino's. Right now, I have the master sending information to the slave, and the slave sending back a 32byte acknowledge. Everything works fine but I want to send more than 32 bytes at a time back to the master, so I added another data struct and wrote another Acknowledge payload. Reading through the documentation of the RF24 library. It states

Only three of these can be pending at any time as there are only 3 FIFO buffers

So I assume that to mean that I can have up to three payloads waiting in the buffer.

I have attached my code for both the master and slave below. Any help is appreciated as to why this is not working.

Master Code:

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

#define  CE_PIN  7 
#define  CSN_PIN 8

const byte slaveAddress[5] = {'R','x','A','A','A'};

int RF_Flag;
RF24 radio(CE_PIN, CSN_PIN);

byte addresses[][6] = {"1Node", "2Node"};

struct dataStruct {
  int Xposition;
  int Yposition;
  bool switchOn;

  int X2position;       
  int Y2position;
  bool switch2On; 

} myData;

struct dataStruct1 {     
  double feedback_1;
  double feedback_2;
  double feedback_3;
  double feedback_4;
  double feedback_5;
  double feedback_6;
  double feedback_7;
  double feedback_8;
} myTele;

struct dataStruct2 {    
  int feedback_9;
  int feedback_10;
  int feedback_11;
  int feedback_12;
  int feedback_13;
  int feedback_14;
  int feedback_15;
  int feedback_16;
  int feedback_17; 
  int feedback_18;
  int feedback_19;
  int feedback_20;
} myTele2;


void setup() { 
  radio.begin();
  radio.setChannel(108);
  radio.setDataRate(RF24_250KBPS);

  radio.setPALevel(RF24_PA_MAX);
  radio.enableAckPayload();
  radio.setRetries(7,5);
  radio.openWritingPipe(slaveAddress);
}

void loop() {
 ////////////////////////////////////////////////////////////////////////////////////////////////
    if (radio.write( &myData, sizeof(myData) )) {
        if ( radio.isAckPayloadAvailable() ) {
            radio.read(&myTele, sizeof(myTele));
            radio.read(&myTele2, sizeof(myTele2));

            Serial.print(myTele.feedback_1); Serial.print("\t");
            Serial.print(myTele.feedback_2); Serial.print("\t");
            Serial.print(myTele.feedback_3); Serial.print("\t");
            Serial.print(myTele.feedback_4); Serial.print("\t");
            Serial.print(myTele.feedback_5); Serial.print("\t");
            Serial.print(myTele.feedback_6); Serial.print("\t");
            Serial.print(myTele.feedback_7); Serial.print("\t");
            Serial.print(myTele.feedback_8); Serial.print("\t");
            Serial.print(myTele2.feedback_9); Serial.print("\t");
            Serial.print(myTele2.feedback_10); Serial.print("\t");
            Serial.print(myTele2.feedback_11); Serial.print("\t");
            Serial.print(myTele2.feedback_12); Serial.print("\t");
            Serial.print(myTele2.feedback_13); Serial.print("\t");
            Serial.print(myTele2.feedback_14); Serial.print("\t");
            Serial.print(myTele2.feedback_15); Serial.print("\t");
            Serial.print(myTele2.feedback_16); Serial.print("\t");
            Serial.print(myTele2.feedback_17); Serial.print("\t");
            Serial.print(myTele2.feedback_18); Serial.print("\t");
            Serial.print(myTele2.feedback_19); Serial.print("\t");
            Serial.print(myTele2.feedback_20); Serial.print("\t");
            Serial.println();
        }
    }
}

Slave Code:

#include "RF24.h"

#define  CE_PIN  12
#define  CSN_PIN 8

RF24 radio(CE_PIN, CSN_PIN);

byte addresses[][6] = {"1Node", "2Node"};
const byte thisSlaveAddress[5] = {'R','x','A','A','A'};

struct dataStruct {
  int Xposition;
  int Yposition;
  bool switchOn;

  int X2position;       
  int Y2position;
  bool switch2On;
} myData;

struct dataStruct1 {     
  double feedback_1;
  double feedback_2;
  double feedback_3;
  double feedback_4;
  double feedback_5;
  double feedback_6;
  double feedback_7;
  double feedback_8;
} myTele;

struct dataStruct2 {    
  int feedback_9;
  int feedback_10;
  int feedback_11;
  int feedback_12;
  int feedback_13;
  int feedback_14;
  int feedback_15;
  int feedback_16;
  int feedback_17;
  int feedback_18;
  int feedback_19;
  int feedback_20;
} myTele2;

void setup() {
  radio.begin();
  radio.setChannel(108);
  radio.setDataRate(RF24_250KBPS);
  radio.setPALevel(RF24_PA_MAX);
  radio.openReadingPipe(1, thisSlaveAddress);
  radio.enableAckPayload();
  radio.writeAckPayload(1, &myTele, sizeof(myTele));
  radio.startListening();
}

void loop() {
    if ( radio.available() ) {
        radio.read( &myData, sizeof(myData) );
        
        myTele.feedback_1 = 1;
        myTele.feedback_2 = 2;
        myTele.feedback_3 = 3;
        myTele.feedback_4 = 4;
        myTele.feedback_5 = 5;
        myTele.feedback_6 = 6;
        myTele.feedback_7 = 7;
        myTele.feedback_8 = 8;

        myTele2.feedback_9  = 1;
        myTele2.feedback_10 = 2;
        myTele2.feedback_11 = 3;
        myTele2.feedback_12 = 4;
        myTele2.feedback_13 = 5;
        
        radio.writeAckPayload(1, &myTele, sizeof(myTele));
        
        radio.writeAckPayload(1, &myTele2, sizeof(myTele2));
    }
}

mschindl:
Any help is appreciated as to why this is not working.

That's a point less statement. It's doing something. What is that? How is that different than what you want it do do?

Gfvalvo, the code is not acting any differently if I took away the second acknowledge payload. The master is only picking up one acknowledge payload, no matter if I send the second one or not.

I believe that only one acknowledge is going to be sent for each received transmission. Something needs to be put into the acknowledgment packet that there are (or there are not) more acknowledgements waiting so please send (or don't send) more transmissions.

mschindl:
Everything works fine but I want to send more than 32 bytes at a time back to the master,

The master must send a message to prompt every acknowledge. If you want the slave to send 3 ACK packets then the master must send 3 messages. The master's messages don't have to be meaningful - the slave can ignore their content.

...R
Simple nRF24L01+ Tutorial

Thanks Robin2, this is exactly what I was looking for. Needed to send more than 32 bytes.
Is it possible for an independent receiver not involved with the master/slave network to get the reply data from one of the slave transmitters? Is it as simple as merely giving the independent receiver’s the same address, channel and data type?

Gadgetman9:
Is it possible for an independent receiver not involved with the master/slave network to get the reply data from one of the slave transmitters? Is it as simple as merely giving the independent receiver’s the same address, channel and data type?

That should work. But you must also disable acknowledgements on the independent receiver so it does not confuse the other nRF24s

...R

If you are requesting a response, then why use an acknowledge to do this? Surely its logic to
send a reply explicitly in this case - acknowledges are low-level automated things designed to
robustify the link, not part of business logic.