Service Error / Not Connected in the Things Network

Hi,

There are already quite a few topic on the matter, however I haven’t managed to find any solution.

I have followed the instructions in ic880a-gateway . The only thing I have changed due to 4,6 pins of being in a fan, I have put the power to 2, 9.

I have also enabled spi as it is mentioned:
sudo raspi-config nonint get_spi
0 (enabled)

I run

sudo systemctl status ttn-gateway

● ttn-gateway.service - The Things Network Gateway
   Loaded: loaded (/lib/systemd/system/ttn-gateway.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2021-04-04 23:36:30 EEST; 1s ago
  Process: 15300 ExecStart=/opt/ttn-gateway/bin/start.sh (code=exited, status=1/FAILURE)
 Main PID: 15300 (code=exited, status=1/FAILURE)

Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Ghoststream data is disabled
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Radiostream data is enabled
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Statusstream data is enabled
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Beacon is disabled
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Monitor is disabled
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Contact email configured to "symeon.mattes@gmail.com"
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Description configured to "ttn-ic880a"
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: Successfully contacted server router.eu.thethings.network
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: INFO: [main] Starting the concentrator
Apr 04 23:36:30 ttn-gateway ttn-gateway[15300]: ERROR: [main] failed to start the concentrator

I checked /var/log/syslog and I receive:

Apr  4 23:38:08 ttn-gateway systemd[1]: ttn-gateway.service holdoff time over, scheduling restart.
Apr  4 23:38:08 ttn-gateway systemd[1]: Stopping The Things Network Gateway...
Apr  4 23:38:08 ttn-gateway systemd[1]: Starting The Things Network Gateway...
Apr  4 23:38:08 ttn-gateway systemd[1]: Started The Things Network Gateway.
Apr  4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 5: echo: write error: Device or resource busy
Apr  4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 6: /sys/class/gpio/gpio25/direction: No such file or directory
Apr  4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 7: /sys/class/gpio/gpio25/value: No such file or directory
Apr  4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 9: /sys/class/gpio/gpio25/value: No such file or directory
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 11: /sys/class/gpio/gpio25/value: No such file or directory
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 13: echo: write error: Invalid argument
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: *** Poly Packet Forwarder for Lora Gateway ***
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: Version: 2.1.0
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: *** Lora concentrator HAL library version info ***
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: Version: 3.1.0; Options: native;
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: ***
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Little endian host
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: found global configuration file global_conf.json, parsing it
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: lorawan_public 1, clksrc 1
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Configuring TX LUT with 16 indexes
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: radio 0 enabled (type SX1257), center frequency 867500000, RSSI offset -166.000000, tx enabled 1
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: radio 1 enabled (type SX1257), center frequency 868500000, RSSI offset -166.000000, tx enabled 0
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 0>  radio 1, IF -400000 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 1>  radio 1, IF -200000 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 2>  radio 1, IF 0 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 3>  radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 4>  radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 5>  radio 0, IF 0 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 6>  radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora multi-SF channel 7>  radio 0, IF 400000 Hz, 125 kHz bw, SF 7 to 12
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Lora std channel> radio 1, IF -200000 Hz, 250000 Hz bw, SF 7
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: FSK channel> radio 1, IF 300000 Hz, 125000 Hz bw, 50000 bps datarate
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: gateway MAC address is configured to AA555A0000000000
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Found 2 servers in array.
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Server 0 configured to "127.0.0.1", with port up "1680" and port down "1681"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Server 1 configured to "iot.semtech.com", with port up "1680" and port down "1680"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Found 5 system calls in array.
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: System command 0: "df -m"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: System command 1: "free -h"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: System command 2: "uptime"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: System command 3: "who -a"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: System command 4: "uname -a"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: monitor hostname or IP address is configured to "127.0.0.1"
Apr  4 23:38:09 ttn-gateway systemd[1]: ttn-gateway.service: main process exited, code=exited, status=1/FAILURE
Apr  4 23:38:09 ttn-gateway systemd[1]: Unit ttn-gateway.service entered failed state.
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: monitor port is configured to "2008"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: ghost hostname or IP address is configured to "127.0.0.1"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: ghost port is configured to "1918"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: downstream keep-alive interval is configured to 10 seconds
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: statistics display interval is configured to 30 seconds
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: upstream PUSH_DATA time-out is configured to 100 ms
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: packets received with a valid CRC will be forwarded
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: packets received with a CRC error will NOT be forwarded
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: packets received with no CRC will NOT be forwarded
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: GPS serial port path is configured to "/dev/ttyAMA0"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: SSH path is configured to "/usr/bin/ssh"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: SSH port is configured to 22
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: HTTP port is configured to 80
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: NGROK path is configured to "/usr/bin/ngrok"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Reference latitude is configured to 10.000000 deg
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Reference longitude is configured to 20.000000 deg
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Reference altitude is configured to -1 meters
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: GPS is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Using fake GPS coordinates instead of real.
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: antenna_gain 0 dBi
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Upstream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Downstream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Ghoststream data is disabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Radiostream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Statusstream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Beacon is disabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Monitor is disabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Platform configured to "IMST + Rpi"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Contact email configured to "operator@gateway.tst"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Description configured to "Update me"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: found local configuration file local_conf.json, parsing it
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: redefined parameters will overwrite global parameters
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: local_conf.json does not contain a JSON object named SX1301_conf
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: local_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: gateway MAC address is configured to B827EBFFFE048ECF
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Found 1 servers in array.
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Server 0 configured to "router.eu.thethings.network", with port up "1700" and port down "1700"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: packets received with a valid CRC will be forwarded
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: packets received with a CRC error will NOT be forwarded
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: packets received with no CRC will NOT be forwarded
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Reference latitude is configured to 38.036345 deg
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Reference longitude is configured to 23.757590 deg
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Reference altitude is configured to 0 meters
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: GPS is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: antenna_gain 0 dBi
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Upstream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Downstream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Ghoststream data is disabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Radiostream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Statusstream data is enabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Beacon is disabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Monitor is disabled
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Contact email configured to "symeon.mattes@gmail.com"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Description configured to "ttn-ic880a"
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: Successfully contacted server router.eu.thethings.network
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: INFO: [main] Starting the concentrator
Apr  4 23:38:09 ttn-gateway ttn-gateway[15626]: ERROR: [main] failed to start the concentrator

I tried to create the gpio25 directory

echo 25 >/sys/class/gpio/export
bash: echo: write error: Device or resource busy

In ls -la /sys/class/gpio I have:

drwxrwx---  2 root gpio    0 Apr  4 22:16 .
drwxr-xr-x 51 root root    0 Apr  4 22:23 ..
-rwxrwx---  1 root gpio 4096 Apr  4 23:44 export
lrwxrwxrwx  1 root gpio    0 Apr  4 22:16 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
lrwxrwxrwx  1 root gpio    0 Apr  4 22:16 gpiochip100 -> ../../devices/gpiochip2/gpio/gpiochip100
lrwxrwxrwx  1 root gpio    0 Apr  4 22:16 gpiochip128 -> ../../devices/gpiochip1/gpio/gpiochip128
-rwxrwx---  1 root gpio 4096 Apr  4 23:44 unexport

Furthermore in cat /sys/kernel/debug/gpio

gpiochip0: GPIOs 0-53, parent: platform/3f200000.gpio, pinctrl-bcm2835:
 gpio-4   (                    |w1                  ) in  lo    
 gpio-25  (                    |ads7846_pendown     ) in  hi    

gpiochip2: GPIOs 100-101, brcmvirt-gpio, can sleep:
 gpio-100 (                    |?                   ) out lo    

gpiochip1: GPIOs 128-135, brcmexp-gpio, can sleep:
 gpio-135 (                    |?                   ) in  lo    

I have doubled checked also the cables and the antena, it seems to be ok. The concentrator has a constant LED on.

Any suggestions?

Thanks

Also

Concentrator not reset/started - check you have assigned the correct reset pin in your instalation - how are you connecting to the iMST board? (Search will reveal lots of historic answers on correcting this getting the right Broadcom/Pi pin if using a variant of RPi etc.)

Hi,

All the connections are from raspberry pi3 to IMST board through female to female jumper cables. I have checked the cables I’m using and they are not broken.

The pin setup is as described in ic880a-gateway, i.e.

iC880a pin Description RPi physical pin
21 Supply 5V 2
22 GND 6-> I just used 9 here
13 Reset 22
14 SPI CLK 23
15 MISO 21
16 MOSI 19
17 NSS 24

I find weird the gpio25 error, i.e.

Apr 4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 5: echo: write error: Device or resource busy
Apr 4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 6: /sys/class/gpio/gpio25/direction: No such file or directory
Apr 4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 7: /sys/class/gpio/gpio25/value: No such file or directory
Apr 4 23:38:08 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 9: /sys/class/gpio/gpio25/value: No such file or directory
Apr 4 23:38:09 ttn-gateway ttn-gateway[15626]: /opt/ttn-gateway/bin/start.sh: line 11: /sys/class/gpio/gpio25/value: No such file or directory

I went to /opt/ttn-gateway/start.sh where 25 pin is defined, I changed it to 4 but with no success

…does the user you run the script from have the permissions to change/write to the GPIOs (just try it as root).

For the general issue: thats very likely the reset problem; i set up an IMST lite gateway where the reset pin is on GPIO5, but the initial script i was using wanted to reset it by GPIO7. My gateway was working initially, but when i once restarted the gateway i just couldnt get it to start anymore - with the same messages you have there; Using the proper GPIO to reset the Lora chip fixed it).

