Struggling with Lora P2P with a 4631


I’m just getting started with implementing a simple p2p LoRa setup with a Wisblock 4631 and a Dragino LG01-N gateway.

I am aware that this gateway doesn’t support LoRaWAN.

I have the Arduino IDE configured and have uploaded the Rakwireless example TX sketch from here:
WisBlock/examples/RAK4630/communications/LoRa/LoRaP2P at master · RAKWireless/WisBlock · GitHub.

The LG01 gateway is running a simple P2P server sketch, as below:

  LoRa Simple Yun Server :
  Support Devices: LG01. 
  Example sketch showing how to create a simple messageing server, 
  with the RH_RF95 class. RH_RF95 class does not provide for addressing or
  reliability, so you should only use RH_RF95 if you do not need the higher
  level messaging abilities.

  It is designed to work with the other example LoRa Simple Client

  User need to use the modified RadioHead library from:

  modified 16 11 2016
  by Edwin Chen <[email protected]>
  Dragino Technology Co., Limited
//If you use Dragino IoT Mesh Firmware, uncomment below lines.
//For product: LG01. 
#define BAUDRATE 115200

//If you use Dragino Yun Mesh Firmware , uncomment below lines. 
//#define BAUDRATE 250000

#include <Console.h>
#include <SPI.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
RH_RF95 rf95;

int led = A2;
float frequency = 915.2;

void setup() 
  pinMode(led, OUTPUT);     
  while (!Console) ; // Wait for console port to be available
  Console.println("Start Sketch");
  if (!rf95.init())
    Console.println("init failed");
  // Setup ISM frequency
  // Setup Power,dBm
  // Setup Spreading Factor (6 ~ 12)
  // Setup BandWidth, option: 7800,10400,15600,20800,31200,41700,62500,125000,250000,500000
  // Setup Coding Rate:5(4/5),6(4/6),7(4/7),8(4/8) 
  Console.print("Listening on frequency: ");

void loop()
  if (rf95.available())
    // Should be a message for us now   
    uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    if (rf95.recv(buf, &len))
      digitalWrite(led, HIGH);
      RH_RF95::printBuffer("request: ", buf, len);
      Console.print("got request: ");
      Console.print("RSSI: ");
      Console.println(rf95.lastRssi(), DEC);
      // Send a reply
      uint8_t data[] = "And hello back to you";
      rf95.send(data, sizeof(data));
      Console.println("Sent a reply");
      digitalWrite(led, LOW);
      Console.println("recv failed");

I’m not seeing any data receiving on the gateway end, despite the 4631 sketch showing me onTxDone messages.

As I’m new to this, my assumption is that I’m missing something simple. I have checked the LoRa parameters and they seem to be fine.

Welcome back @Wedgie32

In LoRa P2P there are multiple settings and I am missing the preamble length in your Dragino code.

Not sure if you are using Arduino or RUI3 on the RAK4631, but both set the preamble length and if it is different to the one on your Dragino, the packets will not be received.

Thanks beegee, I have checked and confirmed that both the TX and RX sides are using a preamble length of 8.

Do you have a second RAK4631 that you can use to test the P2P connection between them?

I don’t know much about the Dragino single channel gateway, I can’t help on that side.