Hi, I'm trying to do wireless communication with the nrf24l01+pa+lna module, but I'm in trouble.
This is my situation.
I'm trying to communicate 2 Arduino mega.
The two Arduino Mega's are both using the nrf24l01+pa+lna module. The nrf24l01+pa+lna module is using the nrf24l01 adapter. It is also equipped with a capacitor of 10uF.
The code on the sending side is as follows.
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
#define CE_PIN 9
#define CSN_PIN 53
RF24 radio(CE_PIN, CSN_PIN);
const byte address[6] = "10101";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);
radio.stopListening();
printf_begin();
radio.printDetails();
}
void loop() {
static int counter = 0;
bool success = radio.write(&counter, sizeof(counter));
if (success) {
Serial.print("Send Success: ");
Serial.println(counter);
} else {
Serial.println("Send Fail");
if (!radio.isChipConnected()) {
Serial.println("Radio Chip not connected!");
}
}
counter++;
delay(1000);
}
The code on the receiving end is as follows.
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
#define CE_PIN 9
#define CSN_PIN 53
RF24 radio(CE_PIN, CSN_PIN);
const byte address[6] = "10101";
int receivedData = 0;
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);
radio.startListening();
printf_begin();
radio.printDetails();
}
void loop() {
if (radio.available()) {
radio.read(&receivedData, sizeof(receivedData));
Serial.println(receivedData);
}
}
The sender's results received through the radio.printDetails() function are as follows.
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x3130313031 0x65646f4e32
RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR = 0x3130313031
RX_PW_P0-6 = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA = 0x3f
EN_RXADDR = 0x03
Receiver's results received through the radio.printDetails() function are as follows.
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x3130313031 0xc2c2c2c2c2
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
I've tried most of the methods I've found on the internet, but they've failed. What's the problem? Please help me.