RFM9x Initialization troubles

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
TruADTeam
 
Posts: 6
Joined: Wed Mar 01, 2023 4:02 pm

RFM9x Initialization troubles

Post by TruADTeam »

I purchased two RFM9x modules from adafruit and have been struggling to get them to initialize off of either my arduino uno or my PI. This is my first time working on a project with both a radio transceiver and arduino and I've had several people I know who've worked on arduino projects in the past to check and they can't outright see anything wrong so I'm turning here for a lot of help.

Things I have done to trouble shoot:
  • Triple check wiring
  • Triple check coding
  • Continuity through all the pins with a multimeter
  • Tried different arduino uno boards
  • swapped breadboards
  • swapped wires
At this point the only thing I can think of I did poorly was my solder job, but I get continuity from the pin through wires plugged into a breadboard. Find images and my code attached.

Code: Select all

// LoRa 9x_TX
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client (transmitter)
// 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 LoRa9x_RX

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

#define RFM95_CS 4
#define RFM95_RST 2
#define RFM95_INT 3

// Change to 434.0 or other frequency, must match RX's freq!
#define RF95_FREQ 915.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("Arduino 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);
}

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("Waiting for packet to complete..."); delay(10);
  rf95.waitPacketSent();
  // Now wait for a reply
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);

  Serial.println("Waiting for reply..."); delay(10);
  if (rf95.waitAvailableTimeout(1000))
  { 
    // Should be a reply message for us now   
    if (rf95.recv(buf, &len))
   {
      Serial.print("Got reply: ");
      Serial.println((char*)buf);
      Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);    
    }
    else
    {
      Serial.println("Receive failed");
    }
  }
  else
  {
    Serial.println("No reply, is there a listener around?");
  }
  delay(1000);
}
Image
Image
Image
Image
Image
Image

I've tried to include everything I could think of, the code I'm using is just the arduino demo from the adafruit page on it, i've tried swapping pins around, 4,3,2 and 10,9,2 and I get the same issue, LoRa init failed. If theres anything else I should include please let me know.

User avatar
adafruit_support_carter
 
Posts: 29170
Joined: Tue Nov 29, 2016 2:45 pm

Re: RFM9x Initialization troubles

Post by adafruit_support_carter »

It could be soldering related. The MISO pin looks potentially under soldered. See here for general ref:
https://learn.adafruit.com/adafruit-gui ... n-problems

Try reflowing MISO and see if that helps.

Also, just to verify what is current happening - when you run the sketch is outputs:

Code: Select all

LoRa radio init failed
in the Serial Monitor? Or something else?

User avatar
TruADTeam
 
Posts: 6
Joined: Wed Mar 01, 2023 4:02 pm

Re: RFM9x Initialization troubles

Post by TruADTeam »

Yes, when I run the sketch, it outputs that in the serial monitor. Should I try to apply more solder to the MISO pin and then test?

User avatar
adafruit_support_carter
 
Posts: 29170
Joined: Tue Nov 29, 2016 2:45 pm

Re: RFM9x Initialization troubles

Post by adafruit_support_carter »

Only add more solder if it seems like it's needed. The main issue is getting both the pin and pad hot so the solder that is there will flow and wet out nicely on both. It's looks like maybe the amount of solder is OK. So as a first pass, try just reheating what is there and focus on getting both the pin and pad hot.

Same applies for any pin that may have a similar issue.

User avatar
TruADTeam
 
Posts: 6
Joined: Wed Mar 01, 2023 4:02 pm

Re: RFM9x Initialization troubles

Post by TruADTeam »

I was able to get some of the solder to heat up and flow around so that the whole pad is covered, see below, I reran the code and still get the same error.

Image

User avatar
adafruit_support_carter
 
Posts: 29170
Joined: Tue Nov 29, 2016 2:45 pm

Re: RFM9x Initialization troubles

Post by adafruit_support_carter »

Thanks. That looks better.

There are no wiring connections in that photo. Was the radio module then placed back onto the same breadboard / wiring setup shown in the photo above with the UNO?

User avatar
TruADTeam
 
Posts: 6
Joined: Wed Mar 01, 2023 4:02 pm

Re: RFM9x Initialization troubles

Post by TruADTeam »

Yes, It was placed back into the same wiring connection as in initial post, if would like I can take pictures of that but it felt redundant as I didn't change any wiring and only adjusted the soldering so it would be an identical image.

User avatar
adafruit_support_carter
 
Posts: 29170
Joined: Tue Nov 29, 2016 2:45 pm

Re: RFM9x Initialization troubles

