Trying to connect a device to TTN

Hi, I’m trying to connect my nano + RFM95W to TTN and thus my gateway that’s already connected.
Problem is, it doesn’t seem to connect, as it still says “never seen”

I’ve used this guide: HopeRF RFM95 and arduino a low cost LoRaWan solution - disk91.com - the IoT blogdisk91.com – the IoT blog to connect the nano with the RFM95 chip.

The code I made with help from a colleague (I’m an intern btw, this is a project I have to finish within the next 3-4 weeks, so I’m getting anxious) and looks as follows:

#define EU_868
#define DEBUG

#include <lorawan.h>

const sRFM_pins RFM_pins = {
.CS = 6,
.RST = 5,
.DIO0 = 3,
.DIO1 = 4,
};

void setup() {
// put your setup code here, to run once:

if (!lora.init()){
Serial.println(“RFM95W not detected”) ;
while (1);
}

// colleague added this, but other colleague wasn’t sure if this was necessary
// lora.setNwkSKey("-----------------------------------");
// lora.setAppSKey("------------------------------------");
// lora.setDevAddr("------------------");

lora.setDevEUI("-------------------------------");
lora.setAppEUI("-------------------------------------");
lora.setAppKey("-------------------------------------------");

lora.setDeviceClass(CLASS_A);
lora.setChannel(CH0);

lora.setDataRate(2);

bool isJoined;
do {
Serial.println(“Joining…”);
isJoined = lora.join();

//wait for 10s to try again
delay(10000);

}while(!isJoined);
Serial.println(“Joined to network”);

}

void loop() {
// put your main code here, to run repeatedly:
lora.update();

// put your main code here, to run repeatedly:
char myStr[] = “Ini data LoRa”;

lora.sendUplink(myStr, strlen(myStr), 0, 0);
lora.update();

delay(1000);
}

If someone can help me that would be wonderful, I have tried looking through this forum and I’m not sure if I’m just blind but I can’t find any topic that can truly help me with my case, you have my thanks already. (if I missed any information, please inform me and I’ll try adding it, or if I added some…sensitive? data I’ll remove it)

Why don’t you look at the device logs? you have DEBUG defined so I assume you have detailed logs re the device activity (not sure which library you are using)

Errr, reassure me these are filled in when you upload your code?

lora.setDevEUI("-------------------------------");
lora.setAppEUI("-------------------------------------");
lora.setAppKey("-------------------------------------------");

Also, if your using that disk91 project as a guide why are you not cut and pasting their code? they are using MCCI LMIC library

Hey, thanks for reaching out.

Problem is, no logs are given out, I found this strange too, other libraries I try just give me a “can’t sense RF chip” which…can’t be right, unless it has to do with pins being not well defined, need to look further into that.

Yes, those are filled in when I upload my code, I just crossed them out here cause of…reasons, and they weren’t relevant to be known, rest assured, those are filled in correctly.

I have decided while waiting to use their code, problem is, when I do I get the same error as someone points out in the comments:
“Starting…
FAILURE
C:\Users\amaskell\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53”

The only people who responded to that are basically saying “when I had that problem, my chip was dead” however I have it happen on both chips and I doubt both are broken (they are also able to send and receive packets from each other) I have placed a comment outlining this problem, but it either hasn’t been put through moderation fully yet or it has been denied.

This project has been nothing but trouble tbh, hope you can help me since I’m running out of time and my drastic angst is telling me to start over with some common, easy to use solutions.

Check your pin declarations are accurate, that error suggest they are not - I think…

Circuit diagram?

Please see: How to format your forum post? for how to format code in posts.

1 Like