Hi,
Some notes on getting Basics Station running on a Rasperry PI B3+ with the RHF0M301 from the Seeed Studio LoraWAN Gateway Kit.
I followed the iC880A tutorial from @bigjohnson posted in the forum here. It works really well, but there were some things to sort out for the RHF0M301, or more specifically the adapter board for the Pi, and I made some mistakes along the way.
I started with a new micro SD card and a clean installation of Raspbian Buster with all the updates done. The old card had been in use for three years, it was time to update the OS, and swapping back to the old card is the easy way to switch back to the old gateway config.
This gateway is indoors at home. I don’t need remote configuration, so I chose the LNS config.
When it came to creating the tc.trust file I downloaded the minimal certificate list using the download link from the TTN Documentation pages here.
I also used the code fragment from this TTN Documentation page, slightly modified, to create the tc.key file expected by the build from from the LNS API key.
$ export LNS_KEY="your-lns-api-key"
$ echo "Authorization: Bearer $LNS_KEY" | perl -p -e 's/\r\n|\n|\r/\r\n/g' > tc.key
At this point I made a mistake and also created a tc.crt file. It is not not part of the instructions and is not needed for LNS. The .crt file seems to cause Basics Station to choose a different authentication method and fail to connect. It took me a few hours to figure out what was causing the problem and it was solved by deleting the tc.crt file.
My RHF0M301 needs to be reset before the gateway starts. The adapter board that I have for the RHF0M301 connects the SX1301 reset pin to GPIO7 on the Raspberry Pi. When SPI is enabled in raspi-config the SPI configuration allocates GPIO7 as a chip select pin SPI CS1. Fortunately there is a dtoverlay file that will make GPIO7 available. I added dtoverlay=spi0-1cs in the [all] section of /boot/config.txt.
To reset the RHF0M301 I used this script for my reset_gw.sh file.
#! /bin/bash
SX1301_RESET_BCM_PIN=7
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
I added the --radio-init=reset_gw.sh parameter to the ExecStart line in the basicstation.service file.
ExecStart=/opt/basicstation/bin/station -h /etc/basicstation --radio-init=/etc/basicstation/reset_gw.sh
I also extended the default 200ms start up time by adding “RADIO_INIT_WAIT”: “2s”, to the station.conf file.
"station_conf": {
"RADIO_INIT_WAIT": "2s",
.....
Thanks to @bigjohnson for his tutorial, and I hope this helps some other RFH0M301 owners.