Using this Simple nRF24L01+ 2.4GHz transceiver demo
And on my Master, I get data sent message a 0-9 number acknowledge received.. only if i d/c ground but if i connect ground it says tx failed instead, every second
Then for my slave is goes data received and freezes but then when i d/c ground for it will go quickly.
i'm using
- no capacitors, doesnt seem to make a difference
- atmega328P w/external 3.3 supply and bootloader
Master
// 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;
}
Slave
// 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;
}
}
Used the #29 reply in tutorial thread
This is what i got for both
08:48:20.199 -> CheckConnection Starting
08:48:20.199 ->
08:48:20.199 -> FIRST WITH THE DEFAULT ADDRESSES after power on
08:48:20.284 -> Note that RF24 does NOT reset when Arduino resets - only when power is removed
08:48:20.319 -> If the numbers are mostly 0x00 or 0xff it means that the Arduino is not
08:48:20.451 -> communicating with the nRF24
08:48:20.451 ->
08:48:20.451 -> STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
08:48:20.534 -> RX_ADDR_P0-1 = 0xe7e7e7e7e7 0xc2c2c2c2c2
08:48:20.583 -> RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
08:48:20.583 -> TX_ADDR = 0xe7e7e7e7e7
08:48:20.632 -> RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
08:48:20.717 -> EN_AA = 0x3f
08:48:20.717 -> EN_RXADDR = 0x03
08:48:20.717 -> RF_CH = 0x4c
08:48:20.717 -> RF_SETUP = 0x07
08:48:20.753 -> CONFIG = 0x0e
08:48:20.753 -> DYNPD/FEATURE = 0x00 0x00
08:48:20.790 -> Data Rate = 1MBPS
08:48:20.833 -> Model = nRF24L01+
08:48:20.833 -> CRC Length = 16 bits
08:48:20.867 -> PA Power = PA_MAX
08:48:20.905 ->
08:48:20.905 ->
08:48:20.905 -> AND NOW WITH ADDRESS AAAxR 0x41 41 41 78 52 ON P1
08:48:20.950 -> and 250KBPS data rate
08:48:20.950 ->
08:48:20.950 -> STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
08:48:21.032 -> RX_ADDR_P0-1 = 0xe7e7e7e7e7 0x4141417852
08:48:21.084 -> RX_ADDR_P2-5 = 0xc3 0xc4 0xc5 0xc6
08:48:21.132 -> TX_ADDR = 0xe7e7e7e7e7
08:48:21.166 -> RX_PW_P0-6 = 0x00 0x20 0x00 0x00 0x00 0x00
08:48:21.205 -> EN_AA = 0x3f
08:48:21.205 -> EN_RXADDR = 0x03
08:48:21.205 -> RF_CH = 0x4c
08:48:21.251 -> RF_SETUP = 0x27
08:48:21.251 -> CONFIG = 0x0e
08:48:21.285 -> DYNPD/FEATURE = 0x00 0x00
08:48:21.319 -> Data Rate = 250KBPS
08:48:21.319 -> Model = nRF24L01+
08:48:21.365 -> CRC Length = 16 bits
08:48:21.416 -> PA Power = PA_MAX
08:48:21.416 ->
08:48:21.416 ->