I’m attempting to connect my MKR WAN 1310 to The Things Stack (V3). The following code enables the MKR WAN to successfully connect to The Things Network V2:
#include <MKRWAN.h>
LoRaModem modem;
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
String appEui = "0000000000000000";
String appKey = "";
void setup() {
Serial.begin(9600);
while (!Serial);
if (!modem.begin(AU915)) {
Serial.println("Failed to start module");
while (1) {}
};
delay(5000);
Serial.print("Your module version is: ");
Serial.println(modem.version());
Serial.print("Your device EUI is: ");
Serial.println(modem.deviceEUI());
modem.sendMask("ff000001f000ffff00020000");
Serial.println(modem.getChannelMask());
modem.setADR(true);
join();
// Set poll interval to 30 secs.
modem.minPollInterval(30);
}
void join() {
int connected = modem.joinOTAA(appEui, appKey);
if (!connected) {
Serial.println("Something went wrong; are you indoor? Move near a window and retry. Retrying");
join();
}
}
void loop() {
delay(5000);
int err;
modem.setPort(3);
modem.beginPacket();
modem.print("HeLoRA world!");
err = modem.endPacket(true);
}
Looking into the MKRWAN library, I’ve been able to determine that the MKR WAN hangs on the join request:
bool join(uint32_t timeout) {
sendAT(GF("+JOIN"));
sendAT();
if (waitResponse(timeout, "+EVENT=1,1") != 1) {
return false;
}
return true;
}
After hanging for a minute as specified by #define DEFAULT_JOIN_TIMEOUT 60000L
, the program times out and gives the error Something went wrong; are you indoor? Move near a window and retry. Retrying
.
The “Live data” field in The Things Stack reports:
Type: Drop join-request
Data preview: Data rate not found
The Things Stack sees the MKR WAN (as shown by “Last seen X seconds ago”).
There have been previous issues with AU915 support on the MKR WAN. This is no longer an issue. My MKR WAN is running firmware ARD-078 1.2.3 which supports AU915.
I have tested the MKR WAN on two gateways, one operating on V2 and one operating on V3. I can confirm other devices connect successfully.
In V2, the console reports a join request (yellow lightning bolt), but no join accept (green lightning bolt) prior to packets being transmitted.
The MKR WAN is registered with the following network layer settings. I’ve chosen these based upon the info “From the LoRaWAN Device Repository”. Note that I created the device manually instead:
- LoRaWAN version: MAC v1.0.2
- Regional parameters version: PHY V1.0.2 REV A
- Frequency plan: Australia 915-928 MHz, FSB 2 (used by TTN)
- Activation mode: Over the air activation (OTAA)
I’ve been unable to find any documentation mentioning which LoRaWAN version and regional parameters version is supported by the latest firmware 1.2.3.
I can confirm the EUI and keys are correct.
Below are photos from the “Live data” in The Things Stack:
Does anyone have suggestions on how this can be fixed? Perhaps I’ve selected the incorrect LoRaWAN version and regional parameters version given the firmware I’m using is newer.