PiSupply / iot-lora-image

RPi SD Card Image for IoT LoRa Range
11 stars 6 forks source link

packet forwarder not starting anymore #76

Closed cipy closed 3 years ago

cipy commented 3 years ago
Oct 29 22:30:33 piAir iot-lora-gateway[1187]: 22:30:33  INFO: [main] Starting the concentrator
Oct 29 22:30:33 piAir iot-lora-gateway[1187]: 22:30:33  ERROR: [main] failed to start the concentrator
Oct 29 22:30:33 piAir systemd[1]: iot-lora-gateway.service: Main process exited, code=exited, status=1/FAILURE
Oct 29 22:30:33 piAir systemd[1]: iot-lora-gateway.service: Failed with result 'exit-code'.
Oct 29 22:30:43 piAir systemd[1]: iot-lora-gateway.service: Service RestartSec=10s expired, scheduling restart.
Oct 29 22:30:43 piAir systemd[1]: iot-lora-gateway.service: Scheduled restart job, restart counter is at 13.
Oct 29 22:30:43 piAir systemd[1]: Stopped IOT LoRa Gateway Packet Forwarder.
Oct 29 22:30:43 piAir systemd[1]: Starting IOT LoRa Gateway Packet Forwarder...
Oct 29 22:30:44 piAir iot-lora-gateway-reset.sh[1196]: PHP Notice:  Undefined index: lbt_cfg in /var/www/iotloragateway/html/updatePacketfwd.php on line 159
Oct 29 22:30:44 piAir iot-lora-gateway-reset.sh[1196]: 
Oct 29 22:30:44 piAir iot-lora-gateway-reset.sh[1196]: 
ryanteck commented 3 years ago

Hi @cipy ,

has anything on your setup changed at all? We haven't really updated this as I think I was going to stop supporting it however will see what I can do.

ryanteck commented 3 years ago

Actually I notice the logs say PHP, but this is the Balena / Resin configuration.

What method of software are you using?

cipy commented 3 years ago

Hi @ryanteck

I'm using https://uk.pi-supply.com/products/iot-lora-gateway-hat-for-raspberry-pi?

with your own gateway image. it did work quite nicely, but today after a reboot/power loss it won't start anymore

it just says in web UI

Packet Forwarder The packet forwarder service is not running.

Thanks,

ryanteck commented 3 years ago

transferred from Balena repo to image repo

ryanteck commented 3 years ago

Hmm, this is a bit of a weird one and not something experienced before. I'll login to mine and see if mines started experiencing the same issue.

ryanteck commented 3 years ago

Just to help me diagnose, which frequency plan are you on?

cipy commented 3 years ago

868Mhz

Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: Little endian host
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: found global configuration file /opt/iotloragateway/global_conf.json, parsing it
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: /opt/iotloragateway/global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: lorawan_public 1, clksrc 1
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: no configuration for LBT
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: antenna_gain 0 dBi
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: Configuring TX LUT with 16 indexes
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: radio 0 enabled (type SX1257), center frequency 867500000, RSSI offset -166.000000, tx enabled 1
Oct 30 11:56:15 piAir iot-lora-gateway[30541]: 11:56:15  INFO: radio 1 enabled (type SX1257), center frequency 868500000, RSSI offset -166.000000, tx enabled 0
ryanteck commented 3 years ago

Hmm so should be all working,

Have you tried re-seating the hardware? (Power down the Pi, re-seat the HAT onto the Pi and the LoRa module into the hat).

How long has it been going for roughly?

Thanks

cipy commented 3 years ago

well,

I ignored it overnight and packet forwarder came back online, but the gateway to TTN was [still] disconnected.

Now after a reboot, the packet forwarder is gone again.

Oct 30 15:35:55 piAir iot-lora-gateway[1544]: 15:35:55  INFO: [Transports] Initializing protocol for 1 servers
Oct 30 15:35:55 piAir iot-lora-gateway[1544]: 15:35:55  INFO: [TTN] server "bridge.eu.thethings.network" connected
Oct 30 15:35:55 piAir iot-lora-gateway[1544]: 15:35:55  INFO: [main] Starting the concentrator
Oct 30 15:35:55 piAir iot-lora-gateway[1544]: 15:35:55  ERROR: [main] failed to start the concentrator
Oct 30 15:35:55 piAir systemd[1]: iot-lora-gateway.service: Main process exited, code=exited, status=1/FAILURE
Oct 30 15:35:55 piAir systemd[1]: iot-lora-gateway.service: Failed with result 'exit-code'.

It has been online for about 2 months. the LoRaWAN HAT came in one piece and I did not move it nor shake it since. should I take the HAT out and put it back?

Thanks,

ryanteck commented 3 years ago

If you could that would help, powering down the Pi and then removing the HAT and then the Module itself from the HAT. And then putting it all back together just incase there is a loose or slightly dirty connection.

If that doesn't work then the next step would be possibly to re-flash the SD card incase it is a software issue to just rule that out.

