Re: nRF24L01

Hello Robin2.
Sorry for muy bad english… I am Spanish…
I saw in another post wrote by you, a code to test each NRF24L01 module separated…As I can not get communication between them, I used your suggested vode and got these results for each one:

CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
  Note that RF24 does NOT reset when Arduino resets - only when power is removed
  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
     communicating with the nRF24

STATUS.. = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1.. = 0xe7e7e7e7e7 0x0000000106
RX_ADDR_P2-5.. = 0xc3 0xc4 0xc5 0xc6
TX_ADDR.. = 0xe7e7e7e7e7
RX_PW_P0-6.. = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA.. = 0x3f
EN_RXADDR.. = 0x03
RF_CH.. = 0x4c
RF_SETUP.. = 0x07
CONFIG.. = 0x0c
DYNPD/FEATURE.. = 0x00 0x00
Data Rate. = 1MBPS
Model.. = nRF24L01+
CRC Length. = 16 bits
PA Power. = PA_HIGH


AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
 and 250KBPS data rate

STATUS.. = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1.. = 0xe7e7e7e7e7 0x0000000106
RX_ADDR_P2-5.. = 0xc3 0xc4 0xc5 0xc6
TX_ADDR.. = 0xe7e7e7e7e7
RX_PW_P0-6.. = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA.. = 0x3f
EN_RXADDR.. = 0x03

RF_CH.. = 0x4c
RF_SETUP.. = 0x27
CONFIG.. = 0x0c
DYNPD/FEATURE.. = 0x00 0x00
Data Rate. = 250KBPS
Model.. = nRF24L01+
CRC Length. = 16 bits
PA Power. = PA_HIGH
CheckConnection Starting

FIRST WITH THE DEFAULT ADDRESSES after power on
  Note that RF24 does NOT reset when Arduino resets - only when power is removed

  If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
     communicating with the nRF24


STATUS.. = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1.. = 0xe7e7e7e7e7 0x0000000106
RX_ADDR_P2-5.. = 0xc3 0xc4 0xc5 0xc6

TX_ADDR.. = 0xe7e7e7e7e7
RX_PW_P0-6.. = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA.. = 0x3f
EN_RXADDR.. = 0x03
RF_CH.. = 0x4c
RF_SETUP.. = 0x07
CONFIG.. = 0x0c
DYNPD/FEATURE.. = 0x00 0x00

Data Rate. = 1MBPS
Model.. = nRF24L01+
CRC Length. = 16 bits
PA Power. = PA_HIGH


AND NOW WITH ADDRESS AAAxR  0x41 41 41 78 52   ON P1
 and 250KBPS data rate


STATUS.. = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1.. = 0xe7e7e7e7e7 0x0000000106

RX_ADDR_P2-5.. = 0xc3 0xc4 0xc5 0xc6
TX_ADDR.. = 0xe7e7e7e7e7
RX_PW_P0-6.. = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA.. = 0x3f

EN_RXADDR.. = 0x03

RF_CH.. = 0x4c

RF_SETUP.. = 0x27
CONFIG.. = 0x0c
DYNPD/FEATURE.. = 0x00 0x00
Data Rate. = 250KBPS

Model.. = nRF24L01+
CRC Length. = 16 bits
PA Power. = PA_HIGH

Could you please tell me if these results confirm that modules are ok or wrong ???
I try to communicate each other with many many different codes from NET and different connections but never seen any prove of communication.

Last codes used to communicate are these ones below:

// SimpleTx - the master or the transmitter

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


#define CE_PIN   9
#define CSN_PIN 10

const byte slaveAddress[5] = {'R','x','A','A','A'};


RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataToSend[10] = "Message 0";
char txNum = '0';


unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second


void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTx Starting");

    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
}

//====================

void loop() {
    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
        prevMillis = millis();
    }
}

//====================

