Dual-Chan Gateway with Raspberry PI3 + Dragino Hat v1.4 and Downstream messages

HI Batigolle,
First of thanks for this tutorial. I have been trying to get downlink from the same gateway for days now. It feels to me like the gateway forwards the data to the node but my node somehow never receives any downlink. So, I would like to know, how your node is configured.

Hi @bauvill
as a program for the node used for the test, I used ttn-abp.ino example taken from the libreia of Matthijs Koolijman arduino-lmic-master.zip

I have not made any changes in particular, in addition to the usual changes to insert the values Insert device registration keys, NwkSkey, AppSkey and DevAddr, I added the line
I added the following line of code,
inside the setup () function,
before do_send (& sendjob);

// Let LMIC offset for +/- 10% clock error
LMIC_setClockError (MAX_CLOCK_ERROR * 10/100);

Thanks. I am on it.

Well, it seems not to work on raspberry pi running on the LMICv1.6.
The gateway logs show that my device sends in the Freq = 868.3 on Chang=0, and it relies on the same channel and frequency my node never received any. Please help this is a thesis project and I have to turn it soon. I basically have everything working but for this and it is the last step to complete the project. It seems like everybody is using Arduino as node except for me.

Hi @bauvill
on Raspberry , have you installed “/bokse001/dual_chan_pkt_fwd” ?

My project uses this software for the gateway, it’s the most important part, to use the “downstream message”

Thanks once more.
My gateway runs the forwarder software from (“/bokse001/dual_chan_pkt_fwd”) but issues at this level was : packets received at the gateway layer on a frequency such as 866.1 or any other frequency different from 868.3 were all shown in the gateway logs as packets sent on the frequency 868.3, as a result, the server routes the downlink packets to that frequency. That should be where my problem lies.
I have carried out some modification on the gateway ( setting the _STRICT_1CH = 1 instead of _STRICT_1CH =0 which was the default value).
I am still about to test it on my node.
Thanks for your support.

Hi
these are the sensor and gateway logs when I did the tests

OUTPUT SERIAL ATOM HELTEC32 con ricezione DownStream message

10101683: engineUpdate, opmode=0x908
10101731: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
Packet queued
10161952: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
10218564: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
10244705: EV_TXCOMPLETE (includes waiting for RX windows)
bytes of payload: 0x
10244710: engineUpdate, opmode=0x900
12119710: engineUpdate, opmode=0x908
12119758: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
Packet queued
12179979: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
12189361: Received downlink, window=RX1, port=1, ack=0
12189371: EV_TXCOMPLETE (includes waiting for RX windows)
Received
3
bytes of payload
bytes of payload: 0x000102
12189632: engineUpdate, opmode=0x800
14064632: engineUpdate, opmode=0x808
14064680: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
Packet queued
14124902: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
14181513: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
14207650: EV_TXCOMPLETE (includes waiting for RX windows)
bytes of payload: 0x
14207655: engineUpdate, opmode=0x900

OUTPUT GATEWAY01 con ricezione Downstream message

stat update: 2018-03-27 20:46:03 GMT 5 packets received, 0 packet sent…
CE0 Packet RSSI: -36, RSSI: -104, SNR: 9, Length: 23 Message:rxpk update: {“rxpk”:[{“tmst”:4212123479,“freq”:868.3,“chan”:0,“rfch”:0,“stat”:1,“modu”:“LORA”,“datr”:“SF7BW125”,“codr”:“4/5”,“rssi”:-36,“lsnr”:9.0,“size”:23,“data”:“QFsRASaAAwABjDJ01tnrMyOjfhbubvA=”}]}
stat update: 2018-03-27 20:46:33 GMT 6 packets received, 0 packet sent…
CE0 Packet RSSI: -47, RSSI: -97, SNR: 9, Length: 23 Message:rxpk update: {“rxpk”:[{“tmst”:4244415677,“freq”:868.3,“chan”:0,“rfch”:0,“stat”:1,“modu”:“LORA”,“datr”:“SF7BW125”,“codr”:“4/5”,“rssi”:-47,“lsnr”:9.0,“size”:23,“data”:“QFsRASaABAAB0bMQfYyQzR9XHc114hM=”}]}
stat update: 2018-03-27 20:47:03 GMT 7 packets received, 0 packet sent…
CE0 Packet RSSI: -45, RSSI: -100, SNR: 9, Length: 23 Message:rxpk update: {“rxpk”:[{“tmst”:4276705521,“freq”:868.3,“chan”:0,“rfch”:0,“stat”:1,“modu”:“LORA”,“datr”:“SF7BW125”,“codr”:“4/5”,“rssi”:-45,“lsnr”:9.0,“size”:23,“data”:“QFsRASaABQABBcRMhLqXGcj8QZNlTIY=”}]}
stat update: 2018-03-27 20:47:33 GMT 8 packets received, 0 packet sent…
CE0 Packet RSSI: -43, RSSI: -97, SNR: 8, Length: 23 Message:rxpk update: {“rxpk”:[{“tmst”:14027286,“freq”:868.3,“chan”:0,“rfch”:0,“stat”:1,“modu”:“LORA”,“datr”:“SF7BW125”,“codr”:“4/5”,“rssi”:-43,“lsnr”:8.0,“size”:23,“data”:“QFsRASaABgABT7eMr79xFNcu5Yl4iE0=”}]}
Sending packet:: tmst=15027286, wait= -1507156382, strict=0, datr=SF7BW125, freq=868300000->868300000, sf=7->7, modu=LORA, powe=14, codr=4/5, ipol=1, through CE1.
PKT_PULL_RESP:: From server router.eu.staging.thethings.network.
stat update: 2018-03-27 20:48:03 GMT 9 packets received, 1 packet sent…
CE0 Packet RSSI: -43, RSSI: -97, SNR: 9, Length: 23 Message:rxpk update: {“rxpk”:[{“tmst”:45146368,“freq”:868.3,“chan”:0,“rfch”:0,“stat”:1,“modu”:“LORA”,“datr”:“SF7BW125”,“codr”:“4/5”,“rssi”:-43,“lsnr”:9.0,“size”:23,“data”:“QFsRASaABwABXd/KTwbnvgAmhUtl0wY=”}]}
stat update: 2018-03-27 20:48:33 GMT 10 packets received, 1 packet sent…

