modem.joinOTAA hangs up

The following code is from the LoraSendAndReceive example sketch. Similar code in the FirstConfiguration sketch.
I modified both sketches for my frequency band (tried both US915 and US915_HYBRID) and used my APP EUI and APP Key as required.

  int connected = modem.joinOTAA(appEui, appKey);
  if (!connected) {
    Serial.println("Something went wrong; are you indoor? Move near a window and retry");
    while (1) {}
  }

The problem in both sketches is the modem.joinOTAA times out. Either I get the "something went wrong" error message after about 30 seconds or the Monitor just disconnects after a few minutes and the code goes no further. Most of the time the latter.

I have a RAK7258 set up for Basic protocol (didn't work for UDP either). Using the Arduino MKR1310.

Despite that code problem I do seem to get connected to some extent.
On the TTN Console I see my Gateway status as "connected" (most of the time) and "last seen" gets updated when I execute the program along with one increment of the "Received" and "Transmitted" messages. (again most of the time). The Gateway "Traffic" shows transactions.
My Device Applications Data on the Console contains some kind of data as well.
I am > 3m between the Gateway and the MKR1310 but still just a room away.

It is all very inconsistent except that the modem.joinOTAA doesn't ever seem to join.

Is there something I am missing in the MKR1310 setup, Gateway setup, or TTN setup?

TIA!

So now everything is consistent but consistently broken!
This step in the LoraSendAndRecieve sketch hangs always.

  int connected = modem.joinOTAA(appEui, appKey);

I can confirm that I never get back into my sketch when this join is called. Somewhere in modem.joinOTAA it hangs.
I have double checked my appEui and appKey are correct from TTN.
I have confirmed that the devEui is correct in TTN
I have tried US915 and US915_Hybrid
I have tried including MKRWAN.h and MKRWAN_v2.h
I have added a 10 second delay between modem.begin and modem.joinOTAA
modem.begin, modem.version, and modem.deviceEUI all seem to work.
My RAK7258 is registered and connected on TTN.
The system log of the RAK doesn't seem to notice a join attempt.
I cant find anything directly related in my forum and internet searches.
Any help out there? Similar problems? Tips to try?

Root problem solved!
I live in snow country so my house has a metal wainscot around the base of the house. My gateway was in the house but near the outside wall. My MKR1310 was also inside the house and the metal wainscot WAS NOT between the two. I suspect that the metal was causing some reflections or other distortions to the signal. When I move the gateway and the MKR1310 up to the 2nd floor I have 100% connection rate and successful up/down links.
It would still be good if it was better documented what modem.join is doing when it is hanging and maybe add a debug mode where it prints out what is going on.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.