Hi everyone,
I opened this topic because I am stuck with a very specific nRF24L01 communication issue. My SPI connection seems perfect, but the radios refuse to talk to each other.
Here is my setup:
-
Both modules are using the Base Adapter Shields (regulated to 3.3V).
-
The adapters are powered from the Arduino's 5V pin.
-
radio.isChipConnected()returns1(true). -
radio.available()always returnsfalseon the receiver side.
I have tested the modules with the following codes (based on Dejan Nedelkovski's tutorial but modified to fix payload sizes and autoAck settings):
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Transmitter Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
RF24 radio(7, 8); // CE, CSN
const byte address[] = "00001";
void setup() {
Serial.begin(9600);
printf_begin();
radio.begin();
if (!radio.begin()) {
Serial.println(F("radio hardware not responding!"));
while (1) {} // hold program in infinite loop to prevent subsequent errors
}
radio.setAutoAck(false);
radio.setChannel(115);
radio.setPALevel(RF24_PA_LOW);
radio.openWritingPipe(address);
radio.stopListening();
radio.printPrettyDetails();
}
void loop() {
Serial.println("Entered TX loop");
delay(150);
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
}
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Receiver Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
RF24 radio(7, 8); // CE, CSN
const byte address[] = "00001";
void setup() {
Serial.begin(9600);
printf_begin();
radio.begin();
if (!radio.begin()) {
Serial.println(F("radio hardware not responding!"));
while (1) {} // hold program in infinite loop to prevent subsequent errors
}
radio.setAutoAck(false);
radio.setChannel(115);
radio.setPALevel(RF24_PA_LOW);
radio.openReadingPipe(1, address);
radio.startListening();
radio.printPrettyDetails();
bool result = radio.isChipConnected();
Serial.println(result);
}
void loop() {
//Serial.println("in loop");
delay(1);
if (radio.available()) {
Serial.println("the radio is available");
char value[32] = "";
radio.read(&value, sizeof(value));
Serial.println(value);
delay(1);
}
}
SPI Frequency = 10 Mhz
Channel = 115 (~ 2515 MHz)
Model = nRF24L01+
RF Data Rate = 1 MBPS
RF Power Amplifier = PA_LOW
RF Low Noise Amplifier = Enabled
CRC Length = 16 bits
Address Length = 5 bytes
Static Payload Length = 32 bytes
Auto Retry Delay = 1500 microseconds
Auto Retry Attempts = 15 maximum
Packets lost on
current channel = 0
Retry attempts made for
last transmission = 0
Multicast = Disabled
Custom ACK Payload = Disabled
Dynamic Payloads = Disabled
Auto Acknowledgment = Disabled
Primary Mode = RX
TX address = 0xe7e7e7e7e7
pipe 0 (closed) bound = 0xe7e7e7e7e7
pipe 1 ( open ) bound = 0x3130303030
pipe 2 (closed) bound = 0xc3
pipe 3 (closed) bound = 0xc4
pipe 4 (closed) bound = 0xc5
pipe 5 (closed) bound = 0xc6
1
SPI Frequency = 10 Mhz
Channel = 115 (~ 2515 MHz)
Model = nRF24L01+
RF Data Rate = 1 MBPS
RF Power Amplifier = PA_LOW
RF Low Noise Amplifier = Enabled
CRC Length = 16 bits
Address Length = 5 bytes
Static Payload Length = 32 bytes
Auto Retry Delay = 1500 microseconds
Auto Retry Attempts = 15 maximum
Packets lost on
current channel = 0
Retry attempts made for
last transmission = 0
Multicast = Disabled
Custom ACK Payload = Disabled
Dynamic Payloads = Disabled
Auto Acknowledgment = Disabled
Primary Mode = TX
TX address = 0x3130303030
pipe 0 ( open ) bound = 0x3130303030
pipe 1 ( open ) bound = 0xc2c2c2c2c2
pipe 2 (closed) bound = 0xc3
pipe 3 (closed) bound = 0xc4
pipe 4 (closed) bound = 0xc5
pipe 5 (closed) bound = 0xc6
Entered TX loop