Gateway with LoRa module SX1278

Hi.
I have a few modules SX1278 and want to connect one of them with RPI4.
In Gateway Web Admin in tab item “Gateway configuration”, there are following messages:
** last low-level status: **2020-06-04T18:30:07 0m-0d-20h-17min from current date
** no rx found

I set following parameters:
Mode - 11 (LoRaWan)
Spreading Factor - 12
Frequency - 433.3
PA_BOOST - false.

But after reboot I have the same messages
** last low-level status: **2020-06-04T18:31:25 0m-0d-20h-17min from current date
** no rx found

May be you know, what can I do?

Hi, you need to look at the log file, one reason could be that the SPI connection is not good and the radio module not recognized. You can either ssh to the gateway, or use the web admin interface to get the log file.

Thank you for your answer!..
I have looked at the log file and there are no one word about connection with LoRa module.
Can it be the reason, that I haven’t installed maybe some additions for my LoRa module or something else?

My log file content:

2020-06-06T10:24:30.358703> raw output from low-level gateway. post_processing_gw will handle packet format
2020-06-06T10:24:30.360383> post_processing_gw.py found an alert_conf section
2020-06-06T10:24:30.360534> Parsing cloud declarations
2020-06-06T10:24:30.360647> [u’python CloudThingSpeak.py’]
2020-06-06T10:24:30.360772> Parsed all cloud declarations
2020-06-06T10:24:30.360884> post_processing_gw.py got cloud list:
2020-06-06T10:24:30.360993> [u’python CloudThingSpeak.py’]
2020-06-06T10:24:30.361129> Parsing cloud declarations
2020-06-06T10:24:30.361250> Parsed all cloud declarations
2020-06-06T10:24:30.361370> post_processing_gw.py got encrypted cloud list:
2020-06-06T10:24:30.361479> []
2020-06-06T10:24:30.361584> Parsing cloud declarations
2020-06-06T10:24:30.361714> Parsed all cloud declarations
2020-06-06T10:24:30.361835> post_processing_gw.py got LoRaWAN encrypted cloud list:
2020-06-06T10:24:30.361950> []
2020-06-06T10:24:30.362054> Starting thread to perform periodic gw status/tasks
2020-06-06T10:24:30.362185> 2020-06-06 10:24:30.357753
2020-06-06T10:24:30.362300> post status: gw ON
2020-06-06T10:24:30.362407> post status: executing periodic tasks
2020-06-06T10:24:30.418532> post status: start running
2020-06-06T10:24:30.930531> ttn_stats: gw id DCA632FFFF79D311
2020-06-06T10:24:30.930766> ttn_stats: Opening UDP socket to router.eu.thethings.network (52.169.76.203) port 1700…
2020-06-06T10:24:30.930917> ttn_stats: Try to send UDP packet: ё4 Ь¦2яяyУ{“stat”: {“rxok”: 0, “txnb”: 0, “ackr”: 0, “dwnb”: 0, “alti”: 0, “time”: “2020-06-06 10:24:30 GMT”, “rxnb”: 0, “rxfw”: 0, “lati”: 43.314106, “long”: -0.363887}}
2020-06-06T10:24:30.984200> cs_stats: gw id DCA632FFFF79D311
2020-06-06T10:24:30.984451> cs_stats: Opening UDP socket to 127.0.0.1 (127.0.0.1) port 1700…
2020-06-06T10:24:30.984605> cs_stats: Try to send UDP packet: FН Ь¦2яяyУ{“stat”: {“rxok”: 0, “txnb”: 0, “ackr”: 0, “dwnb”: 0, “alti”: 0, “time”: “2020-06-06 10:24:30 GMT”, “rxnb”: 0, “rxfw”: 0, “lati”: 43.314106, “long”: -0.363887}}
2020-06-06T10:24:30.985981> post status: exiting
2020-06-06T10:24:31.359004> Starting thread to perform fast statistics tasks
2020-06-06T10:24:32.361673>
2020-06-06T10:24:32.362033> Current working directory: /home/pi/lora_gateway
2020-06-06T10:27:16.870591> raw output from low-level gateway. post_processing_gw will handle packet format
2020-06-06T10:27:16.872014> post_processing_gw.py found an alert_conf section
2020-06-06T10:27:16.872171> Parsing cloud declarations
2020-06-06T10:27:16.872303> [u’python CloudThingSpeak.py’]
2020-06-06T10:27:16.872414> Parsed all cloud declarations
2020-06-06T10:27:16.872529> post_processing_gw.py got cloud list:
2020-06-06T10:27:16.872634> [u’python CloudThingSpeak.py’]
2020-06-06T10:27:16.872740> Parsing cloud declarations
2020-06-06T10:27:16.872844> Parsed all cloud declarations
2020-06-06T10:27:16.872946> post_processing_gw.py got encrypted cloud list:
2020-06-06T10:27:16.873051> []
2020-06-06T10:27:16.873150> Parsing cloud declarations
2020-06-06T10:27:16.873254> Parsed all cloud declarations
2020-06-06T10:27:16.873365> post_processing_gw.py got LoRaWAN encrypted cloud list:
2020-06-06T10:27:16.873473> []
2020-06-06T10:27:16.873573> Starting thread to perform periodic gw status/tasks
2020-06-06T10:27:16.873689> 2020-06-06 10:27:16.865812
2020-06-06T10:27:16.873791> post status: gw ON
2020-06-06T10:27:16.873892> post status: executing periodic tasks
2020-06-06T10:27:16.926548> post status: start running
2020-06-06T10:27:16.926772> post status: exiting
2020-06-06T10:27:17.866735> Starting thread to perform fast statistics tasks
2020-06-06T10:27:18.869532>
2020-06-06T10:27:18.869887> Current working directory: /home/pi/lora_gateway
2020-06-06T10:30:50.968981> raw output from low-level gateway. post_processing_gw will handle packet format
2020-06-06T10:30:50.970524> post_processing_gw.py found an alert_conf section
2020-06-06T10:30:50.970661> Parsing cloud declarations
2020-06-06T10:30:50.970772> [u’python CloudThingSpeak.py’]
2020-06-06T10:30:50.970883> Parsed all cloud declarations
2020-06-06T10:30:50.971013> post_processing_gw.py got cloud list:
2020-06-06T10:30:50.971140> [u’python CloudThingSpeak.py’]
2020-06-06T10:30:50.971249> Parsing cloud declarations
2020-06-06T10:30:50.971366> Parsed all cloud declarations
2020-06-06T10:30:50.971476> post_processing_gw.py got encrypted cloud list:
2020-06-06T10:30:50.971592> []
2020-06-06T10:30:50.971689> Parsing cloud declarations
2020-06-06T10:30:50.971789> Parsed all cloud declarations
2020-06-06T10:30:50.971890> post_processing_gw.py got LoRaWAN encrypted cloud list:
2020-06-06T10:30:50.971993> []
2020-06-06T10:30:50.972090> Starting thread to perform periodic gw status/tasks
2020-06-06T10:30:50.972203> 2020-06-06 10:30:50.964786
2020-06-06T10:30:50.972302> post status: gw ON
2020-06-06T10:30:50.972399> post status: executing periodic tasks
2020-06-06T10:30:51.068155> post status: start running
2020-06-06T10:30:51.068594> post status: exiting
2020-06-06T10:30:51.966334> Starting thread to perform fast statistics tasks
2020-06-06T10:30:52.977372>
2020-06-06T10:30:52.977735> Current working directory: /home/pi/lora_gateway
2020-06-06T10:41:03.391662> 2020-06-06 10:41:03.391379
2020-06-06T10:41:03.391883> post status: gw ON
2020-06-06T10:41:03.392007> post status: executing periodic tasks
2020-06-06T10:41:03.450629> post status: start running
2020-06-06T10:41:03.450932> post status: exiting
2020-06-06T10:46:11.182129> post_processing_gw.py found an alert_conf section
2020-06-06T10:46:11.184466> Parsing cloud declarations
2020-06-06T10:46:11.184995> [u’python CloudThingSpeak.py’]
2020-06-06T10:46:11.185407> Parsed all cloud declarations
2020-06-06T10:46:11.185703> post_processing_gw.py got cloud list:
2020-06-06T10:46:11.186036> [u’python CloudThingSpeak.py’]
2020-06-06T10:46:11.186372> Parsing cloud declarations
2020-06-06T10:46:11.186708> Parsed all cloud declarations
2020-06-06T10:46:11.187409> post_processing_gw.py got encrypted cloud list:
2020-06-06T10:46:11.187775> []
2020-06-06T10:46:11.188180> Parsing cloud declarations
2020-06-06T10:46:11.188536> Parsed all cloud declarations
2020-06-06T10:46:11.188897> post_processing_gw.py got LoRaWAN encrypted cloud list:
2020-06-06T10:46:11.189224> []
2020-06-06T10:46:11.189601> Starting thread to perform periodic gw status/tasks
2020-06-06T10:46:11.190124> 2020-06-06 10:46:11.170120
2020-06-06T10:46:11.190460> post status: gw ON
2020-06-06T10:46:11.190757> post status: executing periodic tasks
2020-06-06T10:46:11.304001> post status: start running
2020-06-06T10:46:11.304278> post status: exiting
2020-06-06T10:46:12.171456> Starting thread to perform fast statistics tasks
2020-06-06T10:46:13.174240>
2020-06-06T10:46:13.174595> Current working directory: /home/pi/lora_gateway
2020-06-06T10:47:17.414643> post_processing_gw.py found an alert_conf section
2020-06-06T10:47:17.416120> Parsing cloud declarations
2020-06-06T10:47:17.416263> [u’python CloudThingSpeak.py’]
2020-06-06T10:47:17.416380> Parsed all cloud declarations
2020-06-06T10:47:17.416487> post_processing_gw.py got cloud list:
2020-06-06T10:47:17.416593> [u’python CloudThingSpeak.py’]
2020-06-06T10:47:17.416751> Parsing cloud declarations
2020-06-06T10:47:17.416873> Parsed all cloud declarations
2020-06-06T10:47:17.416976> post_processing_gw.py got encrypted cloud list:
2020-06-06T10:47:17.417082> []
2020-06-06T10:47:17.417182> Parsing cloud declarations
2020-06-06T10:47:17.417284> Parsed all cloud declarations
2020-06-06T10:47:17.417387> post_processing_gw.py got LoRaWAN encrypted cloud list:
2020-06-06T10:47:17.417489> []
2020-06-06T10:47:17.417588> Starting thread to perform periodic gw status/tasks
2020-06-06T10:47:17.417701> 2020-06-06 10:47:17.409724
2020-06-06T10:47:17.417802> post status: gw ON
2020-06-06T10:47:17.417903> post status: executing periodic tasks
2020-06-06T10:47:17.470640> post status: start running
2020-06-06T10:47:17.470960> post status: exiting
2020-06-06T10:47:18.411162> Starting thread to perform fast statistics tasks
2020-06-06T10:47:19.414149>
2020-06-06T10:47:19.414489> Current working directory: /home/pi/lora_gateway

