Lorawan Gateway Implementation

Congratulations on getting the gateway up and working so that you’re able to telnet into it.

I see from your first post that you get “Unknown radio: 34” in the initial output on powering up. The code reads a version identifier from the SX1272 chip and compares it to 0x12. I wouldn’t worry about the mismatch. The chip version for the SX1272 may be different than for the SX1278. The good news is that you’re reading a number and not getting all 1’s (0xFF) or all 0’s (0x00), which tells me you probably are talking to the SX1272 successfully.

So, you’re asking why you’re not receiving and transmitting messages. Do you have a node working? What channel is it transmitting on? Is it the same as the gateway?
What spreading factor are you using? Have you tried changing the gateway to listen to a single spreading factor, rather than “ALL_SF”? You’ll want to get the gateway receiving successfully from the node before attempting to respond to it. Remember that in the Lorawan protocol, gateways only communicate in response to messages received from nodes. So until you’re receiving messages from the node, you won’t see any transmit activity (and not even then unless you’ve given the gateway instructions to send a response). I haven’t attempted to do communication the gateway to node direction, so I don’t have any experience to share with that.

Actually there are a few differences…

SX1272 reports a different radio type.

Setting a spreading factor is different for SX1272 (see here )

The reported RSSI value uses another offset (see here)

Feel free to add support for a SX1272 to Lorawangateway: implement support, test and make a pull request! I don’t own a SX1272, so I cannot test it…

Hi n0dyjeff,
Sorry for the late response.
Jeff : yeah i have a working node " arduino-lmic " . As you advised me to to change spreading factor from “ALL_SF” to specific SF. I changed it to SF7 and now i am able to receive packet from node to gateway.
This is the output : -
got ip 192.168.1.101 255.255.255.0 192.168.1.1
Gateway ID 5CCF7FF42F33BF04
ntp synced using 83.162.251.163
2017-05-10 10:54:26 GMT
sx1272: 34
start singleSF detector on SF7
router ip: 52.169.76.203
ntp synced using 83.162.251.163
rxpk 012ed1005ccf7ff42f33bf04 message {“rxpk”:[{“rssi”:-115,“stat”:0,“modu”:“LORA”,“rfch”:1,“tmst”:692095981,“datr”:“SF7BW125”,“lsnr”:-12,“time”:“2017-05-10T11:05:52.984922Z”,“codr”:“4/5”,“data”:“7oeLLwC0ilVhGlG1B9UD4E4JLA9E8o9QW1o2BJcTbSPBOH5R+nmZT004s8cH/LbsjRcKcX0Cq7+sZItYW1RfAk+FOqAJiMiJaB7Lv4gTXnMowZsQ/ubIFC4+tel6yeCvgQpI70fYpea9SSqVTQ==”,“freq”:868.100,“chan”:0,“size”:109}]} length 357
statistics()
statistics()
Statistics
Uptime 0 days, 0 hours, 15 minutes, 29 seconds
Memory free 11464 bytes
Rx packets 1
Rx packets OK 1
Rx timeouts 0
Rx forwarded 1
Tx packets 0
Tx packets sent 0
Ack ratio 98.1% (212/216)
my question is, i am receiving only once packet not regular. what the things i have to change so to receive it regularly.

Also i have register on TTN for gateway it always shows not connected. Please advise me how to proceed further.

Thanks and Regards
Rohit

Hi JBraam,

yeah i read the datasheet for SX1276 and SX1272 and as you mention the link i notice that point and change the RSSI vale from 157 to 139 to use sdx1272 in lua code which you provided. Now the problem is i am able to receive packet only once not regular. please advise me to receive packet regularly and thanks for the link which you provided.

Please reply ASAP.

Thanks and regards
Rohit

How much distance is there between your gateway and your node? Because you are testing I would expect them to be only a few meters apart.

The RSSI and LSNR values are very low! Values in that range are ‘normal’ for distances of several kilometers. Maybe you should check your antennas.

Thanks for reply, i think its around 60cm - 70 cm both node and gateway are nearby only. Either it is problem with gateway or node side because, whenever i restart node or gateway once i receive message.

