nRF24L01+ how to send blank data (send 0x00 not working)

Hi,

I want to send the raw data from DHT22 and DS18B20 with nRF24l01+.
The issue is: if there is a 0x00 data in my payload, the data from the 0x00 and the following are not received by the second nRF24L01+. If the payload contains values different of 0x00, i receive all the 10 datas. If, for example, the data of byte 2 is 0x00, the data from byte 2 to 9 are not received.
I use the tmrh20 library.
In the printfDetails of the receiver, all is OK as configured (and not in dynamic payload).

Is it a problem of configuration OR the nRF24L01+ manage the data in this way and i have to manage the 0x00 data ?

Thanks !

Receiver board (part of program:)

RF24 radio(8, 9);
const uint64_t TxArrosage = 0x1111111111;   //adresse pipe: p38/75 datasheet nRF24L01+
const uint64_t RxArrosage = 0x2222222222;
const int payloadnRF = 10;
const uint8_t AddressWidth = 3;                         //nbre d'octets pour adresse
byte nRFBuffer[payloadnRF]; 

setup:
....
radio.begin();
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);                    //!!setting RF24_250KBPS will fail for non-plus units
radio.setPayloadSize(payloadnRF);
radio.setAddressWidth(AddressWidth); 
radio.openWritingPipe(TxArrosage);                    //emission sur pipe0
radio.openReadingPipe(1,RxArrosage);
radio.startListening();
....
loop:
....
while ( radio.available() ){

// while ( radio.available(1) ){
Serial.println("payload size");
uint8_t payloadSize = radio.getPayloadSize();
Serial.println(payloadSize);

radio.printDetails();

Serial.println("Paquet nRF reçu");

radio.read(nRFBuffer,payloadnRF);
//Serial.println((char *)nRFBuffer);
for (byte i=0; i<10; i++){Serial.print(nRFBuffer[i]);}
.....

Panneau_Serre.ino (6.72 KB)

Have a look at this Simple nRF24L01+ Tutorial.

I think your code can be simpler.

…R

You have right, i wrote the following code and i can send/receive the 0x00 data.
I just have to find the problem in my previous code that I was thinking simple.
Thanks

nRF24L01_1:
#include <SPI.h>
#include “nRF24L01.h”
#include “RF24.h”

RF24 radio(8,9); //CE,CS
const uint64_t RxArrosage = 0x1111111111; //adresse pipe: p38/75 datasheet nRF24L01+
const uint64_t TxArrosage = 0x2222222222;
const uint8_t payloadnRF = 10;
const uint8_t AddressWidth = 3; //nbre d’octets pour adresse
uint8_t nRFBuffer[payloadnRF];

unsigned long time_message;

void setup(void)
{
Serial.begin(115200);
Serial.println(“Emetteur de donnees”);

radio.begin();
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS); //!!setting RF24_250KBPS will fail for non-plus units
radio.setPayloadSize(payloadnRF);
radio.setAddressWidth(AddressWidth);
radio.openWritingPipe(TxArrosage); //emission sur pipe0
radio.openReadingPipe(1,RxArrosage);
Serial.println(“Fin setup”);
}

void loop(void)
{
radio.startListening();

while ( radio.available()){
Serial.println(“Reçu”);
radio.read(nRFBuffer,payloadnRF);
for (byte i=0; i<10; i++){Serial.print(nRFBuffer*);Serial.print(’,’);}*

  • radio.stopListening();*
    _ for (byte i=0; i<10; i++) nRFBuffer*++;_
    _
    radio.write(nRFBuffer,payloadnRF);_
    _
    }_
    _
    }[/color]_
    nRF24L01_2:
    _
    #include <SPI.h>_
    _
    #include “nRF24L01.h”_
    _
    #include “RF24.h”_
    RF24 radio(8, 9);
    const uint64_t TxArrosage = 0x1111111111; //adresse pipe: p38/75 datasheet nRF24L01+
    const uint64_t RxArrosage = 0x2222222222;
    const uint8_t payloadnRF = 10;
    const uint8_t AddressWidth = 3; //nbre d’octets pour adresse
    uint8_t nRFBuffer[payloadnRF];
    unsigned long time_message;
    void setup(void)
    _
    {_
    _
    Serial.begin(115200);_
    _
    Serial.println(“Recepteur RF24”);_
    _
    radio.begin();_
    radio.setPALevel(RF24_PA_LOW);
    radio.setDataRate(RF24_250KBPS); //!!setting RF24_250KBPS will fail for non-plus units*

    * radio.setPayloadSize(payloadnRF);*
    * radio.setAddressWidth(AddressWidth);*
    * radio.openWritingPipe(TxArrosage); //emission sur pipe0*
    * radio.openReadingPipe(1,RxArrosage);*
    * Serial.println(“Fin setup”);*
    * time_message = millis();
    _
    }_
    void loop(void)
    _
    {_
    if (millis() - time_message > 1000){
    _
    radio.stopListening();_
    _
    Serial.print("Ping … ");_
    _
    nRFBuffer[0]=1;_
    _
    nRFBuffer[1]=2;_
    _
    nRFBuffer[2]=4;_
    _
    nRFBuffer[3]=6;_
    _
    nRFBuffer[4]=8;_
    _
    nRFBuffer[5]=0;_
    _
    nRFBuffer[6]=12;_
    _
    nRFBuffer[7]=14;_
    _
    nRFBuffer[8]=16;_
    _
    nRFBuffer[9]=18;_
    _
    radio.write(nRFBuffer,payloadnRF);_
    time_message = millis();
    _
    }_
    _
    radio.startListening();_
    _
    while ( radio.available() )_
    _
    {_
    _
    radio.read(nRFBuffer,payloadnRF); _
    _
    Serial.println("Pong: ");_
    _ for (byte i=0; i<10; i++){Serial.print(nRFBuffer);Serial.print(’,’);}
    }
    }[/color]*_

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Also use the AutoFormat tool to indent your code for easier reading.

And I am confused …
Is the code in Reply #2 the working code?

If it works, why bother with the earlier version?
If you do want to figure out what is wrong with the earlier version then compare them carefully

…R