[SOLVED] Communication issues with nRF24L01

Alkerion:
You're right, no regulator chip, but it's written 5V in the title and '5 v input tolerance level' & 'With regulated voltage regulator', and also 'Voltage supply: 5V' in details
So I expect them to work with 5V.

I think the description is simply wrong.
The module is a standard SMD variant of the NRF24L01 that needs a 3.3V power supply.

So,

To recap :

  • New Lib implemented, Tx & Rx are communicating, but not 100%
  • Power is OK at 2.8V as between the 1.9 to 3.6V acceptable range
  • 33uF cap soldered on RF24 module to filter noise
  • 250kbps speed to have the highest receiver sensitivity
  • retries set to 15,15

Modules are at 1m from each others.

I've one emitter and 10 receiver/emitter, they all behave the same.

On last thing I see is that I'v used the Analog pins A0: CSN & A1: CE

Do I need to use Digital pins instead (I've no more available...) ?

What did I miss ?

PS: I wrote to the seller to confirm if it's 5V or not.

Alkerion:
I've one emitter and 10 receiver/emitter, they all behave the same.

On last thing I see is that I'v used the Analog pins A0: CSN & A1: CE

The analog pins should be fine.

Are you trying the master with one slave powered up at any one time or are they all powered up?

Post the programs that are on the master and on one of the slaves.

Also, post an example of the output from the master and the slave.

...R

Well....

After a few hours I'm back to the exact same status I was with the Mirf lib....

I try to discuss with one only or with severals, buit the result is the same, examples :

If I do that I've 100% transmissions OK, tried several times, 100% OK all the times

void test() {
	for (int i = 1; i <= 1000; i++) {
	sendToBtn(4, TEST_BTN);
	delay(200);
	}
}

If I do that I've only 60-90% transmission OK (Tx say Ackn. is OK, but Rx receive no data)

void randomBlinkBtn() {


	int turns = btnCount * 10;

	int last = 0;


	for (int i = 1; i < turns; i++) {

		int rnd = getRandomButton(last);

		sendToBtn(rnd, TEST_BTN);
	
		last = rnd;

		delay(300);
	}
	sendToBtn(getRandomButton(last), TURN_LED_ON);

}

If I change "sendToBtn(rnd, TEST_BTN);" to "sendToBtn(4, TEST_BTN);" it works 100% of the time.....

With the following associated functions :

void updateMessage(char order[]) {
	// so you can see that new data is being sent
	dataToSend[3] = order[0];
	dataToSend[4] = order[1];
}

//****************************************

unsigned int PRNG() {
	// our initial starting seed is 5323
	static unsigned int seed = 5323 * millis() + rand();

	// Take the current seed and generate a new value from it
	// Due to our use of large constants and overflow, it would be
	// very hard for someone to predict what the next number is
	// going to be from the previous one.
	seed = (8253729 * seed + 2396403);

	// Take the seed and return a value between 0 and 32767
	return seed % 32767;
}

//****************************************

int getRandomButton() {

	int rnd = 0;

	do {
		rnd = random(1, buttonsNumber);
	} while (!btnConnected[rnd]);

	return rnd;

}

//****************************************

int getRandomButton(int last) {

	int rnd = 0;

	do {
		rnd = getRandomButton();
	} while (rnd == last);

	return rnd;

}

void sendToBtn(int butID, char data[]) {

	updateMessage(data);

	bool rslt;

	radio.stopListening();
	radio.flush_tx();
	
	radio.openWritingPipe(buttonAddress[butID]);

	rslt = radio.write(&dataToSend, sizeof(dataToSend));

	if (rslt) {
		btnConnected[butID] = true;
		if (radio.isAckPayloadAvailable()) {
			radio.read(&ackData, sizeof(ackData));
			newData = true;
		}
		else {
			Serial.println("  Acknowledge but no data ");
		}
	}
	else {
		btnConnected[butID] = false;
		Serial.println("  Tx failed");
	}
	radio.startListening();
}

This is also not working:

void randomBlinkBtn2() {

	int cnt = 0;
	int btn = 4;

	int turns = btnCount * 10;

	int last = 0;

	int asd[turns];

	for (int i = 1; i < turns; i++) {
		asd[i] = getRandomButton(asd[i-1]);
	}

	for (int i = 1; i < turns; i++) {

		if (asd[i] == btn)
			cnt++;

		delay(300);
		sendToBtn(asd[i], TEST_BTN);

	}
	sendToBtn(getRandomButton(last), TURN_LED_ON);

	Serial.print("cnt: ");
	Serial.println(cnt);

}

No more success with a Switch:

void randomBlinkBtn3() {

	int cnt = 0;
	int btn = 4;

	int turns = btnCount * 10;

	int last = 0;

	for (int i = 1; i < turns; i++) {

		int rnd = getRandomButton(last);

		if (rnd == btn)
			cnt++;

		switch (rnd) {
		case 1:
			sendToBtn(1, TEST_BTN);
			break;
		case 2:
			sendToBtn(2, TEST_BTN);
			break;
		case 3:
			sendToBtn(3, TEST_BTN);
			break;
		case 4:
			sendToBtn(4, TEST_BTN);
			break;
		case 5:
			sendToBtn(5, TEST_BTN);
			break;
		case 6:
			sendToBtn(6, TEST_BTN);
			break;
		case 7:
			sendToBtn(7, TEST_BTN);
			break;
		}

		last = rnd;

		delay(300);

	}
	sendToBtn(getRandomButton(last), TURN_LED_ON);

	Serial.print("cnt: ");
	Serial.println(cnt);

}

The most amazing thing is that Tx always report:
send BTN04 : CMD00
Acknowledge but no data

But Rx doesn't receive the data....

If I change "int rnd = getRandomButton(last);" to "int rnd = 4;" it works 100%

So there is an issue around my getRandomButton() function.

This seems to be confirmed as the following function who's discussing with all Rx is working perfect:

void blinkBtn() {

	if (btnCount == 0)
		return;

	Serial.print("But : ");
	Serial.println(btnCount);

	int inter = 300;

	int rnd = getRandomButton();

	for (int j = 0; j < 3; j++) { //round number

		for (int i = 1; i < sizeof(btnConnected); i++) {

			if (btnConnected[i] == true) {

				switch (j) {
				case 0:
					sendToBtn(i, BLINK_LED_ONCE_FAST);
					break;
				case 1:
					inter = 600;
					sendToBtn(i, BLINK_LED_ONCE_MEDIUM);
					break;
				case 2:
					inter = 1000;
					if (i == rnd) {
						sendToBtn(i,TURN_LED_ON);
						i = 100;
					}
					else {
						sendToBtn(i, BLINK_LED_ONCE_SLOW);
					}
					break;
				}

				delay(inter);

			}
		}
	}

}

The only thing I see is that function line random(1, buttonsNumber); is returning a long and I'm storing the value in an int.

int getRandomButton() {

	int rnd = 0;

	do {
		rnd = random(1, buttonsNumber);
	} while (!btnConnected[rnd]);

	return rnd;
}

I'm far not good enough in C to know if this could be the issue or not, and I also haven't any idea how to cast a long in int in C (tried a few things without success).

Sounds really strange that it works in 60-90% of the case, and with the same button number.

It's crazy, but the issue is around here.

Sorry, TL:DR. I can't make sense of your descriptions of the problem. And you have just posted code snippets.

Rather than use the random function why not try getting the thing to work through a preset sequence 1,2,3,4 etc over and over again. Then maybe change the order of the preset sequence.

If that works try using random to select the item from the preset sequence.

Wireless problems can be very difficult to debug and they require a very slow and methodical approach.

The fact that you can get one version working 100% of the time suggests that the problem is in how you are managing the wireless rather than in the transmission/reception.

...R

Hi,

It's exactly what I've done and all this is described in posts #23 & #24.

The problem now (in fact it's the exact same described on post #1 with Mirf lib) is that I lost transmissions when I try to randomly turn ON LED modules with function randomBlinkBtn() (post #23, 2nd code section).

I don't understand why it's not working with this function.

Tx say that it Acknowledge communication, but no data are received on LED module side.

A) I'm able to Tx <-> Rx with one LED module 100% of the time (post #23, 1st code section).

B) I'm able to Tx <-> Rx with several LED modules in 1,2,3... order 100% of the time (post #24, 3rd code section).

