Connecting RHF76-052 node to TTN

Hello, I am currently trying to set up my RHF76-052 node and I cant get it to talk to TTN. I have already set up my gateway, but when I try to connect to the TTN, it says that my LoRaWAN modem is busy. I do not know why it says that, since I dont have anything being transmitted which is what I am trying to do. There is probably something wrong with my code or there is another configuration that I need to try. Any help would be appreciated. If you have experience with setting this up please let me know and provide example code if possible.

:confused:
you really have to be more clear and use search

yes, i probably should have been more specific. I apologize. Do you have experience with setting up one of these nodes? I tried that thread but the fixes that were suggested did not fix the problem i was having. If you have the code you used to set one of these up, then i’d appreciate it if you would post a picture so that I can try to implement your solution. Ive tried several and none of them have worked for me.

again, be more specific about the code you’ve used and the problems you’ve encountered.

Ive tried ssonzonoff’s code
(Rhf76-052am - getting it working with OTAA)
and I set it to my specifications with the US915 and changed the baud rate to 115200. I have also used the prepopulated arduino code from the LoRaWAN library for the OTAA setup and set the various keys in their respective spots, but that also didnt work. With the code from ssonzonoff I did see that the node was attempting to communicate to something, but when it toggled to try to connect, the connection timed out because the “lorawan modem is busy” and then it would prompt me to connect to a network.

//Prepopulated arduino code that came with the libraries i downloaded
#include <LoRaWan.h>

unsigned char data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA,};
char buffer[256];

void setup(void)
{
SerialUSB.begin(115200);
while(!SerialUSB);

lora.init();

memset(buffer, 0, 256);
lora.getVersion(buffer, 256, 1);
SerialUSB.print(buffer); 

memset(buffer, 0, 256);
lora.getId(buffer, 256, 1);
SerialUSB.print(buffer);

lora.setKey("2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C");

lora.setDeciveMode(LWOTAA);
lora.setDataRate(DR0, EU868);

lora.setChannel(0, 868.1);
lora.setChannel(1, 868.3);
lora.setChannel(2, 868.5);

lora.setReceiceWindowFirst(0);
lora.setReceiceWindowSecond(869.5, DR3);

lora.setPower(20);

while(!lora.setOTAAJoin(JOIN));

}

void loop(void)
{
bool result = false;

result = lora.transferPacket("Hello World!", 10);
//result = lora.transferPacket(data, 10, 10);

if(result)
{
    short length;
    short rssi;
    
    memset(buffer, 0, 256);
    length = lora.receivePacket(buffer, 256, &rssi);
    
    if(length)
    {
        SerialUSB.print("Length is: ");
        SerialUSB.println(length);
        SerialUSB.print("RSSI is: ");
        SerialUSB.println(rssi);
        SerialUSB.print("Data is: ");
        for(unsigned char i = 0; i < length; i ++)
        {
            SerialUSB.print("0x");
            SerialUSB.print(buffer[i], HEX);
            SerialUSB.print(" ");
        }
        SerialUSB.println();
    }
}

}

Hi,

Can’t help you, due the fact i’m facing the exact same problem.

All the KEYS and ID’s like the DevAddr, DevEui, NWKSKEY , APPSKEY , APPKEY match with my configured settings in the things network. And i have a online gateway in range.

But i get the same messages;

+MODE: LWOTAA
+DR: EU868
+DR: DR0
+DR: EU868 DR0  SF12 BW125K 
+ADR: ON
+CH: 0,868100000,DR0:DR5
+CH: 1,868300000,DR0:DR5
+CH: 2,868500000,DR0:DR5
+CH: 3,867100000,DR0:DR5
+CH: 4,867300000,DR0:DR5
+CH: 5,867500000,DR0:DR5
+CH: 6,867700000,DR0:DR5
+RXWIN1: ON; 7; 0,868100000; 1,868300000; 2,868500000; 3,867100000; 4,867300000; 5,867500000; 6,867700000; 
+RXWIN2: 869500000,DR3
+POWER: 20
+JOIN: Start
+JOIN: NORMAL
+MSG: LoRaWAN modem is busy
+JOIN: Join failed
+JOIN: Done
+MSG: Please join network first
+MSG: Please join network first

From the top of your listing it looks like it will attempt to join at DR0. Could you try to join using DR5?

Thank you for the reply @kersing !

That doesn’t seem to help. I’ve tried connecting to the local lora provider (KPN) as well, which doesn’t work either.

For both gateways/providers i tried ABP so there was no need to join the network. This results to the following log.

The error(-20) occurred due the empty AppEui and AppKey which are not necessary for ABP

+VER: 2.0.10
+ID: DevAddr, XXX
+ID: DevEui, XXX
+ID: AppEui,XXX
+ID: DevAddr, XXX
+ID: DevEui, XXXXX+KEY: NWKSKEY XXXX 
+KEY: APPSKEY XXXXX
+AT: ERROR(-20)
+MODE: LWABP
+DR: EU868
+DR: DR5
+DR: EU868 DR5  SF7  BW125K 
+ADR: ON
+CH: 0,868100000,DR0:DR5
+CH: 1,868300000,DR0:DR5
+CH: 2,868500000,DR0:DR5
+RXWIN1: OFF; 3; 0,868100000; 1,868300000; 2,868500000; 
+RXWIN2: 869500000,DR3
+POWER: 20
+PORT: 1
Setup completed
+MSG: Start
+MSG: TX "9876"
+MSG: Done

I gave this device a try and had problems at first, but could resolve them later. I put together step-by-step instructions for those who have the same problems:
https://blog.squix.org/2017/07/seeeduino-lora-gps-getting-started-with-lorawan-and-ttn.html

Remaining open question: where do you get the DevEUI from? There seems to be no command/method to get the MAC address.

From the registered device in the TTN console

I know this is a cold post, but I think (myself included) we’ve all had trouble getting these things to work. So once I got it working, I made a git repo that focuses on making it work for hybrid gateways (the one’s that have 8 uplink channels, and cost << $1,000). I have only tried it with the US915 hybrid mode, but I’ve also included settings for changing it to any one of TTN’s supported country codes.

I also made an Instructable for it.

1 Like

Hey Brady,
Thanks for the reference code. I am able to connect to senet network using seeeduino lorawan,
I have an issue with downlink. In senet portal i need to set port number to initiate downlink. Can you please guide me what ‘Port’ number needs to be set in senet portal. I guess it is port number of Lora module.

Thanks for the help.

I know this is an old post, but I’d like to share how I got it to work, as I was breaking my head over it for days reading many topics on this forum.

It turns out that the receive windows are automatically set, so setting them manually in the code will only leave room for error. That said, removing the two lines below resulted in my device successfully joining the network and sending packets to my gateway.

lora.setReceiceWindowFirst(0, 868.1);
lora.setReceiceWindowSecond(869.5, DR3);

My final working code:

#include <LoRaWan.h>

unsigned char data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA,};
char buffer[256];

void setup(void)
{
    SerialUSB.begin(115200);
    while(!SerialUSB);
    
    lora.init();
    
    memset(buffer, 0, 256);
    lora.getVersion(buffer, 256, 1);
    SerialUSB.print(buffer); 
    
    memset(buffer, 0, 256);
    lora.getId(buffer, 256, 1);
    SerialUSB.print(buffer);

    SerialUSB.println("\nSetting keys...");
    // setKey(char *NwkSKey, char *AppSKey, char *AppKey)
    lora.setKey(NULL, NULL, "<<< APP_KEY_HERE >>>");
    
    lora.setDeciveMode(LWOTAA);
    
    lora.setDataRate(DR0, EU868);
    
    lora.setChannel(0, 868.1);
    lora.setChannel(1, 868.3);
    lora.setChannel(2, 868.5);
    lora.setChannel(3, 867.1);
    lora.setChannel(4, 867.3);
    lora.setChannel(5, 867.5);
    lora.setChannel(6, 867.7);

    lora.setPower(14);
    
    while(!lora.setOTAAJoin(JOIN));

    // Give it some time to join the network
    // To prevent "LoRaWAN modem is busy" messages
    SerialUSB.println("Joined network, waiting for modem...");
    delay(5000);
}

void loop(void)
{   
    bool result = false;
    
    result = lora.transferPacket("Hello World!", 10);
    
    if(result)
    {
        short length;
        short rssi;
        
        memset(buffer, 0, 256);
        length = lora.receivePacket(buffer, 256, &rssi);
        
        if(length)
        {
            SerialUSB.print("Length is: ");
            SerialUSB.println(length);
            SerialUSB.print("RSSI is: ");
            SerialUSB.println(rssi);
            SerialUSB.print("Data is: ");
            for(unsigned char i = 0; i < length; i ++)
            {
                SerialUSB.print("0x");
                SerialUSB.print(buffer[i], HEX);
                SerialUSB.print(" ");
            }
            SerialUSB.println();
        }
    }
    delay(5000);
}

This results in the following output for me:

+VER: 2.1.16
+ID: DevAddr, 26:01:1F:2F
+ID: DevEui, 00:08:35:6E:E4:DB:7B:29
+ID: AppEui, 70:B3:D5:7E:D0:01:2D:81

Setting keys and IDs...
+KEY: APPKEY 06CFB3CD9B0A144EE16AC0C236850A6A
+MODE: LWOTAA
+DR: EU868
+DR: DR0
+DR: EU868 DR0  SF12 BW125K
+CH: 0,868100000,DR0:DR5
+CH: 1,868300000,DR0:DR5
+CH: 2,868500000,DR0:DR5
+CH: 3,867100000,DR0:DR5
+CH: 4,867300000,DR0:DR5
+CH: 5,867500000,DR0:DR5
+CH: 6,867700000,DR0:DR5
+POWER: 14
+JOIN: Start
+JOIN: NORMAL
Joined network, waiting for response...
+MSG: Start
+MSG: Done

Hope this helps!

2 Likes

see Rhf76-052am - getting it working with OTAA