What do you mean?

I have tried different ways. I installed again the script and I used the 22 gpio pin which is supposed to be the RESET pin. Not sure what I should do.

yes…the user has root rights…it’s actually the root

Ok, that bugged me now :slight_smile: Im running the packet forwarder of @kersing and so ended up using this script to reset the gateway (here you have GPIO7 as a default i mentioned before). This script does sleep between the steps and if i test export a random GPIO without sleeping between the steps, i sometimes get the errors you have. (and your output of /sys/kernel/debug/gpio above assumes it worked at some point). Maybe you can get it to work with that script:

reset_lgw.sh

 ttn@ttn-gw:~$ bash -x test_gpio.sh
+ GPIO=26
+ sleep=0.2
+ echo 26
+ sleep 0.2
+ echo out
+ sleep 0.2
+ echo 0

ttn@ttn-gw:~$ bash -x test_gpio_nosleep.sh
+ GPIO=26
+ echo 26
+ echo out
test_gpio_nosleep.sh: line 6: /sys/class/gpio/gpio26/direction: Permission denied
+ echo 0
test_gpio_nosleep.sh: line 7: /sys/class/gpio/gpio26/value: Permission denied

I’m trying to understand what GPIO7 reset is…in ic880a-gateway there reset is the 22 pin. Shouldn’t be gpio22? In start.sh for some reason it uses the 25pin…