Another output which i got after restart.:-
got ip 192.168.1.101 255.255.255.0 192.168.1.1
Gateway ID 5CCF7FF42F33BF04
ntp synced using 85.255.214.66
2017-05-10 11:57:28 GMT
sx1272: 34
start singleSF detector on SF7
router ip: 52.169.76.203
ntp synced using 88.159.1.196
rxpk 010c77005ccf7ff42f33bf04 message {“rxpk”:[{“rssi”:-115,“stat”:0,“modu”:“LORA”,“rfch”:1,“tmst”:305066763,“datr”:“SF7BW125”,“lsnr”:-12,“time”:“2017-05-10T12:02:28.016974Z”,“codr”:“4/5”,“data”:“9a+z9ank+XlpHCqaC1rg/K+czZz3/nVktk2L2/Iaj4WNXpyq3jV9LpaTP9w7k+BtHkJPEB6nV1dWikj4uUIdVSA381RopPE4M0Pea21OS73uKDytPoNI2sxcO0sRPwo//+siaRlK7OcnffXk1DmiGnCWqXSpvR+Xm7gSXpYwj6I=”,“freq”:868.100,“chan”:0,“size”:128}]} length.

I mean to say sometime only i gets packet from node to gateway. i won’t able to find bug. Please advise me how to proceed.

Thanks

Do I understand correctly that when you restart your node, you will receive one message? Do you receive another message when you only restart your node again?

When the gateway runs in singleSF mode the reception settings will not change after the reception of a message, so it normally will continue listening for more messages…

Can you try to restart your node several times while keeping your gateway running, and check if more than one message is received?

Yeah i tried but always getting only single message. i restarted several times node side, also restarted gateway too, now i am not able to receive message.

I received only 1 message and now after restart i am not able to to receive. Do i have to change something?

after restart of gateway side i got this output:-

got ip 192.168.1.101 255.255.255.0 192.168.1.1
Gateway ID 5CCF7FF42F33BF04
ntp synced using 92.68.81.154
2017-05-10 13:46:31 GMT
sx1272: 34
start singleSF detector on SF7
router ip: 52.169.76.203
ntp synced using 88.159.1.196
rxpk 01e610005ccf7ff42f33bf04 message {“rxpk”:[{“rssi”:-113,“stat”:0,“modu”:“LORA”,“rfch”:1,“tmst”:849734808,“datr”:“SF7BW125”,“lsnr”:-12,“time”:“2017-05-10T14:00:37.676629Z”,“codr”:“4/5”,“data”:“C+Fu12101KqfPeldeqYw9D7JjKlorlpGK6cyKNSQ7Ey1RzQjee9HSKG58cXioLEkmczs2bjo7xGk3hf5VSVVXrOeof8mrYl4hAkoJWsMDQ81NHeeAMuPIeWkC7aUEnsv4wWV5moIt+y9b4NYnZ9lm66cqw0rJenWQtNBYCz1aPe/n/5glT/UtSCAfpH4gKpzDcoZkCc+OwY=”,“freq”:868.100,“chan”:0,“size”:152}]} length 413
ntp synced using 88.159.1.196

Are you sure the messages you receive are from your node?

I would expect the node to send similar messages each time, but I see payloads of 109, 128 and 152 bytes.

What payload is your node supposed to send? Can you post some logging of your node?

1 Like

Also, using the nice:

…shows the packets might not be LoRaWAN at all:

This cannot be decoded.

Cannot be decoded either.

Without knowing the key to validate the MIC (if there is any), it decodes to a Join Request but it’s far too long for that.

Try to increase that to a few meters.

1 Like

Hi Rohit,

I see there have already been responses. My original response was sent to the wrong place. I’ll provide it here just in case it may add something to the conversation.

It’s not entirely clear that the packet you’ve received originated at your node. I say that because the signal strength and S/N ratio are both very low. If the node was anywhere within 100 meters of you, the RSSI and S/N indications would be much higher. For example, on my system, with the node in the adjacent room, I see RSSI of -65 and lsnr of 9. I am guessing that you’re actually receiving a packet from a distant node, not your arduino-lmic.

Is your arduino-lmic set up to transmit on only one channel? If not, it will randomly select a channel to send a packet on. Since your gateway receives only one channel, it will only receive those packets transmitted on the channel it’s monitoring.

As far as the gateway registration goes (“not connected”), I’ve had the same problems. It’s a known issues on TTN with single channel gateways. I don’t have any more help for you on that.

Regards,
Jeff

1 Like

Hi JBraam,

Sorry for delay reply.

Payload is just Hello World as it is mention in your code which is available in github (arduino-lmic). Same code which is available there, i used that one only…[quote=“JBraam, post:14, topic:6737”]
Can you post some logging of your node?
[/quote]

yeah here is few logging of my node side
Starting
Packet queued
369338: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
1122287: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
1920702: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
2730812: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
3476643: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
4202779: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
4984323: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
5694206: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
6452182: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
7159004: EV_TXCOMPLETE (includes waiting for RX windows)

Yeah i hope so because i am unable to receive single packet but when i commented few channel i got three packet but with different payload length like 256, 357, 359…

LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band

// LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
// LMIC_setupChannel(2, 868500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(3, 867100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(4, 867300000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(5, 867500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(6, 867700000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(7, 867900000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band

Also in gateway side instead of SF_ALL i changed to single SF7… because if i use SF_ALL its shows
Gateway ID 5CCF7FF42F33BB33
ntp synced using 52.187.42.158
2017-05-11 12:31:46 GMT
sx1272: 34
start allSF detector
router ip: 52.169.76.203
ntp synced using 52.187.42.158
rx timeout 9 rssi 45
rx timeout 9 rssi 46
rx timeout 9 rssi 45
rx timeout 9 rssi 45
rx timeout 9 rssi 51
rx timeout 9 rssi 51
rx timeout 9 rssi 53
rx timeout 8 rssi 53
rx timeout 8 rssi 53
rx timeout 8 rssi 53
rx timeout 9 rssi 22

it is continuously… but whenever i supposed to change from SF_ALL to SF7 at that i receive single packet…

Hi jeff,

yeah i configured my arduino-limic to only single channel…

  LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band

// LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
// LMIC_setupChannel(2, 868500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(3, 867100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(4, 867300000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(5, 867500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(6, 867700000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(7, 867900000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
// LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band

Only channel 0 is enabled rest all are commented.

I am not able to understand whether it is problem with gateway side or node side :pensive:

Hi arjanvanb,

Thanks for the reply…[quote=“arjanvanb, post:15, topic:6737”]
Try to increase that to a few meters.
[/quote]

Yeah i increased few meter 1 metre - 2 metre but still not able to receive continuously…

Hi everyone,

Yes JBraam, jeff and arjan, you all were right. Actually to test whether i am getting packet from node or somewhere else i removed node side and plugged on gateway whether it receive message or not. Yes it receive packet alone without node side. So how this gateway is receiving message without sending any packet from node side. Actually instead of SF_ALL, i changed it to SF7 so i think it receiving message from somewhere else. This is the console output of my gateway side without switching on to node.

got ip 192.168.1.101 255.255.255.0 192.168.1.1
Gateway ID 5CCF7FF42F33BF04
ntp synced using 213.136.0.252
2017-05-11 13:37:54 GMT
sx1272: 34
start singleSF detector on SF7
router ip: 52.169.76.203
ntp synced using 5.39.184.5
rxpk 010930005ccf7ff42f33bf04 message {“rxpk”:[{“rssi”:-115,“stat”:0,“modu”:“LORA”,“rfch”:1,“tmst”:618710294,“datr”:“SF7BW125”,“lsnr”:-12,“time”:“2017-05-11T13:48:09.461732Z”,“codr”:“4/5”,“data”:“GCkX0ew/jnDQPZ7+XD/ZhTowiXJC+cqAgyjORUvFt/h6EC9Ks/OvveArpraN5iIPnHyO5atPEdFEUwqcOxzprCvEKFHeuRosHzyShi4H/2Pf4Q1ueXXzPgkWRcD9bLME”,“freq”:868.100,“chan”:0,“size”:96}]} length 336
ntp synced using 5.39.184.5

Now my question is why gateway is not receiving packet if i try to send it from arduino-limic. All configuration is right in node side but still i am not able to receive packet to gateway side.

Please Reply ASAP.

Thanks and regards
Rohit

Have you confirmed that your arduino-lmic node is working properly? Perhaps with another gateway?

Thanks for the reply,

yeah i have confirmed that my arduino-lmic is working properly because i have tested this arduino-lmic to raspberry pi gateway for uplink only and its working fine. But i want downlink also that why i used JBraam code which is in LUA for uplink and downlink both. Please if its possible provide me your’s code for node and gateway so that i can modify my code using your’s code.

Thanks and regards
Rohit

Here’s a great video that I used to set up my node. There are links to the code in the YouTube notes below the video.

I had to change a few things because I’m in the US and on a different spectrum allocation, but that shouldn’t be an issue for you, since I see you’re in the 868 MHz band.

Jeff