Some pictures:

OK 1000 time to same btn

OK in 1,2,3,4....

Not OK if I use random, sometimes even if order is send by Tx, the data are not received on Rx side.

ANd OK if I replace the random by 4

I'm going crazy with this project and RF24 com.

I spent hours to perform tests, please have a look at the weird behavior I have.

With a very simple code I can reproduce a transmission failure depending the sequence I call my LED modules.

Example, with sequence "1,2,2,2,1,1,1" the second msg to module 1 is sent, acknowledged, but module 1 doesn't received the msg.

Some sequences are always working (1,1,1,1,1,.... or 1,2,3,4,5,1,2,3,4,5...), but for most other sequences some msg are never received.

I'll post all my crazy tests (the one you can see on picture above) on next post.

Full codes creating the errors:

Tx code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <ctype.h>
#include <IRremote.h>


#define CE_PIN A1
#define CSN_PIN A0

#define IR_1 0xC101E57B
#define IR_STAR 0x32C6FDF7
#define IR_OK 0xD7E84B1B


//Button Orders
char TEST_BTN[2] = { '2','2' };
char RESET_BTN[2] = { '6','6' };

//Setup IR
IRrecv irrecv(9);
decode_results IRvalues;

//RF24
const byte thisMasterAddress[5] = { 'S','R','V','0','0' };
const byte buttonAddress[11][5] = { {'B','T','N','0','0'},{ 'B','T','N','0','1' },{ 'B','T','N','0','2' },{ 'B','T','N','0','3' },{ 'B','T','N','0','4' },{ 'B','T','N','0','5' },{ 'B','T','N','0','6' },{ 'B','T','N','0','7' },{ 'B','T','N','0','8' },{ 'B','T','N','0','9' },{ 'B','T','N','1','0' } };

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataReceived[6]; // this must match dataToSend in the TX
char dataToSend[6] = { 'C','M','D','0','0'};
char txNum = '0';
int ackData[2] = { -1, -1 }; // to hold the two values coming from the slave
bool newData = false;

//****************************************

void setup() {


	//Setting up the Serial USB comm port
	Serial.begin(115200);
	Serial.print("Hello!");
	delay(1500);
	// Setting up the IR receiver
	irrecv.enableIRIn(); 

	//Setting up the RF24
	radio.begin();
	radio.setDataRate(RF24_250KBPS); //best 
	radio.setPALevel(RF24_PA_MAX); //max power
	radio.setChannel(125);//To avoid Wifi noise
	radio.enableAckPayload();
	radio.setRetries(3, 15); // delay, count
	radio.startListening();
}

//****************************************

void loop() {
	
	//Handle IR orders

	if (irrecv.decode(&IRvalues)) {

		if (IRvalues.value == IR_1) { //1
			sendToBtn(1, TEST_BTN);
		}

		else if (IRvalues.value == IR_STAR) { //* - Random
			randomBlinkBtn();
		}

		else if (IRvalues.value == IR_OK) { //OK - RESET
			sendToBtn(1, RESET_BTN);
			sendToBtn(1, RESET_BTN);
		}

		irrecv.resume(); // Receive the next value

	}

}

//****************************************

void updateMessage(char order[]) {
	// so you can see that new data is being sent
	dataToSend[3] = order[0];
	dataToSend[4] = order[1];
}


void randomBlinkBtn() {

	int cnt = 0;
	int btn = 1; // BUtton number to count the number of sent msg

	int last = 0;


	int asd[] = { 1,2,2,2,1,1,1 };//2nd 1 still doesn't blink

	int asdLen = sizeof(asd) / sizeof(int);

	for (int i = 0; i < asdLen; i++) {

		if (asd[i] == btn)
			cnt++;

		delay(300);
		sendToBtn(asd[i], TEST_BTN);

	}

	Serial.print("cnt: ");
	Serial.println(cnt);

}

