RPi+RAK2245 connection error

(Sreekanth Godey) #1

Hello:

I just got my RAK2245 board and started integrating with my RPi Model 3B. I am seeing an error where Gateway SW is not able to connect to the concentrator board. Initially though it was SPI problem. SPI is working fine till 90 MHz in external loopback mode. Below is the error message. Any sugesstions on what is going wrong here?

lgw_rxif_setconf:629: Note: LoRa ‘multi’ if_chain 3 configuration; en:1 freq:200000 SF_mask:0x7e
lgw_rxif_setconf:629: Note: LoRa ‘multi’ if_chain 4 configuration; en:1 freq:400000 SF_mask:0x7e
lgw_rxif_setconf:629: Note: LoRa ‘multi’ if_chain 5 configuration; en:1 freq:-200000 SF_mask:0x7e
lgw_rxif_setconf:629: Note: LoRa ‘multi’ if_chain 6 configuration; en:1 freq:0 SF_mask:0x7e
lgw_rxif_setconf:629: Note: LoRa ‘multi’ if_chain 7 configuration; en:1 freq:200000 SF_mask:0x7e
lgw_rxif_setconf:603: Note: LoRa ‘std’ if_chain 8 configuration; en:1 freq:300000 bw:1 dr:4
lgw_rxif_setconf:537: Note: if_chain 9 disabled
Note: SPI port opened and configured ok
Note: SPI read success
Note: SPI read success
ERROR: FAIL TO CONNECT BOARD
2019-05-12 05:18:07.536 [AIO:XDEB] [4] ws_closing_w state=5
2019-05-12 05:18:07.536 [AIO:DEBU] Echoing close - reason=1000
2019-05-12 05:18:07.909 [AIO:XDEB] [4] ws_connected_r state=9
2019-05-12 05:18:07.909 [AIO:DEBU] [4] Server sent close: reason=1000
2019-05-12 05:18:07.909 [AIO:DEBU] [4] WS connection shutdown…
2019-05-12 05:18:07.910 [TCE:VERB] Connection to MUXS closed in state -1
2019-05-12 05:18:07.910 [TCE:INFO] INFOS reconnect backoff 10s (retry 1)

thanks a bunch,
SG

(Todor Velev) #2

Hi @sgodey. Did you enable the SPI from raspi-config? If yes please run the util_spi_stress located in lora gateway folder , ad post results.

Regards
Todor

(Sreekanth Godey) #3

All the tests are returning lgw_connect () errors. SPI is enabled as I did some SPI look back tests based on https://github/spidev_test.

ress $ ./util_spi_stress -t 1
INFO: Starting LoRa concentrator SPI stress-test number 1
ERROR: lgw_connect() did not return [email protected]:~/workspace/github/pinress $ ./util_spi_stress -t 2
INFO: Starting LoRa concentrator SPI stress-test number 2
ERROR: lgw_connect() did not return [email protected]:~/workspace/github/pinress $ ./util_spi_stress -t 3
INFO: Starting LoRa concentrator SPI stress-test number 3
ERROR: lgw_connect() did not return [email protected]:~/workspace/github/pinress $ ./util_spi_stress -t 4
INFO: Starting LoRa concentrator SPI stress-test number 4
ERROR: lgw_connect() did not return [email protected]:~/workspace/github/pin

(ZhuQI) #4

Where did you download the gateway firmware or code?

(Sreekanth Godey) #5

The Lora basicstation code that was opensourced by SemTech in Feb.

(ZhuQI) #6

Which country are you building in?
Which frequency band is the gateway used?

(Sreekanth Godey) #7

Hello ZhuQi

I am building it for US. 915 MHz.

thanks
SG

(ZhuQI) #8

Try the following steps:

1.sudo nano basicstation/deps/lgw/platform-rpi/libloragw/src/loragw_spi.native.c,Change 8000000 in the file to 1000000
111

2.cd basicstation/deps/lgw/platform-rpi/libloragw
make clean; make

3.cp basicstation/deps/lgw/platform-rpi/libloragw/libloragw.a basicstation/build-rpi-std/lib/liblgw.a

4.cd basicstation
make platform=rpi variant=std

5.Create a script file reset.sh and enter the content
#! /bin/bash
SX1301_RESET_BCM_PIN=17
echo “$SX1301_RESET_BCM_PIN” > /sys/class/gpio/export
echo “out” > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/direction
echo “0” > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/value
sleep 0.1
echo “1” > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/value
sleep 0.1
echo “0” > /sys/class/gpio/gpio$SX1301_RESET_BCM_PIN/value
sleep 0.1
echo “$SX1301_RESET_BCM_PIN” > /sys/class/gpio/unexport

6.chmod + x reset.sh

7.sudo ./reset.sh(Every time the gateway restarts, it needs to be executed once.)

  1. cd examples/live-s2.sm.tc
    RADIODEV=/dev/spidev0.0 …/…/build-rpi-std/bin/station

9.When you see the print below, it means the gateway is working properly.

1 Like
(Sreekanth Godey) #9

Thanks ZhuQi. That worked. So it is essentially reducing the SPI speed and resetting the concentrator correctly. Correct?

(ZhuQI) #10

Yes, your summary is more concise than my description.:grinning: