Skip to content

Receiving data on a closed pipe. #913

@msobarzo

Description

@msobarzo

I have a problem where I receive a packet on a closed pipe. Initially I noticed this problem in the context of transmitting a large array but currently I have the same problem even though I'm sending an increasing integer.
Right now I'm using a very basic program because I wanted to reproduce the problem and try to identify the cause.

I'm currently using the nRF24L01+PA+LNA connected to 3v3 pin of the ESP32. The ESP32 is being powered from the USB port of my laptop and I have also tested with different modules.

The problem is I see the output in my receiver code, but sometimes I see the the correct value but is being received on pipe 5, this happens randomly. Also the settings on both modules are the same, I checked using the radio.printPrettyDetails();

This is my transmitter code

#include <SPI.h>
#include <Arduino.h>
#include <RF24.h>
// #include <RF24Network.h>
#include <printf.h>

// create an RF24 object
RF24 radio(5, 17); // CE, CSN  

// address through which two modules communicate.
const uint64_t address = 0x7878787878LL;

void setup()
{
  Serial.begin(115200);

  radio.begin();
  if (!radio.isChipConnected())
  {
    Serial.print("Chip not connected.");
  }
  radio.setPALevel(RF24_PA_MIN);
  radio.setChannel(80);
  radio.stopListening();
  radio.openWritingPipe(address);
  radio.printPrettyDetails();
}

int msgNumber = 0;

void loop()
{
  bool ok = radio.write(&msgNumber, sizeof(msgNumber));
  if (ok)
  {
    Serial.println("Message sent");
  }
  else
  {
    Serial.println("Message not sent");
  }
  msgNumber++;
  delay(100);
}

This is my receiver code

#include <Arduino.h>
#include <SPI.h>
#include <RF24.h>

RF24 radio(17, 2, 2000000); // CE, CSN  (For the S3 version)

// address through which two modules communicate.
const uint64_t address = 0x7878787878LL;

RF24 radio(5, 17); // CE, CSN

void setup()
{
  Serial.begin(115200);
  radio.begin();
  if (!radio.begin())
  {
    Serial.println("radio hardware is not responding!!!");
    while (1)
    {
    } // hold in infinite loop
  }
  if (!radio.isChipConnected())
  {
    Serial.print("Chip not connected.");
  }
  radio.setPALevel(RF24_PA_MIN);
  radio.openReadingPipe(1, address);
  radio.startListening();
  radio.setChannel(80);
  radio.printPrettyDetails();
}


uint8_t pipe_rx;
int packet;

void loop()
{
  if (radio.available(&pipe_rx))
  {
    radio.read(&packet, sizeof(packet));

    if (pipe_rx > 1)
    {
      Serial.print("PACKET ON PIPE: ");
      Serial.println(pipe_rx);
      Serial.println(packet);
    }

    if (pipe_rx == 1)
    {
      Serial.print("CORRECT PIPE: ");
      Serial.println(packet);
    }
  }
}

Finally, this is the output of radio.printPrettyDetails() on my receiver code.

SPI Frequency = 10 Mhz
Channel = 80 (~ 2480 MHz)
Model = nRF24L01+
RF Data Rate = 1 MBPS
RF Power Amplifier = PA_MIN
RF Low Noise Amplifier = Enabled
CRC Length = 16 bits
Address Length = 5 bytes
Static Payload Length = 32 bytes
Auto Retry Delay = 2750 microseconds
Auto Retry Attempts = 15 maximum
Packets lost on
current channel = 0
Retry attempts made for
last transmission = 0
Multicast = Disabled
Custom ACK Payload = Disabled
Dynamic Payloads = Disabled
Auto Acknowledgment = Enabled
Primary Mode = RX
TX address = 0xe7e7e7e7e7
pipe 0 (closed) bound = 0xe7e7e7e7e7
pipe 1 ( open ) bound = 0x7878787878
pipe 2 (closed) bound = 0xc3
pipe 3 (closed) bound = 0xc4
pipe 4 (closed) bound = 0xc5
pipe 5 (closed) bound = 0xc6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions