Raw LoRa communication between RFM95 and RN2483


(Karolalexander) #1

Hi All,

Can someone help me ?

I’m trying to communicate between a feather 32u4 LoRa (rfm95 module) and rn2483.

When communicating between two feather (RFM95) with raw LoRa => OK.
When communicating between two RN2483 with raw LoRa => OK
But when communicating between a feather and rn2483 => Fail

I can’t find the solution…All the modules have the same settings (frequency: 868.0 ; cr4/5 ; sf7 ; bw125 ; crc ON). I Have tried with RTL SDR dongle to observe somethink but nothing strange appear… I realy don’t know where to find the problem.
Maybe there is difference in PREAMBLE size or SYNC-WORD but the RH_RFM95 library doesn’t give any function to change it.

Does someone have faced something like that ?

Here the arduino source code of the Feather:

include SPI.h
include RH_RF95.h

/* for feather32u4 */
define RFM95_CS 8
define RFM95_RST 4
define RFM95_INT 7

// Change to 434.0 or other frequency, must match RX’s freq!
#define RF95_FREQ 868.0

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);

void setup()
{
pinMode(RFM95_RST, OUTPUT);
digitalWrite(RFM95_RST, HIGH);

while (!Serial);
Serial.begin(9600);
delay(100);

Serial.println(“Feather LoRa TX Test!”);

// manual reset
digitalWrite(RFM95_RST, LOW);
delay(10);
digitalWrite(RFM95_RST, HIGH);
delay(10);

while (!rf95.init()) {
Serial.println(“LoRa radio init failed”);
while (1);
}
Serial.println(“LoRa radio init OK!”);

// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
if (!rf95.setFrequency(RF95_FREQ)) {
Serial.println(“setFrequency failed”);
while (1);
}
Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);

// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
rf95.setTxPower(23, false);
rf95.setPreambleLength(8);
}

int16_t packetnum = 0; // packet counter, we increment per xmission

void loop()
{
Serial.println(“Sending to rf95_server”);
// Send a message to rf95_server

char radiopacket[20] = "Hello World # ";
itoa(packetnum++, radiopacket+13, 10);
Serial.print("Sending "); Serial.println(radiopacket);
radiopacket[19] = 0;

Serial.println(“Sending…”); delay(10);
rf95.send((uint8_t *)radiopacket, 20);
Serial.println(“Sending Ok”);
delay(3000);
}

For the rn2483, I just send the followings commands:

mac pause
radio set freq 868000000
radio rx 0

Best Regards,
Alexander


(Karolalexander) #2

I just found the solutions:

RFM95 and RN2483 were configured with different Synchronisation Word. Default for the RFM95 is 0x12 and for the RN2483 0x39.

If your using the RadioHead library, in the initialisation code, just add: spiWrite(RH_RF95_REG_39_SYNC_WORD, 0x39);


(Arjan) #3

A post was split to a new topic: Does the RFM95 need a minimum delay between switching from Tx to Rx?


(Arjan) #4

A post was merged into an existing topic: Does the RFM95 need a minimum delay between switching from Tx to Rx?


(D00m) #5

Hi,
just want to ask - where did you find information about Default Lora Word for RFM95?
in RadioHead library I found only one mention about Lora Words only in RH_RF95.cpp :

// Set up default configuration
// No Sync Words in LORA mode.
setModemConfig(Bw125Cr45Sf128); // Radio default

(LoRaTracker) #6

The RFM95 ‘datasheet’ is not complete, you will find the default sync word defined in the SX1276 datasheet.

If the Radiohead library does not set the sync word, then the default will be used.


(D00m) #7

thanks, if I understand all correct - LoRa Sync Word from SX1276 datasheet is 0x12?


page 91 and page 115

So in RadioHead lib should has the same value?


(LoRaTracker) #8

I have not been through the RadioHead library myself to check if it sets or changes the Sync word or not, so as I said above;

“If the Radiohead library does not set the sync word, then the default will be used”


(Omarl) #9

Hi,
Perhaps this is a new topic, but it is very similar…
I am using the RN2483 (microchip) and the RFM96. Both are controlling by Arduino using the UART and SPI. I set up a raw communication using Lora (not Lorawan). The RN2483 is TX and RFM96 is RX.
Parameters, like: Freq, SF, CR, Sync word, bit rate, BW, channel, preamble length, CRC on… are the same in both devices.
The problems is that seems to loose some data packets. The TX sends data every second. In the RX side, I got a packet randomly between 30 and 120 seconds.

Could someone give some guides or some clue to understand what is going on?
Something related to timing window? or Time on air? etc.
Thanks
Omar


(Absar) #11

Hi,

I am also trying sometime same like you did, but with no success, can you please guide me, i am trying feather rfm95 and rn2483 with LoRa tx, i guess the problem is same as you have pointed out with sync word, but i am not able to set sync word for rfm95, maybe radio head library that i am using is not correct, it gives error with i include spiWrite(RH_RF95_REG_39_SYNC_WORD, 0x39); can you guide me please, my code is, i am using setModemConfig(Bw125Cr48Sf4096);–>sf12 on my rf95.

// Feather9x_RX
// -- mode: C++ --
// Example sketch showing how to create a simple messaging client (receiver)
// 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 Feather9x_TX

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

/* for feather m0 RFM9x*/
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 3

// Change to 434.0 or other frequency, must match RX’s freq!
#define RF95_FREQ 868.0

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);

// Blinky on receipt
#define LED 13

void setup()
{
pinMode(LED, OUTPUT);
pinMode(RFM95_RST, OUTPUT);
digitalWrite(RFM95_RST, HIGH);

Serial.begin(57600);
while (!Serial) {
delay(1);
}
delay(100);

Serial.println(“Feather LoRa RX Test!”);

// manual reset
digitalWrite(RFM95_RST, LOW);
delay(10);
digitalWrite(RFM95_RST, HIGH);
delay(10);

while (!rf95.init()) {
Serial.println(“LoRa radio init failed”);
while (1);
}
Serial.println(“LoRa radio init OK!”);

// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
if (!rf95.setFrequency(RF95_FREQ)) {
Serial.println(“setFrequency failed”);
while (1);
}
Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);

// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
rf95.setTxPower(13, true);
//rf95.setPromiscuous(true);
rf95.setPreambleLength(8);

}

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("Received: ", buf, len);
Serial.print("Got: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(rf95.lastRssi(), DEC);
// // Send a reply
// uint8_t data[] = “And hello back to you”;
// rf95.send(data, sizeof(data));
// rf95.waitPacketSent();
// Serial.println(“Sent a reply”);
// digitalWrite(LED, LOW);
}
else
{
Serial.println(“Receive failed”);
}
}
}


#12

what is the relation with TTN and please format your post


(LoRaTracker) #13

You asked the same question over in the Arduino forums,

The advice here is the same, prove that you have the Arduino RadioHead library RX program working first with a matching RadioHead TX, before trying to read packets from the RN2483.

Please appreciate that this is a support forum for The Things Network applications, not the general purpose Arduino libraries.