Pages: [1]   Go Down
Author Topic: NRF24L01+ works with mirf, but not with RF24 library...?  (Read 1201 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Newbie
*
Karma: 1
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi all,

i've got 2 NRF24L01+ modules, one wired up to an arduino uno and the other to bareboard arduino (chip + crystal + breadboard).

i managed to get them talking to each other using the mirf library.
now when i try to use the rf24 library, not one of the examples that come with it seem to work.
radio.printDetails(); gives me what seems to be valid values so it must be wired correctly.

would someone familiar with the rf24 library be so kind to post 2 "absolute minimum" sketches, e.g. one that just sends "123" all the time and another one that just prints what it receives?

that way i can make absolutely sure its not the codes fault smiley-wink
if that doesn't work, what else could it be?

thanks for your help,
stefan
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you using the Getting Started example?

I had issue with that until I found that sometimes you have to just initiate the ping form the opposite device (2) and then (1) will pong back and you can do pings from (1) fine afterwards.

I think it's something to do with picking up the sending address.

When we've used them subsequently in projects they work fine.
Logged

Germany
Offline Offline
Newbie
*
Karma: 1
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi tack,

yes, i used "getting started" and every other example i could find.

with the getting started sketch i have to press "t" in serial monitor to set module 1 to ping out mode.
module 2 is in pong back mode automatically.
as module 2 is connected to a breadbord arduino i can't set that to ping out because there is no serial monitor access.

to overcome all this i would need a sketch with no room for errors. would that work?

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

RF24 radio(9,10);

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

void setup(void)
{
   Serial.begin(57600);
   radio.begin();
   radio.openWritingPipe(pipes[0]);
   radio.printDetails();
}

void loop(void)
{
   int time = 3;
   Serial.print("Sending number: ")
   Serial.println(time);
   radio.write( &time, sizeof(int) );
   delay(200);
}

and on the receiving arduino:
Code:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(9,10);

const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

void setup(void)
{
   Serial.begin(57600);
   radio.begin();
   radio.openReadingPipe(1,pipes[1]);
   radio.printDetails();
   radio.startListening();
}

void loop(void)
{
   Serial.print("Number received: ")
   radio.read( &time, sizeof(int) );
   Serial.println(time);
   delay(200);
}

thank you,
stefan
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When I've had that situation I've had to initiate the ping in the 2nd Arduino. The 1st then longs fine. You can then stop the 2nd pinging and smog back to set the 1st romping and it then seems to work.

As I say, using it in our own project seems fine.

We are using the RF24Network layer on too though as it gives a tree based network topology with background routing of packets up and down the tree to reach a destination node.
Logged

Germany
Offline Offline
Newbie
*
Karma: 1
Posts: 38
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When I've had that situation I've had to initiate the ping in the 2nd Arduino. The 1st then longs fine. You can then stop the 2nd pinging and smog back to set the 1st romping and it then seems to work.

that worked! i don't know why exactly but it works now.. thank you!
Logged

Pages: [1]   Go Up
Jump to: