Hi!
I have been using the nRF24L01+ for a while now. I have made several posts and got very good advice on how to get them to work. But this module is driving me crazy (fun project, but my brain never stops thinking, not crazy "crazy"). Everytime I connect the module its never working, I work on it for some days and get it to work, I note what I did to make it work everytime. But this time my notes are not enough. I cannot get them to work.. again. I made a test program that will work everytime I mount everything right so the program should not be a problem, I have scimatics on how to make it work. But it dont. I have the printDetails() here:
Transmitter:
SPI Speedz = 10 Mhz
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xb00b1e5000 0xc2c2c2c2c2
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xb00b1e5000
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x01
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1 MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MIN
ARC = 15
Reciver:
SPI Speedz = 10 Mhz
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xe7e7e7e7e7 0xb00b1e5000
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0xe7e7e7e7e7
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
RF_CH = 0x4c
RF_SETUP = 0x21
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 250 KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MIN
ARC = 0
The code I am using is the following:
Reciver:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
#define CE_PIN 9
#define CSN_PIN 10
// Create Radio and define pins
RF24 radio(CE_PIN, CSN_PIN);
// Create Radio channels
const uint64_t pAddress = 0xB00B1E5000LL;
//Radio recived array
int recivedDataArray[4];
void setup() {
Serial.begin(115200);
printf_begin();
radio.begin();
radio.openReadingPipe(1, pAddress);
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_MIN);
radio.setChannel(0x34);
radio.enableDynamicPayloads();
radio.enableAckPayload();
radio.setRetries(0, 15);
radio.setAutoAck(true);
radio.printDetails();
radio.powerUp();
radio.startListening();
}
void loop() {
if (radio.available()) {
radio.read( &recivedDataArray, sizeof(recivedDataArray) );
Serial.println("Recieved array:");
for (byte i = 0; i < 4; i++) {
Serial.println(recivedDataArray[i]);
}
Serial.println();
}
}
Transmitter:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
#define CE_PIN 9
#define CSN_PIN 10
// Create Radio and define pins
RF24 radio(CE_PIN, CSN_PIN);
// Create Radio channels
const uint64_t pAddress = 0xB00B1E5000LL;
//Radio recived array
int dataArray[4];
bool newData = false;
String string;
void setup() {
Serial.begin(115200);
printf_begin();
radio.begin();
radio.openWritingPipe(pAddress);
radio.setDataRate( RF24_250KBPS );
radio.setPALevel(RF24_PA_MAX);
radio.setChannel(0x34);
radio.enableDynamicPayloads();
radio.enableAckPayload();
radio.setRetries(0, 15);
radio.setAutoAck(true);
radio.printDetails();
radio.powerUp();
radio.stopListening();
dataArray[0] = 1000;
dataArray[1] = 0;
dataArray[2] = 0;
dataArray[3] = 0;
}
void loop() {
// check if data is available
if (Serial.available() > 0) {
// read the incoming string:
String incomingString = Serial.readString();
// prints the received data
Serial.print("I received: ");
Serial.println(incomingString);
dataArray[0] = incomingString.toInt();
Serial.println(dataArray[0]);
}
if (!radio.write( &dataArray, sizeof(dataArray))) {
Serial.println("Transmittion failed");
}
else {
Serial.println("Transmittion successful");
}
}
I am suspecting the ARC value need to be the same. But I dont know.. If anyone could find something or have some tips it would be very appriciated! Thanks beforehand!
Best regards Max