RHF0M301 Raspberry Pi with Basics Station

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

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.

1 Like

Hi AndyG,

For the gateway EUI, can i generate it and use the EUI that given by the The Things Stack?

Hi NorHairil,

The Gateway EUI must be unique and based on something that you own. As far as I know the TTN console does not generate the EUI for gateways.

I create mine from the MAC address of the ethernet port on my Raspberry Pi. Ethernet MAC addresses are already unique. .

The MAC address is six pairs of hexadecimal characters. The GatewayEUI needs to be eight pairs. The convention is to insert FF FE in the middle of the MAC address.

Use the ifconfig command to get the MAC address for eth0:
IE. ether 01:23:45:67:89:ab would make a GatewayEUI 012345fffe6789ab

Ouh okay I got it.

BTW, I have problem with this error.

root@raspberrypi:~# cp build-rpi-std/bin/station /opt/basicstation/bin cp: cannot stat 'build-rpi-std/bin/station': No such file or directory

Do you know what cause this error? Do i need to get into root from the first step?

Sorry I’m really a newbie in LoRa world :pray: Hope you can help me go through this.


I’m not sure how much Raspberry Pi and Linux experience you have, so apologies if this seems very basic. Also I’m not an expert either.

Something may have gone wrong in the “make” command, or you are not in the basicstation directory.
Try a pwd command and see if you are somewhere like /home/pi/basicstation directory. When you did the sudo su - command it might have changed the current directory to /root instead.

Don’t worry about being a newbie. We all had to start in the same place :slight_smile:

Hi AndyG,

Please help me a little bit more.
I got live data like this. Why it keeps disconnect and connect and repeat?

I have followed all your steps except for the /boot/config.txt part.


Check the basicstation log files on the Raspberry Pi. They should be in /var/log. The log file will let you see what is happening. If you want more detail in the log file, you can change the log_level to verbose in the station.conf file.

It is possible that the SX130X chip needs a reset before Basics Station starts. Check that you have chosen the correct reset pin. If your adapter board connects the SX130X reset pin to pin 7 on the Raspberry Pi, then the option in config.txt will be needed to make pin 7 available.

Thanks AndyG, finally I can connect the gateway to the TTN.
But I have another problem. When I reboot my Raspberry Pi, I got the Kernel Panic error like the picture below shows.
Do you know how to deal with this type of problem?

Hi NorHairil,
I’m definitely not any kind of Raspberry Pi or Linux expert. The error indicates that the Pi cannot find the root file system on the SD card.

The first thing I would try is removing and reinserting the SD card, but I suspect that the file system on the SD card has probably been corrupted somehow.

Have you been getting low power warning messages on the Pi? With the gateway connected you need to make sure that you have a good power supply.

Search the Internet for ways to repair the file system and keep the files. If the SD card has already been used for few years, it is sometimes quicker and safer to redo the build again on a new SD card.