And the second question: are you testing gateway with modules SX1278 (AI Thinker)?

Yes, we tried and there is no issue if connection are good.

Please try the following steps:
1/ ssh to the gateway
2/ use option K to kill all processes
3/ exit with option Q
4/ run manually only the low-level radio bridge: sudo ./lora_gateway

then tell me what it says

[cpham2], thank you for your answer!
It printed:
SX1276 detected, starting.
SX1276 LF/HF calibration

^$**********Power ON: state 0
^$LoRa mode 1
^$Setting mode: state 0
^$Channel CH_10_868: state 0
^$Use PA_BOOST amplifier line
^$Set LoRa power dBm to 14
^$Power: state 0
^$Get Preamble Length: state 0
^$Preamble Length: 8
^$LoRa addr 1: state 0
^$SX1272/76 configured as LR-BS. Waiting RF input for transparent RF-serial brid ge
^$Default sync word: 0x12
^$Low-level gw status ON

It shows Channel CH_10_868, but in SX1278 freq=433.3

Some one problem with compilation:

pi@raspberrypi:~/lora_gateway $ sudo make lora_gateway_pi4
g++ -DPABOOST -DMAX_DBM=14 -DBAND433 -DRASPBERRY2 -c lora_gateway.cpp -o lora_gateway_pi2.o
lora_gateway.cpp: In function ‘int main(int, char**)’:
lora_gateway.cpp:1388:39: error: ‘optarg’ was not declared in this scope
case ‘a’ : loraMode = atoi(optarg);
^~~~~~
lora_gateway.cpp:1388:39: note: suggested alternative:
In file included from /usr/include/arm-linux-gnueabihf/bits/getopt_posix.h:27,
from /usr/include/unistd.h:869,
from arduPi_pi2.h:248,
from SX1272.h:36,
from lora_gateway.cpp:201:
/usr/include/arm-linux-gnueabihf/bits/getopt_core.h:36:14: note: ‘unistd::optarg’
extern char *optarg;
^~~~~~
make: *** [makefile:21: lora_gateway_pi2.o] Error 1