//****************************************

void sendToBtn(int butID, char data[]) {

	updateMessage(data);

	Serial.print("send BTN");
	Serial.print(butID);
	Serial.print(" : ");
	Serial.println(dataToSend);

	bool rslt;

	//We have to stop listening before writing
	radio.stopListening();
	radio.flush_tx();
	
	radio.openWritingPipe(buttonAddress[butID]);

	rslt = radio.write(&dataToSend, sizeof(dataToSend));

	if (rslt) {
		if (radio.isAckPayloadAvailable()) {
			radio.read(&ackData, sizeof(ackData));
			newData = true;
		}
		else {
			Serial.println("  Acknowledge but no data ");
		}
	}
	else {

		Serial.println("  Tx failed");
	}
	//We start the listening again
	radio.startListening();
}

//****************************************

int byte2Int(byte* in, int from, int to) {

	int lgt = to - from + 1;

	char nb[lgt];

	for (int i = 0; i < lgt;) {
		if (isDigit(in[from])) {
			nb[i] = in[from];
			i++;
		}
		from += 1;
	}

	int result = atoi(nb);

	return result;
}

Rx code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <ctype.h>

#define LED_PIN 3 //Set LED pin nr
#define RF_POWER_PIN 4 //RF module power pin
#define CE_PIN A1
#define CSN_PIN A0

//RF24
const byte masterAddress[6] = { 'S','R','V','0','0' };
byte thisButtonAddress[6] = { 'B','T','N','0','2' };


RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataReceived[6]; // this must match dataToSend in the TX

bool newData = false;

volatile int ledState = LOW;    // ledState used to set the LED

int RcvCnt = 0;

//****************************************

void setup() {
	
	pinMode(RF_POWER_PIN, OUTPUT);           // set pin to output
	digitalWrite(RF_POWER_PIN, HIGH);       // turn on pullup resistors

	delay(1500);	// Give bootloader some time to run.

	Serial.begin(115200);

	Serial.print("BTN");
	Serial.print((char)thisButtonAddress[3]);
	Serial.println((char)thisButtonAddress[4]);

	pinMode(LED_PIN, OUTPUT); //Led pin

	radio.begin();
	radio.setDataRate(RF24_250KBPS);
	radio.setPALevel(RF24_PA_MAX);
	radio.setChannel(125);
	radio.openReadingPipe(1, thisButtonAddress);
	radio.enableAckPayload();
	radio.setRetries(15, 15); // delay, count
	radio.startListening();
	radio.openWritingPipe(masterAddress);
}

//****************************************

void loop() {

	if (radio.available()) {

	Serial.println(radio.available());
	radio.read(&dataReceived, sizeof(dataReceived));

	// Output result
	Serial.println(dataReceived);

	int order = byte2Int(dataReceived, 3, 4);


	RcvCnt++;
	Serial.print("Button order received: ");
	Serial.print(order);
	Serial.print(" - n° ");
	Serial.println(RcvCnt);

	switch (order) {

	case 22://Led blink once FAST
		break;

	case 66://Reset counter
		RcvCnt = 0;
		break;

	}
}


}



//****************************************

int byte2Int(byte* in, int from, int to) {

	int lgt = to - from + 1;

	char nb[lgt];

	for (int i = 0; i < lgt;) {
		if (isDigit(in[from])) {
			nb[i] = in[from];
			i++;
		}
		from += 1;
	}

	int result = atoi(nb);

	return result;
}

//****************************************

All my sequence array tests I made with results :

//int asd[] = { 4,3,5,2,4,5,1,4,2,1,4,2,1,5,3,4,2,1,4,5,2,4,5,2,4,5,1,4,2,1,4,2,1,5,3,4,2,4,1 };//not OK, 1 missing, tested 20 times
//int asd[] = { 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 }; //OK
//I changed randomly a 4 by another number one by one, five tests each time
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,4,5,1,4,4,6,4,4,4,3,4,4,4,7,4,3,4,4,4,4,1,4,4,4,1 }; //OK ...4,2,4,4,5...
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4,4,6,4,4,4,3,4,4,4,7,4,3,4,4,4,4,1,4,4,4,1 }; //Not OK ...4,2,4,2,5... tested 20 times
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4,4,6,4,4,4,3,4,4,4,7,4,3,4,4,4,4,1,4,4,4 };//Not OK
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4,4,6,4,4,4,3,4,4,4,7,4,3,4,4,4,4,1,4,4 };//Not OK
//I've continued to remove the last digit one by one to identify the 4 not working (5 tests each times)
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };// Not OK, tested 20 times
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1 }; // OK tested 20 times
//int asd[] = { 4,5 };//removed last number until this list, all OK
//I started again with the latest non working set
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };// Not OK , just to confirm...
//I've replaced the 2 that has created the first fail by a 4 again
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,4,5,1,4 };//OK, tested 20 times
//So... I've started to remove numbers one by one from the beginning of the set
//int asd[] = { 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };//Not OK as expected, but we never know....
//int asd[] = { 5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };//Not OK
//int asd[] = { 4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };//Not OK
//int asd[] = { 1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };//Not OK

//int asd[] = { 4,2,5,1,4 };//Still not working, it's the last four not blinking
//changed the 1 by 2
//int asd[] = { 4,2,5,2,4 };//Not working
//Added a 1 in front
//int asd[] = { 1,4,2,5,1,4 };//Not working, but now the second 1 is not blinking too
//Added a 2 at the end
//int asd[] = { 1,4,2,5,1,4,2 };//Nothing blink after the 5
//Changed 5 to 3
//int asd[] = { 1,4,2,3,1,4,2 };//no change, nothing blink after the 3
//I've tested this suite manually with my remote, same result, the buttons after the 3 doesn't received the msg, even if Tx say acknowledge is received.
//int asd[] = { 1,4,2,2,1,4,2 };//no change, nothing blink after the 2
//int asd[] = { 1,4,2,1,1,4,2 };//no change, nothing blink after the 1
//Tried with a btn not turned ON
//int asd[] = { 1,4,2,7,1,4,2 };//no change, nothing blink after the 7,this one is well reported with Tx Failed
//int asd[] = { 1,4,2,4,1,4,2 };//Now all the 4 are blinking, but second 1 & 2 not
//int asd[] = { 1,4,2,1,4,2 };//OK, all btn are blinking.........

//Turned OFF the ON btn 1,2,4
//int asd[] = { 1,4,2,4,1,4,2 };//No change, 1&2 still not blinking the second time.
//Tried to power the button 1 with USB, reloaded the code on the IC and traced btn 1 on Tx side.
//Tx say acknowledge OK for the two msg sent to btn 1, but btn 1 only received 1 msg
//Changed the nRF24 module on btn 1, no difference.

Alkerion:
Example, with sequence "1,2,2,2,1,1,1" the second msg to module 1 is sent, acknowledged, but module 1 doesn't received the msg.

The module does receive the packet, it even acks it.

But as it has the same crc and the same packet id (2 bit field) as the last, it is regarded as duplicate.

DupPacket.png

Add a field to you packet that changes between each send and your problem is gone.

Whandall:
The module does receive the packet, it even acks it.

But as it has the same crc and the same packet id (2 bit field) as the last, it is regarded as duplicate.
Add a field to you packet that changes between each send and your problem is gone.

OK, but how do you explain the a full sequence of 1000 exact same msg sent to the same btn are all received ?

Examples :

1,4,2,1,4,2 //OK, all btn are blinking......

1,1,1,1,1,1... //all msg received

1,2,3,4,5,1,2,3,4,5... // all msg received

But:

