0

Help with Adafruit mo LoRa RF95 programming
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Help with Adafruit mo LoRa RF95 programming

by ahahmar on Sun Mar 10, 2019 11:29 am

I am trying to receive the radio packets on my adafruit mo LoRa transmitter , sent from microchip LoRa development board, but it seems like it is not receiving any radio packets, any suggestions? i modified the init() settings too,

Code: Select all | TOGGLE FULL SIZE
// 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

LoRa Rx Code:

#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.1

// 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);
}

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");
    }
  }
}
Attachments
Screenshot 2019-03-10 at 4.21.56 PM.png
Screenshot 2019-03-10 at 4.21.56 PM.png (18.02 KiB) Viewed 229 times
Last edited by franklin97355 on Sun Mar 10, 2019 12:46 pm, edited 1 time in total.
Reason: Please use code tags when posting code or logs to the forums. It preserves formatting and makes it easier for everyone to read the code. Click the code button above the reply box and past your code between the tags created.

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by jerryn on Sun Mar 10, 2019 1:49 pm

Just a suggestion - I am not familiar with the MicroChip board so this may not be relevant:

Does the MicroChip board send packets that are compatible with the RadioHead format? If they don't have the expected packet header, the RH_RF95 library will ignore the packet"
see https://github.com/adafruit/RadioHead/blob/master/RH_RF95.cpp#L209

You could try enabling "promiscuous" mode so the header is ignored (note, the first 4 bytes will be stripped off)
after this line

Code: Select all | TOGGLE FULL SIZE
  rf95.setTxPower(13, true);

add this line
Code: Select all | TOGGLE FULL SIZE
  rf95.setPromiscuous(true);


You may see some packets....
Good luck!

jerryn
 
Posts: 972
Joined: Sat Sep 14, 2013 9:05 am

Re: Help with Adafruit mo LoRa RF95 programming

by ahahmar on Sun Mar 10, 2019 1:55 pm

Thank you! still i cannot see anything,,,, :(
Attachments
Screenshot 2019-03-10 at 6.48.13 PM.png
Screenshot 2019-03-10 at 6.48.13 PM.png (223.54 KiB) Viewed 216 times

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by jerryn on Sun Mar 10, 2019 1:59 pm

It was worth a try -- do you have any information on what the microchip board is sending?

is the sf12 setting compatible with the receiving board?

jerryn
 
Posts: 972
Joined: Sat Sep 14, 2013 9:05 am

Re: Help with Adafruit mo LoRa RF95 programming

by ahahmar on Sun Mar 10, 2019 2:09 pm

just an update, i received this now only once, and i am not sure how, but after this again no success,,,,
Attachments
Screenshot 2019-03-10 at 6.55.42 PM.png
Screenshot 2019-03-10 at 6.55.42 PM.png (182.36 KiB) Viewed 212 times

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by jerryn on Sun Mar 10, 2019 2:18 pm

Is the microchip board generating LoRaWAN packets? Is it using a single frequency?
I don't think the Radiohead library is not compatible with LoRaWan - at least not as you are using it.

also as noted above, are the SF settings compatible?

Do you have a link to information about what the microchip board is doing?

jerryn
 
Posts: 972
Joined: Sat Sep 14, 2013 9:05 am

Re: Help with Adafruit mo LoRa RF95 programming

by ahahmar on Sun Mar 10, 2019 2:31 pm

I had disabled LoRaWAN and only sending LoRa radio packets, https://github.com/drotek/RN2483/blob/m ... RN2483.cpp,
http://ww1.microchip.com/downloads/en/d ... 02346c.pdf
http://jensd.be/download/RN2483_Command_Reference.pdf

on radio head also i enable the following settings : setModemConfig(Bw125Cr48Sf4096); and checked the same settings on my microchip module too,,,

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by jerryn on Sun Mar 10, 2019 3:00 pm

Ah -- thanks for clarifying
All I can think of is there is still some incompatibility on the packet formats.
I don't see anything equivalent to the radiohead header being set on the transmitter.
Also the screen shot shows very short messages but the one received packet is much longer.
I'm all out of ideas - I wish I had something else to suggest.
Good luck!

jerryn
 
Posts: 972
Joined: Sat Sep 14, 2013 9:05 am

Re: Help with Adafruit mo LoRa RF95 programming

by ahahmar on Sun Mar 10, 2019 3:54 pm

one last thing, do i need to set lora modulation or gfsk, as i can see rf95 radio head uses gfsk mod type, and my microchip is using lora mod, how can i set sf settings in radiohead?
Attachments
Screenshot 2019-03-10 at 8.46.18 PM.png
Screenshot 2019-03-10 at 8.46.18 PM.png (113.43 KiB) Viewed 184 times

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by jerryn on Sun Mar 10, 2019 4:24 pm

I don't know how to set SF for radiohead, but can you set the Mode to fsk for the microchip? see section 2.5.4.2 of the command guide

jerryn
 
Posts: 972
Joined: Sat Sep 14, 2013 9:05 am

Re: Help with Adafruit mo LoRa RF95 programming

by ahahmar on Mon Mar 11, 2019 4:46 am

may be the issue is with sync word, in microchip sync word is set to 0x34, and as i read for rf95 in radio head it seem that syn word is 0x12, do you have any idea how can i set sync word in radio head library,,,

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by ahahmar on Mon Mar 11, 2019 9:07 am

Just an update!!! its fixed and working now, it was due to sync work and preamble length, i make few changes on radiohead and now i am receiving packets, Thank you,

ahahmar
 
Posts: 7
Joined: Sun Mar 10, 2019 11:19 am

Re: Help with Adafruit mo LoRa RF95 programming

by jerryn on Mon Mar 11, 2019 9:14 am

Congratulations! Glad you have it working -- Good luck with your project!.
Just out of curiosity, did you end up getting setting the SF on the RadioHead or switching the MicroChip to fsk -- or something else?

jerryn
 
Posts: 972
Joined: Sat Sep 14, 2013 9:05 am

Please be positive and constructive with your questions and comments.