Post by adafruit_support_carter »

OK, let's double check soldering again.

Can you take another photo of the current soldering on the header pins. At slightly more of an angle instead of straight overhead.

User avatar
jerryn
 
Posts: 1869
Joined: Sat Sep 14, 2013 9:05 am

Re: RFM9x Initialization troubles

Post by jerryn »

Just a suggestion - try removing the RESET line toggle

Code: Select all

  // manual reset
  digitalWrite(RFM95_RST, LOW);
  delay(10);
  digitalWrite(RFM95_RST, HIGH);
  delay(10);
just to see if that makes a difference. I've had issues with that in the past and I don't usually find it necessary.

User avatar
TruADTeam
 
Posts: 6
Joined: Wed Mar 01, 2023 4:02 pm

Re: RFM9x Initialization troubles

Post by TruADTeam »

Image

Image

I tried my best to get them as clear as possible and more of an angle as I requested.

@jerry, i attempted that as you said, removing the manual reset lines, verified and uploaded them to the arduino and I still get the "LoRa radio init failed" output. including the updated code below to ensure i removed the correct lines.

Code: Select all

// LoRa 9x_TX
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client (transmitter)
// 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 LoRa9x_RX

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

#define RFM95_CS 4
#define RFM95_RST 2
#define RFM95_INT 3

// Change to 434.0 or other frequency, must match RX's freq!
#define RF95_FREQ 915.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("Arduino LoRa TX Test!");


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

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("Waiting for packet to complete..."); delay(10);
  rf95.waitPacketSent();
  // Now wait for a reply
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);

  Serial.println("Waiting for reply..."); delay(10);
  if (rf95.waitAvailableTimeout(1000))
  { 
    // Should be a reply message for us now   
    if (rf95.recv(buf, &len))
   {
      Serial.print("Got reply: ");
      Serial.println((char*)buf);
      Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);    
    }
    else
    {
      Serial.println("Receive failed");
    }
  }
  else
  {
    Serial.println("No reply, is there a listener around?");
  }
  delay(1000);
}

User avatar
adafruit_support_carter
 
Posts: 29170
Joined: Tue Nov 29, 2016 2:45 pm

Re: RFM9x Initialization troubles

Post by adafruit_support_carter »

Thanks for the photos. Unfortunately, it's most likely still the soldering. Looks like pad (the copper ring on the PCB) wetting is still maybe poor on some pins.

The CS pin looks good. It has the nice conical shape when both pad/pin are heated and soldered flows nicely on both. G0 and RST also look probably OK.

On the GND pin, some of the pad is still visible.

SCK and MOSI look a bit over soldered and balled up on the pin, indicating poor heating of the pad when soldering.

User avatar
TruADTeam
 
Posts: 6
Joined: Wed Mar 01, 2023 4:02 pm

Re: RFM9x Initialization troubles

Post by TruADTeam »

I will try to fix the soldering problems, I'm working on getting hold of a different soldering gun because I've been told the one I'm using currently is too hot, I will update as soon as I'm able to fix the soldering but it may be a couple of days, thank you for the help and tips, I am going to review the soldering guide linked earlier in the thread and do my best to fix it all.

User avatar
javalde
 
Posts: 4
Joined: Wed May 03, 2023 6:07 am

Re: RFM9x Initialization troubles

Post by javalde »

Hi,
I have a similar problem
I'm building up a loRA P2P net with a raspberry pico sending data to a RP4. At the moment I'm stuck with the pico and blinka. I'm able to wire the pico to the rfm9x and make it work with the circuitpython firmware in the pico. However, with the same wiring, I try use blinka with micropython and the "Failed to find rfm9x with expected version -- check wiring" error pops up.
3.3V OUTPUT----->3.3V
GND-------------->GND
GP18------------->SCK
GP19------------->MOSI
GP16------------->MISO
GP8-------------->CS
GP9-------------->RST
I've run the code you suggested (spi.lock and an ask for the version) and it works. The pico gives me the version 18 as it should but when I run through the RFM9x library... does not work
I would like to have this running with micropython so I can thread the things up.... but it looks like I cannot.
Any help?
Thanks!
Javi

User avatar
adafruit_support_carter
 
Posts: 29170
Joined: Tue Nov 29, 2016 2:45 pm

Re: RFM9x Initialization troubles

Post by adafruit_support_carter »

@javalde Please start a new thread for your issue.

User avatar
javalde
 
Posts: 4
Joined: Wed May 03, 2023 6:07 am

Re: RFM9x Initialization troubles

Post by javalde »

On it
Javi

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”