Minimal RAK224[56]/RAK831 TTN Gateway deb for Debian/Raspbian

Hi all,

ThinLinX Pty Ltd (https://thinlinx.com) is interested in integrating RAK2245/2246 gateway support into our TLXOS (embedded Linux) Raspberry Pi ports, based on Debian in the Pi >= 2 case (RAK2245/831) and Raspbian in the Pi 1/Zero case (RAK2246). To this end we have created some very minimalistic debs for setting up a TTN gateway on Debian/Raspbian using the RAK source code.

You can find these - and our source code modifications - at http://dietpc.org/rak2245-gateway/. I’m rather ignorant about the correct way to construct deb source packages, so we don’t have proper Debian source packages (sorry!). DietPC is not directly related to ThinLinX, it’s just a convenient web server (ThinLinX uses DietPC for its cut-down maintenance mode image).

These debs should work on pretty much any Debian ARMHF release (ARMv7) or Raspbian release (ARMv6). You must modify config.txt on your Raspberry Pi to enable SPI (dtparam=spi=on). You must also disable Bluetooth (dtoverlay=pi3-disable-bt (Pi >= 3, v7) or dtoverlay=disable-bt (Pi Zero, v6)) or set it to use ttyS0 rather than ttyAMA0 (dtoverlay=pi3-miniuart-bt (Pi >= 3, v7) or dtoverlay=miniuart-bt (Pi Zero, v6)) if the gateway has a GPS that requires /dev/ttyAMA0. If using Raspbian you can use rpi_config to make these changes.

If you have trouble with ttn-gateway.service failing to start for no readily explicable reason, try adding something like the following to /etc/rc.local (or similar):

echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed

This slows the Pi (3 assumed in above example) down to minimum CPU speed, which may help.

Are you asking for someone to test this for you?

Not really, just sharing my work in case someone else finds it useful. You can take it or leave it.

It seems to me that RAKwireless could avoid the need to maintain multi-gigabyte Raspbian forks for their official firmware by providing packages more like this. When boiled down to bare bones, to implement a TTN gateway you just need one tiny binary and some supporting shell script. A minimal ChirpStack gateway would be a little more complicated, but not much.

OK, context is everything - useful stuff, thank you!