RHF0M301 Raspberry Pi with Basics Station

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.

Hi,

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.
image
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.

Hi,

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.
image
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.

Hi guys , i try to start my gw , but i found this issue root@raspberrypi:/etc/basicstation# systemctl status basicstation.service
● basicstation.service - Basic Sation TTN V3 service
Loaded: loaded (/lib/systemd/system/basicstation.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2022-01-11 22:19:43 GMT; 3s ago
Process: 1706 ExecStart=/opt/basicstation/bin/station -h /etc/basicstation --radio-init=/etc/basicstation/reset_gw.sh (code=exited, status=1/FAILURE)
Main PID: 1706 (code=exited, status=1/FAILURE)
CPU: 17ms
root@raspberrypi:/etc/basicstation#
Could you please help me with this issue?

Hi Andre.

I think the starting point to investigate your problem is to double check all connections between the Pi and the gateway card. Pay particular attention to which pin the gateway’s reset pin is connected to on the Raspberry Pi. Make sure that you use the correct pin in the reset.sh script.

Make sure that the SPI interface is enabled on the Raspberry Pi.

Also you need a good quality power supply to run the Pi and the gateway card together. I use an official Raspberry Pi power supply. I have tried some phone chargers, but even those rated for 2.2A do not work reliably.

Hi AndyG,
I used a Raspberry Pi 4B and when I want to reset the sx1301(start the reset_gw.sh),I got the error below:
./reset_gw.sh: line 4: echo: write error: Device or resource busy
./reset_gw.sh: line 5: /sys/class/gpio/gpio7/direction: No such file or directory
./reset_gw.sh: line 6: /sys/class/gpio/gpio7/value: No such file or directory
./reset_gw.sh: line 8: /sys/class/gpio/gpio7/value: No such file or directory
./reset_gw.sh: line 10: /sys/class/gpio/gpio7/value: No such file or directory
./reset_gw.sh: line 12: echo: write error: Invalid argument

And the reset_gw.sh is:
#! /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

First off, is GPIO 7 the signal connected to the concentrator reset on your particular hardware, or did you just copy that from someone else rather than verify it for our specific concentrator to pi adapter board?

And are you actually using basicstation, or did you just post in this topic because of a similar mention?

Not sure if it is the issue, but something I’ve noticed is that on some Linux systems, trying to again export a GPIO that is already exported has the odd effect of unexporting it, causing the /sys/class/gpio/gpio7/ or whatever directory to disappear. If this is such a system and you’re running the script multiple times it’s possible you’ve gotten such a mixed up state.

I’d try the commands manually one at a time checking what’s showing up in sysfs as you do so.

Actually,my concentrator is RHF0M301 and I am setting it through the method.Then I met this error.
My imager is “2022-01-28-raspios-bullseye-armhf.img”,the latest imager download in Operating system images – Raspberry Pi

As cslorabox says, you need to know which RPi GPIO pin is connected to your concentrator’s reset pin.

My notes describe how to make Pin 7 available to use as a reset pin. The script provided works for the adapter board supplied with my rhf0m301 from Seeed Studios which connects Pin 7 to reset. This is a problem with modern Rasbian builds which assume that Pin 7 is available as a chip select pin for SPI.

If your reset pin is connected to Pin 7 you will need to make it available by adding

overlay=spi0-1cs

in the [all] section of /boot/config.txt. This will tell Rasbian not to reserve Pin 7 as a Chip Select pin for SPI.

I think that more recent concentrator cards and adapter boards avoid using Pin 7, so check the documentation to see which pin is being used.

dtoverlay or overlay?
I have already added the dtoverlay = spi0-1cs like you said

Sorry, yes that was a cut and paste error.

The errors you are seeing are pretty much the same as I saw without the dtoverlay = spi0-1cs.

Is there anything else you are doing that might be setting/ resetting the modern RPi defaults for SPI after the boot phase? do you have any other SPI devices attached to the Pi besides the concentrator card?

There is nothing besides the concentrator.
And my situation is just like the NorHairil——it keeps disconnect and connect and repeat

Trace the circuit between the reset pin on the rhf0m301 and the RPi pin to make absolutely certain that you have the correct pin number.

If that is correct, you might try adjusting the speed of the SPI bus down to a lower level. I’m using an RPi 3B+. Is the RPi 4 SPI bus faster?

1 Like

Note that while miswiring or SPI clock issues could cause the concentrator not to operate, neither can explain the software error of the reset script itself.

That script would work just fine on a properly configured pi that didn’t have any concentrator attached at all, it’s the next stage of trying to actually talk to the concentrator where a wiring or signal integrity issue would present itself.

Checking that the pin wasn’t reserved in the boot config for another purpose was a good idea.

Beyond that, I personally would make sure I’d disabled any autorun of the gateway software, then reboot the pi, and try manually doing what the script does while checking to see if the /sys/class/gpio/gpio7 directory gets created and lets me manipulate the IO settings.