Hi everyone, I feel that Im close but I just cant figure it out. Using a Rpi 3b+ and the RHF0M301 from SEEEDstudio. Awful instruction on how to get it set up to Loriot, so i figured id try TTN.
I used the ic880a gateway instructions: GitHub - ttn-zh/ic880a-gateway at spi
My status log:
This is my global_conf.json :
{
"SX1301_conf": {
"lorawan_public": true,
"clksrc": 1,
"radio_0": {
"enable": true,
"type": "SX1257",
"freq": 904300000,
"rssi_offset": -166.0,
"tx_enable": true
"tx_freq_min": 923000000,
"tx_freq_max": 928000000
},
"radio_1": {
"enable": true,
"type": "SX1257",
"freq": 905000000,
"rssi_offset": -166.0,
"tx_enable": false
},
"chan_multiSF_0": {
/* Lora MAC channel, 125kHz, all SF, 903.9 MHz */
"enable": true,
"radio": 0,
"if": -400000
},
"chan_multiSF_1": {
/* Lora MAC channel, 125kHz, all SF, 904.1 MHz */
"enable": true,
"radio": 0,
"if": -200000
},
"chan_multiSF_2": {
/* Lora MAC channel, 125kHz, all SF, 904.3 MHz */
"enable": true,
"radio": 0,
"if": 0
},
"chan_multiSF_3": {
/* Lora MAC channel, 125kHz, all SF, 904.5 MHz */
"enable": true,
"radio": 0,
"if": 200000
},
"chan_multiSF_4": {
/* Lora MAC channel, 125kHz, all SF, 904.7 MHz */
"enable": true,
"radio": 1,
"if": -300000
},
"chan_multiSF_5": {
/* Lora MAC channel, 125kHz, all SF, 904.9 MHz */
"enable": true,
"radio": 1,
"if": -100000
},
"chan_multiSF_6": {
/* Lora MAC channel, 125kHz, all SF, 905.1 MHz */
"enable": true,
"radio": 1,
"if": 100000
},
"chan_multiSF_7": {
/* Lora MAC channel, 125kHz, all SF, 905.3 MHz */
"enable": true,
"radio": 1,
"if": 300000
},
"chan_Lora_std": {
/* Lora MAC channel, 250kHz, SF8, 904.6 MHz */
"enable": true,
"radio": 0,
"if": 300000,
"bandwidth": 500000,
"spread_factor": 8
},
"chan_FSK": {
/* FSK 50kbps channel, 868.8 MHz */
"enable": false,
},
"tx_lut_0": {
/* TX gain table, index 0 */
"pa_gain": 0,
"mix_gain": 8,
"rf_power": -6,
"dig_gain": 0
},
"tx_lut_1": {
/* TX gain table, index 1 */
"pa_gain": 0,
"mix_gain": 10,
"rf_power": -3,
"dig_gain": 0
},
"tx_lut_2": {
/* TX gain table, index 2 */
"pa_gain": 0,
"mix_gain": 12,
"rf_power": 0,
"dig_gain": 0
},
"tx_lut_3": {
/* TX gain table, index 3 */
"pa_gain": 1,
"mix_gain": 8,
"rf_power": 3,
"dig_gain": 0
},
"tx_lut_4": {
/* TX gain table, index 4 */
"pa_gain": 1,
"mix_gain": 10,
"rf_power": 6,
"dig_gain": 0
},
"tx_lut_5": {
/* TX gain table, index 5 */
"pa_gain": 1,
"mix_gain": 12,
"rf_power": 10,
"dig_gain": 0
},
"tx_lut_6": {
/* TX gain table, index 6 */
"pa_gain": 1,
"mix_gain": 13,
"rf_power": 11,
"dig_gain": 0
},
"tx_lut_7": {
/* TX gain table, index 7 */
"pa_gain": 2,
"mix_gain": 9,
"rf_power": 12,
"dig_gain": 0
},
"tx_lut_8": {
/* TX gain table, index 8 */
"pa_gain": 1,
"mix_gain": 15,
"rf_power": 13,
"dig_gain": 0
},
"tx_lut_9": {
/* TX gain table, index 9 */
"pa_gain": 2,
"mix_gain": 10,
"rf_power": 14,
"dig_gain": 0
},
"tx_lut_10": {
/* TX gain table, index 10 */
"pa_gain": 2,
"mix_gain": 11,
"rf_power": 16,
"dig_gain": 0
},
"tx_lut_11": {
/* TX gain table, index 11 */
"pa_gain": 3,
"mix_gain": 9,
"rf_power": 20,
"dig_gain": 0
},
"tx_lut_12": {
/* TX gain table, index 12 */
"pa_gain": 3,
"mix_gain": 10,
"rf_power": 23,
"dig_gain": 0
},
"tx_lut_13": {
/* TX gain table, index 13 */
"pa_gain": 3,
"mix_gain": 11,
"rf_power": 25,
"dig_gain": 0
},
"tx_lut_14": {
/* TX gain table, index 14 */
"pa_gain": 3,
"mix_gain": 12,
"rf_power": 26,
"dig_gain": 0
},
"tx_lut_15": {
/* TX gain table, index 15 */
"pa_gain": 3,
"mix_gain": 14,
"rf_power": 27,
"dig_gain": 0
}
},
"gateway_conf": {
"gateway_ID":"B827EBFFFE8384F5",
"servers":
[ { "server_address": "us-west.thethings.network",
"serv_port_up": 1700,
"serv_port_down": 1700,
"serv_enabled": true}]
}
}
And my start.sh:
#! /bin/bash
# Reset iC880a PIN
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
# Test the connection, wait if needed.
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
echo "[TTN Gateway]: Waiting for internet connection..."
sleep 30
done
# If there's a remote config, try to update it
if [ -d ../gateway-remote-config ]; then
# First pull from the repo
pushd ../gateway-remote-config/
git pull
git reset --hard
popd
# And then try to refresh the gateway EUI and re-link local_conf.json
# Same network interface name detection as on install.sh
# Get first non-loopback network device that is currently connected
GATEWAY_EUI_NIC=$(ip -oneline link show up 2>&1 | grep -v LOOPBACK | sed -E 's/^[0-9]+: ([0-9a-z]+): .*/\1/' | head -1)
if [[ -z $GATEWAY_EUI_NIC ]]; then
echo "ERROR: No network interface found. Cannot set gateway ID."
exit 1
fi
# Then get EUI based on the MAC address of that device
GATEWAY_EUI=$(cat /sys/class/net/$GATEWAY_EUI_NIC/address | awk -F\: '{print $1$2$3"FFFE"$4$5$6}')
GATEWAY_EUI=${GATEWAY_EUI^^} # toupper
echo "[TTN Gateway]: Use Gateway EUI $GATEWAY_EUI based on $GATEWAY_EUI_NIC"
INSTALL_DIR="/opt/ttn-gateway"
LOCAL_CONFIG_FILE=$INSTALL_DIR/bin/local_conf.json
if [ -e $LOCAL_CONFIG_FILE ]; then rm $LOCAL_CONFIG_FILE; fi;
ln -s $INSTALL_DIR/gateway-remote-config/$GATEWAY_EUI.json $LOCAL_CONFIG_FILE
fi
# Fire up the forwarder.
./poly_pkt_fwd
Does anyone have any thoughts ?
Appreciate any help!