void send() {

    bool rslt;
    rslt = radio.write( &dataToSend, sizeof(dataToSend) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
    Serial.print(dataToSend);
    if (rslt) {
        Serial.println("  Acknowledge received");
        updateMessage();
    }
    else {
        Serial.println("  Tx failed");
    }
}

//================

void updateMessage() {
        // so you can see that new data is being sent
    txNum += 1;
    if (txNum > '9') {
        txNum = '0';
    }
    dataToSend[8] = txNum;
}

As receiver:

// SimpleRx - the slave or the receiver

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

#define CE_PIN   9
#define CSN_PIN 10

const byte thisSlaveAddress[5] = {'R','x','A','A','A'};

RF24 radio(CE_PIN, CSN_PIN);

char dataReceived[10]; // this must match dataToSend in the TX
bool newData = false;

//===========

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleRx Starting");
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.startListening();
}

//=============

void loop() {
    getData();
    showData();
}

//==============

void getData() {
    if ( radio.available() ) {
        radio.read( &dataReceived, sizeof(dataReceived) );
        newData = true;
    }
}

void showData() {
    if (newData == true) {
        Serial.print("Data received ");
        Serial.println(dataReceived);
        newData = false;
    }
}

I use two Arduinos UNO and also I use Voltage regulator to convert 5V from arduino to 3.3V to NRF24L01.

Please help me to get communication between each module.

Thank you in advance.

Sorry Robin2
I forgot to tell you that I also use 2 Capacitors between VCC and GND…one is 10 uF and second module has a 47uF (I dont found a second 10uF)…If this value must be 10uF, I will buy it.

When I use receiver and transmitter sketches, each serial monitor shows these replies:

Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx fa

and in receiver side, only one line once:

SimpleRx Starting

Your connection test programs suggest that the Arduinos are correctly communicating with the nRF24 they are attached to.

I presume the messages printed by the TX are printed once per second - but please let me know if that is not correct.

Are you using low-power nRF24s (with the PCB antenna) or high-power modules (with the external antenna). If using a high-power module make sure it is some distance (say 3 metres) from the other nRF24.

...R

@DOMPA, don't hijack someone else's thread. Start your own.

Thank you for reply Robin2..

Curiously, something has changed for the better.
I don't know why, it seems that now, they communicate with each other.

After a week fighting with these two modules, today, without knowing why, they seem to work ...
Waiting for a reply from you, I have found a web site which suggests connect IRQ to PIN D2. Until now, I dident connected IRQ to nowhere.
I connected this pin and upload codes again to each arduino....
I doesnt works...Then i removed this pin connection...
I tried again and now seems both modules are communicatin with each other.
Why ?????? I dont know ????
Here

My serials now, show these results:

Serial monitor RX Side:
Data received Message 2
Data received Message 3
Data received Message 4
Data received Message 5
Data received Message 6
Data received Message 7
Data received Message 8
Data received Message 9
Data received Message 0
Data received Message 1
Data received Message 2
Data received Message 3
Data received Message 4
Data received Message 5
Data received Message 6 
Serial Monitor TX SIDE:
Data Sent Message 9  Acknowledge received
Data Sent Message 0  Acknowledge received
Data Sent Message 1  Acknowledge received
Data Sent Message 2  Acknowledge received
Data Sent Message 3  Acknowledge received
Data Sent Message 4  Acknowledge received
Data Sent Message 5  Acknowledge received
Data Sent Message 6  Acknowledge received
Data Sent Message 7  Acknowledge received
Data Sent Message 8  Acknowledge received
Data Sent Message 9  Acknowledge received
Data Sent Message 0  Acknowledge received
Data Sent Message 1  Acknowledge received
Data Sent Message 2  Acknowledge received
Data Sent Message 3  Acknowledge received
Data Sent Message 4  Acknowledge received
Data Sent Message 5  Acknowledge received
Data Sent Message 6  Acknowledge received
Data Sent Message 7  Acknowledge received
Data Sent Message 8  Acknowledge received
Data Sent Message 9  Acknowledge received
Data Sent Message 0  Acknowledge received
Data Sent Message 1  Acknowledge received

I imagine, its means that they are communicating with each other.

Answering your questions, my modules have no physical antenna. The antenna is on the PCB.
Yes, messages are printed each 1 second.
My modules are separated one meter only.

Strangely, seems now both are working....

Do you agree, receiving these messages, they are working ???

Thank you

DOMPA:
Do you agree, receiving these messages, they are working ???

Yes.

But I think you knew that without having to ask.

...R

Thank you and sorry.