1,4,2,5,1,4,2 //Nothing blink after the 5, reproductible manually with my IR remote too

Same id and same crc = duplicate, the id is counted up on each send.
Only one target -> all ids are different, it works, regardless of the crc.

Try 1,2,3,4, 1,2,3,4, 1,2,3,4 :wink:

Take care that the crc is different as already noted and all is good.

We must be able to send the exact same msg over and over again, it's not the same write() request, so the msg musn't be seen as a duplicate, it must be considered as different.

1,2,3,4,1,2,3,4 works perfect, look at all my tests, you will see that the results are crazy.

I found that :

Alkerion:
We must be able to send the exact same msg over and over again, it's not the same write() request, so the msg musn't be seen as a duplicate, it must be considered as different.

If you disagree with the datasheet, you should contact Nordic.

Alkerion:
1,2,3,4, 1,2,3,4 works perfect

With a constant message and no other transmissions it wont.

There is no timeout built into the above behaviour, so even if the same packet with the same id arrives
ten hours later, it will still be regarded as ack-lost-duplicate.
It will be acked, but not signaled as a new reception.

OK for the behavior during one write() request, but not for different requests.

For me it's well explained in the link I just post above.

1000x the exact same msg sent to the same module and all msg well received, if I consider your theory only 1 msg should have been received.

If I do {1,4,2,4,1,4,2} all the 4 are blinking, but second 1 & 2 not

In the two following sequence just swapped a 4 by a 2 :

{ 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,2,5,1,4 };// Not OK, last 4 not received
{ 4,5,4,1,2,4,2,5,4,5,3,4,1,4,1,2,4,5,4,1,4,5,4,2,4,4,5,1,4 } //OK, all 4 received

Etc, etc....

It's 100% logical that you can send the exact same query to the same module over and over, non sense to consider another exact same write() query as a duplicate.

The fact that 1,1,1,1,1,1,.... and 1,2,3,4,5,1,2,3,4,5,.... works perfect prove it to me.

Problem is elsewhere (perhaps between the keyboard and chair...)

Alkerion:
1000x the exact same msg sent to the same module and all msg well received, if I consider your theory only 1 msg should have been received.

I explicitly told you the contrary.

Whandall:
Only one target -> all ids are different, it works, regardless of the crc.

It is the combination of the constant packet content and the same id received back to back.
The id increments on each send, so only the 4th send is 'poisoned'.

The fact that 1,2,3,4, 1,2,3,4, 1,2,3,4, 1,2,3,4, ... fails miserably should convice you.
On all nodes there will be at most 1 packet, depending on the state of the module at the start of the test.
Remember that the NRF will only really reset when it is power cycled,
the last CRC and id will survive a sketch change.

1,2,3,4,5,1,2,3,4,5 proves nothing, the 5 makes that work.

We have discussed the effect in another thread some time ago nRF24L01 - Network problem #43
Just for reference.

You added random to the sending sequence, which made the effects random.

Add a counting field to your packet (I use a byte) that you increment with each send,
then the false-lost-ack-effect can not happen and the sequence of sends doesn't matter any more.

OK, all my apologies

You're right, my mistake.

I've tested 1,2,3,4,1,2,3,4... and effectively as you said it doesn't works but 1,2,3,4,5,1,2,3,4,5... works.

So I've read again and again carefully what you wrote and I've tried to understand what I've missed.

Except the fact that the reasons for this implementation still escape me, changing one char in the msg effectively solve the issue.

Following your suggestion I've just added a line in my function:

void updateMessage(char order[]) {
	dataToSend[2] = random(65, 90); //Add random char to avoid Rx considering the msg as a duplicate
	dataToSend[3] = order[0];
	dataToSend[4] = order[1];
}

I would have never found that by myself, so thanks you for insisting.

Regards

Don't use random for the variable field, that has the chance of generating the same packet,
a simple increment works better and is faster. :wink:

I would use a struc for the packet(s), arrays have too many magic numbers.
A well named struct field documents the code.

It would be nice if you would add [solved] to the thread title.