Can I also confirm which model of Raspberry Pi you're using and if you could at the same time check what is the rating of the power supply please incase that's not providing enough power (If you notice the Red light on the Pi flash at all when it's turning on as well).

cipy commented 3 years ago

I'm using RPi 3A+

the packet forwarder eventually comes back online, but are there any issues in TTN Europe?

Now I get:

Oct 30 21:21:18 piAir iot-lora-gateway[23059]: src/ttn_transport.c:371:ttn_connect(): ttn_connect: sleeping() at 100, total 120
Oct 30 21:21:18 piAir iot-lora-gateway[23059]: src/ttn_transport.c:371:ttn_connect(): ttn_connect: sleeping() at 110, total 120
Oct 30 21:21:18 piAir iot-lora-gateway[23059]: 21:21:18  ERROR: [TTN] Connection to server "" failed, retry in 240 seconds
Oct 30 21:25:18 piAir iot-lora-gateway[23059]: src/ttn_transport.c:371:ttn_connect(): ttn_connect: sleeping() at 0, total 240
Oct 30 21:25:18 piAir iot-lora-gateway[23059]: src/ttn_transport.c:371:ttn_connect(): ttn_connect: sleeping() at 10, total 240

Thanks,

ryanteck commented 3 years ago

Hmm, are you using a 4G connection at all?

It's the third time this week I've seen that issue and it's usually related to the Pi not having an internet connection in time for it to work.

Of which the current recommendation would be.

Enable SSH by shutting down the pi, putting the SD Card into a computer and creating a blank file named "ssh" on the boot section of the SD Card.

Boot up the Pi and use an SSH client (Such as putty) to login, with the username "pi" & password "raspberry".

Run sudo nano /opt/iotloragateway/iot-lora-gateway-reset.sh to edit the script which is ran on boot.

Add a # to the line that begins php -f /var/www/iotloragateway/html/updatePacketfwd.php.

Save and quit by pressing ctrl-x, then y, then enter.

After we then need to run the command that we commented out once by running php -f /var/www/iotloragateway/html/updatePacketfwd.php

And then reboot the packet forwarder with sudo systemctl restart iot-lora-gateway.service

And hopefully that will resolve it.

cipy commented 3 years ago

Nop, not using 4G. it's plain WiFi

Question: but if I reset the gateway, how can I get all my (few) settings back? (like: application, gateway, IDs)

Thanks,

ryanteck commented 3 years ago

Hi @cipy ,

By reset I assume you mean re-flash the SD Card? If so the gateway itself doesn't store any application information, IDs etc so there's not really anything to back up. Once re-flashed you'll just need to re-enter your gateways ID and Key into the software.

cipy commented 3 years ago

$ php -f /var/www/iotloragateway/html/updatePacketfwd.php PHP Notice: Undefined index: lbt_cfg in /var/www/iotloragateway/html/updatePacketfwd.php on line 159

How about this one? Thanks,

ryanteck commented 3 years ago

I believe you can just ignore that warning if I remember right but I could be wrong. If you still have an issue then I can re-check.

cipy commented 3 years ago

Plus

Dec 08 12:06:42 piAir iot-lora-gateway[1846]: 12:06:42 ERROR: [main] failed to start the concentrator Dec 08 12:06:42 piAir systemd[1]: iot-lora-gateway.service: Main process exited, code=exited, status=1/FAILURE Dec 08 12:06:42 piAir systemd[1]: iot-lora-gateway.service: Failed with result 'exit-code'.

ryanteck commented 3 years ago

@cipy do you have a bit more of the log above that section? Theres quite a bit of handy information above that section which could possibly help diagnose the issue.

Did you try re-seating the components?

cipy commented 3 years ago

$ sudo bash /opt/iotloragateway/iot-lora-gateway-reset.sh Beginning of test for loragw_reg.c ERROR: CONCENTRATOR UNCONNECTED IMPLICIT_PAYLOAD_LENGHT = 0 (should be 197) FRAME_SYNCH_PEAK2_POS = 0 (should be 11) PREAMBLE_SYMB1_NB = 0 (should be 49253) ADJUST_MODEM_START_OFFSET_SF12_RDX4 = 0 (should be 3173) IF_FREQ_1 = 0 (should be -1947) End of test for loragw_reg.c

I'll double check the HAT, it came already assembled, order PS-72608-UK and where it stays now -- there are no vibrations 💯

ryanteck commented 3 years ago

Hi @cipy ,

Sorry but you say from the Pi Hut?

ryanteck commented 3 years ago

@cipy could you take a picture of the HAT on the Pi for me to have a look to see everything looks OK?

cipy commented 3 years ago

sorry, I confused the pi+shops. I have the LoraWAN HAT from Pi Supply, order id quoted above 👍

ryanteck commented 3 years ago

@cipy Ok that's no problem then.

If you could still take a picture and re-seat the components just incase it is a bad connection then that would help.

Thanks

cipy commented 3 years ago

here it is when it was working lorawan gw 💯

cipy commented 3 years ago

What to re-seat? Should I try to get the RAK card out, and put it back? (I never removed it from there) Thanks,

ryanteck commented 3 years ago

Aha,

The issue here would be that the Envrio+ pHAT can't be used in conjunction with the LoRa Gateway HAT.

It looks like the Enviro+ pHAT uses the SPI Bus + PIn 22 which our HAT also uses (See https://pinout.xyz/pinout/enviro_plus & https://pinout.xyz/pinout/iot_lora_gateway_hat).

Could you try without the Enviro pHAT?

cipy commented 3 years ago

Oh, the packet forwarder stays now up if I'm not loading the Python code for Enviro+PMS5003 👍 🤦