Thanks for the screenshots. my gateway outputs are the same but my node seems not to be getting anything. Is your node listening/sending on one frequency or all frequencies? Do you think I should the value my receive windows??
When a node sends on the frequency 868.1 does listen to the server reply on the same frequency? I asking because I have limited my node to send on a single channel. Is it wrong?

This function does not exist in my code LMIC_setClockError (MAX_CLOCK_ERROR * 10/100);

Are you sure you are reading the log correctly? You could interpret the marked line as no packets being sent to a downlink node (that is the way I interpret it). And that is probably because the back-end never instructed the gateway to send any data.

Yes and no. The first receive window (1 second after transmit) is at the same frequency. The second window (2 seconds after transmit) is at 869.525MHz with SF9. (So you should not set your gateway to pure 1 channel as this disallows switching to the right frequency for RX2)

Something else, if your node and your gateway are too close the gateway will receive data on a channel the node is not sending on. Make sure there is at least 3 meters space between the gateway and the node. And change the code on your node and gateway to use SF7 to SF9, SF12 is rarely needed and not good while testing with hardware in close vicinity.

I would be surprised if your code will receive anything at all without that line.

@bauvill
I sent you a message with the sketch I used in the sensor for the test,
maybe he can help you.
Sorry for the comments lines in Italian :sunglasses:

Do I need to make an application to have the gateway to be instructed to forward the messages it get? I made an application and when I register the same gateway it doe not show that it is connected whereas in the Gateway console it shows connected and the gateway does not show any traffic in the console.

Thank you, sir.

No, the gateway will always forward all messages to TTN.

My node is made based on RPI +DRAGINO and the LMIC library for repair the function LMIC_setError is not defined in the LMIC API. Do I need to implement it myself?
Maybe that is why it does not work.

It is actually in the LMIC library just most likely not the version you are using. I have come across this issue a couple times now within the last couple weeks. The LMIC library that is available just by searching through the Arduino IDE Manage libraries option does not have this code setup. Everyone here when they point you to a TTN - LMIC example are using the updated version that includes the ability to implement the setClockError “add” which means you’ll need to update your library files to the ones they are referring to.

Note: This is as far as I can tell from my own copy of the Arduino IDE

1 Like

Is it present only in the LMIC library for Arduino?
Asking because I am not using Arduino but Raspberry Pi.
Thanks for the clarification though.

The simplest ways of checking that might just be to open up the LMIC files on your Pi and search if there is a MAX_CLOCK_ERROR set somewhere, in the Arduino libs it’s easy to see if it’s implemented or not in the LMIC.h file. So for the Pi if it’s using similar C++ files you should be able to find it. But if it’s not there, that’s not the only place there is probably a bit of code missing relating to that issue which means you might have to do some digging.

Also this clock Error issue is one that is very much more rooted in the Arduino side of things and not the Raspberry Pi (though the different versions have their own issues) because it’s been implemented to check the timing crystal and it’s variations used in the official and ‘off-brand’ versions of their boards.

1 Like

@bauvill
raspberry for the gateway, what do you use as a sensor?

I am using RPI 3B + dragino HAT V1.4 running the dual_chan_pkt_fwd ( as Batigolle described in his post related to this topic), as of the end-device ( Lora node) same components ( RPI 3B +Dragino HAT V1.4) are used. It is to be noted that my end device runs the ABP LMIC v1.6 version from ( https://github.com/wklenk/lmic-rpi-lora-gps-hat/blob/master/examples/periodic/main.c). I will give you more details or screenshots of my code, logs of my end device and gateway in the next post.