Error using NRF24L01

Hello Experts,

I am trying to use NRF24L01 with ESP32 & had uploaded below code in ESP...

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

RF24 radio(5, 19); // CE, CSN

void setup() {
  Serial.begin(115200);
  radio.begin();
  radio.openWritingPipe(0x7878787878LL); // Set the receiver address
  radio.openReadingPipe(1, 0x6767676767LL); // Set the sender address
  radio.startListening();
}

void loop() {
  char sendText[] = "Hello, receiver!"; // Message to send
  radio.write(&sendText, sizeof(sendText));
  
  if (radio.available()) {
    char receiveText[32] = "";
    radio.read(&receiveText, sizeof(receiveText));
    Serial.println("Received: " + String(receiveText));
  }
  delay(1000);
}

I am getting below message in my Serial monitor.
Will anyone tell me why is this happening & what can I do to prevent this.

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid header: 0x044c2028
invalid heaets Jul 29 2019 12:21:46

The connections I did are as below:

NRF -> ESP
VCC -> 3.3V
GND -> GND
CE -> GPIO (e.g., GPIO5)
CSN -> GPIO (e.g., GPIO19)
SCK -> GPIO (e.g., GPIO18)
MOSI -> GPIO (e.g., GPIO23)
MISO -> GPIO (e.g., GPIO32)

Kindly help me with my issue...

Thanks!!!

don't use pastebin, very few of the helpers here will follow a link to an external site.
Just post code here using code tags.

Thanks for your concern & suggestion.
I had updated my responce馃檪

try different pins, like

  • GND of the nRF24L01 - GND of the ESP32
  • VCC of the nRF24L01 - 3.3V of the ESP32
  • CE of the nRF24L01 - D4 of the ESP32
  • CSN of the nRF24L01 - D5 of the ESP32
  • SCK of the nRF24L01 - D18 of the ESP32
  • MOSI of the nRF24L01 - D23 of the ESP32
  • MISO of the nRF24L01 - D19 of the ESP32

Can you tell me how can I define them in the code?

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 radio(4, 5);

I have connected as you told.

But still same issue...

what's you ESP32 exactly ? link to model / picture

DOIT ESP32 DEVKIT V1

I also tried using other ESP32 & some.other available codes...

Still same responce....

it's likely due to the fact that the RF24 library uses the standard SPI bus and this one is needed by the ESP32 for flash memory access

see [Question] How to use ESP32 HSPI 路 Issue #722 路 nRF24/RF24 路 GitHub for using HSPI instead

I checked the link & added suggested line in code & also changed the connections according to it....

Now I am not getting that error...

Thanks & Regards!!!

cool - is it working?

have fun

It didn't....

Actually the issue was different...
After lot headache I found that the ESP32 I used had different pinot-out from the ESP32 which I regularly use...

So because of this the connections I did were wrong...
I tried again with the ESP32 which I regularly use & it worked well with it.....

But still the NRF modules are unable to communicate with each other...

I think they may be damaged because of wrong connections....

Thanks for your help & guidance...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.