summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2021-06-10 15:04:44 -0500
committerJohn Klug <john.klug@multitech.com>2021-08-10 18:38:35 -0500
commitaa29d434b31002c0946036a4f3de14a7de4cfb27 (patch)
tree24368d63a1ed47572073f42069754c0df9f52d02
parent49fa683f2ab79249f6d17058250f855a216d63f1 (diff)
downloadmts-io-aa29d434b31002c0946036a4f3de14a7de4cfb27.tar.gz
mts-io-aa29d434b31002c0946036a4f3de14a7de4cfb27.tar.bz2
mts-io-aa29d434b31002c0946036a4f3de14a7de4cfb27.zip
Added mtac-003 reset scripts
-rw-r--r--util/mtac_003_ap1_reset.sh79
-rw-r--r--util/mtac_003_ap2_reset.sh79
2 files changed, 158 insertions, 0 deletions
diff --git a/util/mtac_003_ap1_reset.sh b/util/mtac_003_ap1_reset.sh
new file mode 100644
index 0000000..f19f29e
--- /dev/null
+++ b/util/mtac_003_ap1_reset.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# This script is intended to be used on MTAC-003V3 platform, it performs
+# the following actions:
+# - export/unpexort pioC9 and pioB12 used to reset the SX1302 chip and setup AP1_NRESET
+# - export/unexport pioC10 used to reset the optional SX1261 radio used for LBT/Spectral Scan
+#
+# Usage examples:
+# ./reset_lgw.sh stop
+# ./reset_lgw.sh start
+
+# GPIO mapping has to be adapted with HW
+#
+
+SX1302_RESET_PIN=73 # SX1302 reset
+AP1_NRESET_PIN=44 # AP1_NRESET
+SX1261_RESET_PIN=74 # SX1261 reset (LBT / Spectral Scan)
+SX1302_RESET_pio=C9 # pio for SX1303 reset
+AP1_NRESET_pio=B12 # pio for AP1_NRESET
+SX1261_NRESET_pio=C10 # pio for SX1261 NRESET
+
+WAIT_GPIO() {
+ sleep 0.1
+}
+
+init() {
+ # setup GPIOs
+ echo "$SX1302_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
+ echo "$SX1261_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
+ echo "$AP1_NRESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
+
+ # set GPIOs as output
+ echo "out" > /sys/class/gpio/pio$SX1302_RESET_pio/direction; WAIT_GPIO
+ echo "out" > /sys/class/gpio/pio$SX1261_NRESET_pio/direction; WAIT_GPIO
+ echo "out" > /sys/class/gpio/pio$AP1_NRESET_pio/direction; WAIT_GPIO
+}
+
+reset() {
+ # write output for AP1_NRESET and SX1303 reset
+ echo "1" > /sys/class/gpio/pio$AP1_NRESET_pio/value; WAIT_GPIO
+
+ echo "1" > /sys/class/gpio/pio$SX1302_RESET_pio/value; WAIT_GPIO
+ echo "0" > /sys/class/gpio/pio$SX1302_RESET_pio/value; WAIT_GPIO
+
+ echo "0" > /sys/class/gpio/pio$SX1261_NRESET_pio/value; WAIT_GPIO
+ echo "1" > /sys/class/gpio/pio$SX1261_NRESET_pio/value; WAIT_GPIO
+}
+
+term() {
+ # cleanup all GPIOs
+ if [ -d /sys/class/gpio/pio$SX1302_RESET_pio ]
+ then
+ echo "$SX1302_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
+ fi
+ if [ -d /sys/class/gpio/pio$SX1261_NRESET_pio ]
+ then
+ echo "$SX1261_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
+ fi
+ if [ -d /sys/class/gpio/pio$AP1_NRESET_pio ]
+ then
+ echo "$AP1_NRESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
+ fi
+}
+
+case "$1" in
+ start)
+ term # just in case
+ init
+ reset
+ ;;
+ stop)
+ reset
+ term
+ ;;
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 1
+ ;;
+esac
diff --git a/util/mtac_003_ap2_reset.sh b/util/mtac_003_ap2_reset.sh
new file mode 100644
index 0000000..cd6c13a
--- /dev/null
+++ b/util/mtac_003_ap2_reset.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# This script is intended to be used on MTAC-003V3 platform, it performs
+# the following actions:
+# - export/unpexort pioC23 and pioB13 used to reset the SX1302 chip and setup AP2_NRESET
+# - export/unexport pioC24 used to reset the optional SX1261 radio used for LBT/Spectral Scan
+#
+# Usage examples:
+# ./reset_lgw.sh stop
+# ./reset_lgw.sh start
+
+# GPIO mapping has to be adapted with HW
+#
+
+SX1302_RESET_PIN=87 # SX1302 reset
+AP2_NRESET_PIN=45 # AP2_NRESET
+SX1261_RESET_PIN=88 # SX1261 reset (LBT / Spectral Scan)
+SX1302_RESET_pio=C23 # pio for SX1303 reset
+AP2_NRESET_pio=B13 # pio for AP1_NRESET
+SX1261_NRESET_pio=C24 # pio for SX1261 NRESET
+
+WAIT_GPIO() {
+ sleep 0.1
+}
+
+init() {
+ # setup GPIOs
+ echo "$SX1302_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
+ echo "$SX1261_RESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
+ echo "$AP2_NRESET_PIN" > /sys/class/gpio/export; WAIT_GPIO
+
+ # set GPIOs as output
+ echo "out" > /sys/class/gpio/pio$SX1302_RESET_pio/direction; WAIT_GPIO
+ echo "out" > /sys/class/gpio/pio$SX1261_NRESET_pio/direction; WAIT_GPIO
+ echo "out" > /sys/class/gpio/pio$AP2_NRESET_pio/direction; WAIT_GPIO
+}
+
+reset() {
+ # write output for AP2_NRESET and SX1303 reset
+ echo "1" > /sys/class/gpio/pio$AP2_NRESET_pio/value; WAIT_GPIO
+
+ echo "1" > /sys/class/gpio/pio$SX1302_RESET_pio/value; WAIT_GPIO
+ echo "0" > /sys/class/gpio/pio$SX1302_RESET_pio/value; WAIT_GPIO
+
+ echo "0" > /sys/class/gpio/pio$SX1261_NRESET_pio/value; WAIT_GPIO
+ echo "1" > /sys/class/gpio/pio$SX1261_NRESET_pio/value; WAIT_GPIO
+}
+
+term() {
+ # cleanup all GPIOs
+ if [ -d /sys/class/gpio/pio$SX1302_RESET_pio ]
+ then
+ echo "$SX1302_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
+ fi
+ if [ -d /sys/class/gpio/pio$SX1261_NRESET_pio ]
+ then
+ echo "$SX1261_RESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
+ fi
+ if [ -d /sys/class/gpio/pio$AP2_NRESET_pio ]
+ then
+ echo "$AP2_NRESET_PIN" > /sys/class/gpio/unexport; WAIT_GPIO
+ fi
+}
+
+case "$1" in
+ start)
+ term # just in case
+ init
+ reset
+ ;;
+ stop)
+ reset
+ term
+ ;;
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 1
+ ;;
+esac