NRF24L01+ RHeadLibrary Reliable and encrypted messages

Hello, I’m having trouble trying to use nrf24L01+ modules.

I’m using Feather M0 Basic Proto boards that I program through the Arduino IDE (but I presume my problem have nothing to do about it, it may be the same on any arduino)
I connected NRF24L01+ modules through SPI (MOSI,MISO,SCK and pins 5 and 6 for CE and CSN).

I tried the RadioHead Library examples (nrf24_Reliable_Datagram and nrf24_Encrypted), which worked perfectly.

But then I tried to mix the two to make an Encrypted and Reliable program (see below the codes).
The result is quite interesting… the client send a message to the server which receive it but then when it tries to respond, it returns a “sendtoWait failed” message and the client ask if there is a server online.

Client Serial :

18:29:56.482 -> Sending to nrf24_reliable_datagram_server
18:29:58.485 -> No reply, is nrf24_reliable_datagram_server running?

Server Serial :

18:30:51.526 -> got request from : 0x1: Hello World!
18:30:52.796 -> sendtoWait failed

I think that means the client can send a message to the server and it receives it but when the server tries to respond, something goes wrong… ? Strange …
I tried to add a delay to the server response, put more retries but nothing works.

Client code:

#include <RHReliableDatagram.h>
#include <RH_NRF24.h>
#include <RHEncryptedDriver.h>
#include <Speck.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

// Singleton instance of the radio driver
RH_NRF24 nrf24(5,6); //pin 5 is used for CE and pin 6 for CSN

// You can choose any of several encryption ciphers
Speck myCipher;   // Instantiate a Speck block ciphering
// The RHEncryptedDriver acts as a wrapper for the actual radio driver
RHEncryptedDriver driver(nrf24, myCipher);
unsigned char encryptkey[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};

// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, CLIENT_ADDRESS);

void setup() 
{
  Serial.begin(9600);

  if (!nrf24.init())
    Serial.println("nrf24 init failed"); 
  // Now set up the encryption key in our cipher
    myCipher.setKey(encryptkey, sizeof(encryptkey));

  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
}

uint8_t data[] = "Hello World!";
// Dont put this on the stack:
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];

void loop()
{
  Serial.println("Sending to nrf24_reliable_datagram_server");
    
  // Send a message to manager_server
  if (manager.sendtoWait(data, sizeof(data), SERVER_ADDRESS))
  {
    // Now wait for a reply from the server
    uint8_t len = sizeof(buf);
    uint8_t from;   
    if (manager.recvfromAckTimeout(buf, &len, 2000, &from))
    {
      Serial.print("got reply from : 0x");
      Serial.print(from, HEX);
      Serial.print(": ");
      Serial.println((char*)buf);
    }
    else
    {
      Serial.println("No reply, is nrf24_reliable_datagram_server running?");
    }
  }
  else
    Serial.println("sendtoWait failed");
  delay(500);
}

Server Code:

#include <RHReliableDatagram.h>
#include <RH_NRF24.h>
#include <RHEncryptedDriver.h>
#include <Speck.h>
#include <SPI.h>


#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

// Singleton instance of the radio driver
RH_NRF24 nrf24(5,6); //pin 5 is used for CE and pin 6 for CSN


Speck myCipher;   // Instantiate a Speck block ciphering
// The RHEncryptedDriver acts as a wrapper for the actual radio driver
RHEncryptedDriver driver(nrf24, myCipher); 
// The key MUST be the same as the one in the server
unsigned char encryptkey[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};

// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, SERVER_ADDRESS);

void setup() 
{
  Serial.begin(9600);

  if (!nrf24.init())
    Serial.println("nrf24 init failed");
  // Now set up the encryption key in our cipher
  myCipher.setKey(encryptkey, sizeof(encryptkey));

  
  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
}

uint8_t data[] = "And hello back to you";
// Dont put this on the stack:
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];

void loop()
{
  if (manager.available())
  {
    // Wait for a message addressed to us from the client
    uint8_t len = sizeof(buf);
    uint8_t from;
    if (manager.recvfromAck(buf, &len, &from))
    {
      Serial.print("got request from : 0x");
      Serial.print(from, HEX);
      Serial.print(": ");
      Serial.println((char*)buf);

      // Send a reply back to the originator client
      if (!manager.sendtoWait(data, sizeof(data), from))
        Serial.println("sendtoWait failed");
    }
  }
}