Then test_gpio.sh where did you find it?

I have the reset_lgw and apart from 25gpio that is busy the other is seems to be ok

Sure you have to use it with the GPIO which is correct for your setup (so obviously GPIO25 in your case which is RPi Pin22).

“test_gpio.sh” is just a test (below). The 2nd script doesnt sleep between the steps. If GPIO25 is still persistently failing, try to attach Reset to another Pin which is definitively free in your case and just use this one.

#!/bin/bash

GPIO=26
sleep=0.2

echo "$GPIO"  > /sys/class/gpio/export
sleep $sleep
echo "out" > /sys/class/gpio/gpio$GPIO/direction
sleep $sleep
echo "0"   > /sys/class/gpio/gpio$GPIO/value
1 Like

I have tried all the ports 1…40. The one that give error are (4,25) and an example of the error for 4:

./test_gpio.sh: line 15: echo: write error: Device or resource busy
./test_gpio.sh: line 17: /sys/class/gpio/gpio4/direction: No such file or directory
./test_gpio.sh: line 19: /sys/class/gpio/gpio4/value: No such file or directory

For gpio 34-39 the system hangs.

In GPIO it has all the pins. I changed my pin 22 that the document suggests to PIN15, which is GPIO22 but again with no success

For GPIO4 thats expected, its seems occupied for 1-wire in your setup, from above:

 gpio-4   (                    |w1                  ) in  lo    

I dont know what this is (searching for it, ads7846 seems to be a touch screen controller?)

 gpio-25  (                    |ads7846_pendown     ) in  hi    

GPIO22 - no idea; i like this pinout, which lists some other special functions and what pins they might occupy; but GPIO22 is likely free:
pinout.xyz

(just to be sure, once exported, trying to reexport a GPIO will also end up as “…resource busy” before you unexport it again; but it should be listed in /sys/class/gpio, and you must be able to write to it).

The script would export / unexport it; if you use the reset script mentioned above, run:

./reset_lgw.sh stop 22
./reset_lgw.sh start 22

…then start your concentrator, any change?
If not and there is no other peripheral device attached which might block something im running out of ideas.

Hi…the reset_lgw.sh stop/start 22 didn’t do anything.

For the gpio25, I used to have connected a touch screen, but it was through hdmi. It was raspbery pi with 7’’ touch screen

Isn’t it possible on the startup not to initialise gpio25…

Hi…thanks all for your help. I made a full reinstallation of raspberry pi OS, and now everything works as expected!

All the pins are as in the setup of the manual and the gpio25 is working fine now.

Thanks

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.