Hi all! I've been trying out the RF24mesh library and some associated demo code on two mega 2560 fitted with nrf24L01+ transceiver devices.
Quite nice how the communications works!
I do see occasional 'Send Fail, Test OK'. [This post will be technical, but there is another post involving RFmesh24 library terminology, at ....click here....].
I popped electrolytic and ceramic capacitors (for decoupling) between the MEGA 2560 5V socket and a GND ground socket (just in case). I didn't fit any capacitors to the NRF24 devices themselves though.
Maybe other people here have used exactly the same demo code.... like this slave receiver code attached below.
Just a quick question about those occasional "Send Fail, Test OK" messages. Like this..... where the slave serial monitor window shows the slave is sending out millis() time values fairly well...but some don't make it out.
Send OK: 30094
Send OK: 31094
Send OK: 32094
Send OK: 33094
Send fail, Test OK
Send OK: 35094
Send OK: 36094
Send OK: 37094
Do you get those occasional messages as well?
My master and slave receivers are relatively close in distance ...... like 30 cm apart, and I run the serial speed that came with the code.... 115200 bit per second.
I thought I'd ask about this, in case I can do something with the hardware or software to have communications having no Send Fails at all.
Actually, does anybody know what the 'Test OK' part of that message actually means? I can related to 'Send Fail', but don't know what 'Test OK' means here.
Anyway, once again ...... this RF24mesh library looks pretty good. Definitely working alright here.
Thanks!
/** RF24Mesh_Example.ino by TMRh20
This example sketch shows how to manually configure a node via RF24Mesh, and send data to the
master node.
The nodes will refresh their network address as soon as a single write fails. This allows the
nodes to change position in relation to each other and the master node.
*/
#include "RF24.h"
#include "RF24Network.h"
#include "RF24Mesh.h"
#include <SPI.h>
//#include <printf.h>
/**** Configure the nrf24l01 CE and CS pins ****/
RF24 radio(9, 53);
RF24Network network(radio);
RF24Mesh mesh(radio, network);
/**
User Configuration: nodeID - A unique identifier for each radio. Allows addressing
to change dynamically with physical changes to the mesh.
In this example, configuration takes place below, prior to uploading the sketch to the device
A unique value from 1-255 must be configured for each node.
This will be stored in EEPROM on AVR devices, so remains persistent between further uploads, loss of power, etc.
**/
#define nodeID 1
uint32_t displayTimer = 0;
struct payload_t {
unsigned long ms;
unsigned long counter;
};
void setup() {
Serial.begin(115200);
//printf_begin();
// Set the nodeID manually
mesh.setNodeID(nodeID);
// Connect to the mesh
Serial.println(F("Connecting to the mesh..."));
mesh.begin();
}
void loop() {
mesh.update();
// Send to the master node every second
if (millis() - displayTimer >= 1000) {
displayTimer = millis();
// Send an 'M' type message containing the current millis()
if (!mesh.write(&displayTimer, 'M', sizeof(displayTimer))) {
// If a write fails, check connectivity to the mesh network
if ( ! mesh.checkConnection() ) {
//refresh the network address
Serial.println("Renewing Address");
mesh.renewAddress();
} else {
Serial.println("Send fail, Test OK");
}
} else {
Serial.print("Send OK: "); Serial.println(displayTimer);
}
}
while (network.available()) {
RF24NetworkHeader header;
payload_t payload;
network.read(header, &payload, sizeof(payload));
Serial.print("Received packet #");
Serial.print(payload.counter);
Serial.print(" at ");
Serial.println(payload.ms);
}
}