STM32 Nucleo-L432KC can't send data to Arduino Uno via nRF24L01 module

Hello everyone.

First of all, I know you're going to tell me to send my question on the stm32duino forum. But I tried to enter the stm32duino forum and I didn't succeed (I think their forum is closed). So I'll be happy if you could try to help me here.

So, I want to use the nRF24L01 module to communicate between the STM32 Nucleo-L432KC and the Arduino Uno. such that both the STM32 Nucleo-L432KC and the Arduino Uno will be transceivers.

I use the nRF24L01 libraries (for the STM32 Nucleo-L432KC board):

  • nRF24L01_STM32.h
  • RF24_config_STM32.h
  • RF24_STM32.h
  • SPI.h

And the nRF24L01 libraries (for the Arduino Uno board):

  • nRF24L01.h
  • printf.h
  • RF24.h
  • RF24_config.h
  • SPI.h

My nRF24L01 module pin connections are:

For the nRF24L01 module to the Arduino Uno:
nRF24L01 Arduino Uno
CE D7
CSN D8
MOSI D11
MISO D12
SCLK D13

For the nRF24L01 module to the STM32 Nucleo-L432KC:
nRF24L01 STM32 Nucleo-L432KC
CE PB0
CSN PB1
MOSI D11 (Other names: PB5, SPI3_MOSI)
MISO D12 (Other names: PB4, SPI3_MISO)
SCLK D13 (Other names: PB3, SPI3_SCLK)

tried to send data from the Arduino Uno to the STM32 Nucleo-L432KC, and I got the data and everything was OK.

But when I tried to send the data from the STM32 Nucleo-L432KC to the Arduino Uno board, I didn't receive the data in the Arduino Uno (I use the Serial monitor in-order to print the data I receive).

Here is my code:

For the Slave (STM32 Nucleo-L432KC) who send the data to the Arduino Uno:

#include <nRF24L01_STM32.h>
#include <RF24_config_STM32.h>
#include <RF24_STM32.h>
#include <SPI.h>

RF24 myRadio(PB0, PB1); //CE Pin, CSN Pin
//----------------------------------
//Rest of connections to the Nucleo-L432KC:
//   nRF    Nucleo-L432KC
//  MISO      D12 (Other names: PB4, SPI3_MISO)
//  MOSI      D11 (Other names: PB5, SPI3_MOSI)
//  SCLK      D13 (Other names: PB3, SPI3_SCLK)


//My Slave (Nucleo-L432KC) and Master (Arduino Uno) addresses:
const uint64_t pipes[2] = {0xF0F0F0F0AA , 0xF0F0F0F066}; // {Master (Arduino Uno) address , Slave (Nucleo-L432KC) address}

const char test[] = "test"; // junk string to send between the slave and the master in-order to check the communication between them



void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600); //Start Serial communication
  delay(1000);
  //Init SPI config:
  SPI.begin(); 
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(MSBFIRST);
  //---------------------------

  //Init my nRF radio:
  myRadio.begin();                      //Starting the Wireless communication
  myRadio.setRetries(15, 15);
  myRadio.setChannel(0x4c);             // Set the communication channel
  myRadio.setPALevel(RF24_PA_MAX);      // Set the nRF power level. RF24_PA_MAX => maximum power
  myRadio.openWritingPipe(pipes[0]);    // Set the address of the Master (in-order to send back the requested data). Master address is: pipes[0]
  myRadio.openReadingPipe(1, pipes[1]); // Set the address of the Slave (in-order to receive the commands from the master). Slave address is: pipes[1]
  
  myRadio.stopListening();              // Set myRadio to transmitter mode (in-order to test the data communication: Slave send requested data to master)
  //---------------------------

}

// Send the data to the master (Arduino Uno) infinitely:
void loop() {
  delay(500);
  myRadio.write(&test, sizeof(test));
}

For the Master (Arduino Uno) who receive the data from the STM32 Nucleo-L432KC:

// nRF24L01 libraries for Arduino platform:
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
//--------------------------
#include <SPI.h>


RF24 radio(7, 8); // CE Pin (D7), CSN Pin (D8)
//----------------------------------
//Rest of connections to the Arduino Uno:
//   nRF    Arduino Uno:
//  MISO      D12
//  MOSI      D11
//  SCLK      D13

//My Slave (Nucleo-L432KC) and Master (Arduino Uno) addresses:
const uint64_t pipes[2] = {0xF0F0F0F0AA , 0xF0F0F0F066}; // {Master (Arduino Uno) address , Slave (Nucleo-L432KC) address}


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600); //Start Serial communication
  delay(1000);
  
  //Init my nRF radio:  
  radio.begin();                       //Starting the Wireless communication
  radio.setRetries(15, 15);
  radio.setChannel(0x4c);              // Set the communication channel
  radio.setPALevel(RF24_PA_MAX);       // Set the nRF power level. RF24_PA_MAX => maximum power
  radio.openReadingPipe(1, pipes[0]);  // Set the address of the Master (in-order to receive back the requested data from the slave). Master (Arduino Uno) address is: pipes[0]
  radio.openWritingPipe(pipes[1]);     // Set the address of the Slave (in-order to send the commands to it from the master). Slave(Nucleo-L432KC) address is: pipes[1]

  radio.startListening();              // Set radio to receiver mode (in-order to test the data communication: Slave send data data to master)  
}

// Receive the data from the slave (Nucleo-L432KC) infinitely:
void loop() {
    if (radio.available())              // Looking for the data.
  {
    char text[32] = "";                 
    radio.read(&text, sizeof(text));    // Saving the incoming data
    Serial.println(text);               // Printing the received data on the Serial monitor
  }
}

Both the Arduino Uno and the STM32 Nucleo-L432KC codes were compiled successfully.

Can you please help me and tell me what I'm doing wrong here and how to fix this?

Note: I use for the master and the slave a code that I found from the web (in multiple web pages).

Thank you for your help,
Reshef

RF24_STM32.zip (33.8 KB)

RF24-1.3.2.zip (357 KB)