nrf24l01 radio.printDetails(); before opening pipe for reading/writing

Hi guys.
Anyone could explain to me why the code is working only if
radio.printDetails();
goes before opening pipe?
This is my code:

//======================== NANO AS RECEIVER====================

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

RF24 radio(9,10);

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

radio.printDetails(); // WHY CODE NOT WORKING IF THIS LINE IS REMOVED

radio.openReadingPipe(1,0xF0F0F0F0E1LL);
radio.startListening();
}

void loop(void)
{
if ( radio.available() )
{
unsigned long got_time;
bool done = false;
while (!done)
{
done = radio.read( &got_time, sizeof(unsigned long) );
printf("Got TIME %lu...\n\r",got_time);
}
}
}
//========================================================

//======================== MEGA AS SENDER====================

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

RF24 radio(9,53);
int j=0; int i =0;

void setup(void)
{
Serial.begin(9600);
printf_begin();
radio.begin();
radio.printDetails();// ???????????????????? WHY

radio.openWritingPipe(0xF0F0F0F0E1LL);
}

void loop(void)
{
radio.stopListening(); i++;
unsigned long time = millis();
printf("Now sending %lu...",time);
bool ok = radio.write( &time, sizeof(unsigned long) );
if (ok) printf("ok... %d\n\r",i );

else
{
while (!ok )
{
ok = radio.write( /&i/ &time , sizeof(unsigned long)); j++;
printf("failed...%d \n\r", j);
}
printf("Succes...%d Paviko nusiusti is %d karto\n\r", i, j);
j=0;
}
radio.startListening();
}
//==================== END OF CODE ================================

Anyone could explain why do I need "radio.printDetails();" for my code to work?
If I remove this line of code or call for this line after opening pipe nothing will happen?
I'm using Mega as sender and Nano as a receiver.

Mega pinout
52 = sck
51 = mosi
50 = miso
53 = csn
9 = ce

Nano pinout
13 = sck
11 = mosi
12 = miso
10 = csn
9 = ce

Code is working only if radio.printDetails(); goes before opening pipe. Why?

Maybe this Simple nRF24L01+ Tutorial will help.

...R

In this link nobody mention about radio.printDetails(); I still can't figure out why my code not working if I remove this line. What this piece of code does. I guess it is something more, not just printing details. I guess it possible that it scans available nodes. Or sets some pins high or low. I don't know? Just know one thing my chips working only if this line of code is in the sketch before opening any pipe. Been looking for source code of radio.prinDetails(); but no luck could not find. So can't figure out what this function does.

Maybe you just need a delay after radio.begin().

raimiss8:
In this link nobody mention about radio.printDetails();

Did you study Reply #29 in the link I gave you?

...R

Robin2 looks like I did miss full second page :slight_smile:
After reading I noticed that in the example sketch is used same code sequence I mean just after radio begin is called print details.

In that replay #29 talking about poor connection. The connection is fine on my boards it is working fine if radio.printdetails() is called before opening pipes.
I have seen many sketches where people not even using radio.printDetails() in code and all is working but not in my case.

Obviously you are using the ManiacBug library

        done = radio.read( &got_time, sizeof(unsigned long) );

or your code would not even compile, so I suggest using the TMRh20 2014 - Optimized Fork of NRF24L01+.

I never had to use printDetails to transmit/receive anyway, even with the outdated old library.

Whandall:
I never had to use printDetails to transmit/receive anyway, even with the outdated old library.

I have recently found it useful as a simple way to verify that the Arduino can talk to the nRF24 it is attached to.

...R

I never had to use printDetails to get the NRF working, I don't doubt the usefulness of printDetails. :wink:

Whandall:
I never had to use printDetails to get the NRF working, I don't doubt the usefulness of printDetails. :wink:

To be honest, the data that printDetails() returned was of little interest to me, as long as I could see that it was actually sending back valid data. :slight_smile:

...R