It is appeared after updating from v477 to v503.

As you have a RPI4, be sure to have uncommented CFLAGS+=-DGETOPT_ISSUE in raspberry.makefile. see https://github.com/CongducPham/LowCostLoRaGw/blob/master/gw_full_latest/raspberry.makefile

To set the default frequency band, in radio.makefile, there needs to be the definition of a frequency band, such as:

CFLAGS=-DPABOOST -DMAX_DBM=14 -DBAND433

see https://github.com/CongducPham/LowCostLoRaGw/blob/master/gw_full_latest/radio.makefile

My raspberry.makefile and radio.makefile are the same as you took. But after compiling and running lora_gateway, the frequency doesn’t change in log file: Channel CH_10_868: state 0

I don’t understand how, but I resolved this problem with frequency.
No, when I start - sudo ./lora_gateway_pi4 - I get errors:

^$Receive error 1
^$Receive error 1
^$Low-level gw status ON
^$Receive error 5

Segmentation fault

Be sure to not run 2 instances of the lora_gateway program. Use option K of cmd.sh to kill any previous processes. BTW, are you sure you have an RPI4? The best method is to run scripts/compile_lora_gateway.sh to compile for the correct platform.

Ok, I undestand you!..

Now I started Ping-Pong sketch on Arduino, in arduino terminal:
image

Why no Pong from gw?

In packet logger I see this:

Are there normal recieved data? and how can I get values from packet?

Probably because you run the gateway in raw mode. Ack is only available without the raw mode.

To get data from the packet, you need to activate a cloud script. Please run the information on https://github.com/CongducPham/LowCostLoRaGw