firmware: SX1262 GFSK wM-Bus C1 repeater, dev tooling, discovery scripts
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deterministic discovery of DUT (Heltec V4.3) and SDR (Nooelec NESDR SMArt v5).
|
||||
# Prints selected devices; exits nonzero on ambiguity or absence.
|
||||
#
|
||||
# Output (eval-able):
|
||||
# DUT_PORT=/dev/serial/by-id/...
|
||||
# SDR_INDEX=0
|
||||
# SDR_SERIAL=33999948
|
||||
set -euo pipefail
|
||||
|
||||
fail() { echo "DISCOVER_ERROR: $*" >&2; exit 1; }
|
||||
|
||||
# --- DUT: Heltec WiFi LoRa 32 V4 (ESP32-S3 native USB CDC) ---
|
||||
shopt -s nullglob
|
||||
dut_candidates=(/dev/serial/by-id/*heltec_wifi_lora_32_v4*)
|
||||
if [ ${#dut_candidates[@]} -eq 0 ]; then
|
||||
# fall back to any Espressif device, but require uniqueness
|
||||
dut_candidates=(/dev/serial/by-id/usb-Espressif*)
|
||||
fi
|
||||
[ ${#dut_candidates[@]} -eq 0 ] && fail "no Heltec/Espressif serial device found in /dev/serial/by-id/"
|
||||
[ ${#dut_candidates[@]} -gt 1 ] && fail "ambiguous DUT: ${dut_candidates[*]}"
|
||||
DUT_PORT="${dut_candidates[0]}"
|
||||
[ -e "$DUT_PORT" ] || fail "DUT path vanished: $DUT_PORT"
|
||||
|
||||
# --- SDR: Nooelec NESDR SMArt v5 (RTL2832U) ---
|
||||
# rtl_test -t enumerates devices without streaming.
|
||||
sdr_list=$(timeout 10 rtl_test -t 2>&1 | grep -E '^\s+[0-9]+:' || true)
|
||||
[ -z "$sdr_list" ] && fail "no RTL-SDR device found (rtl_test)"
|
||||
sdr_matches=$(echo "$sdr_list" | grep -i "Nooelec" || true)
|
||||
[ -z "$sdr_matches" ] && fail "RTL-SDR present but not a Nooelec: $sdr_list"
|
||||
[ "$(echo "$sdr_matches" | wc -l)" -gt 1 ] && fail "ambiguous SDR: $sdr_matches"
|
||||
SDR_INDEX=$(echo "$sdr_matches" | sed -E 's/^\s*([0-9]+):.*/\1/')
|
||||
SDR_SERIAL=$(echo "$sdr_matches" | sed -E 's/.*SN: ([^ ]+).*/\1/')
|
||||
|
||||
echo "DUT_PORT=$DUT_PORT"
|
||||
echo "SDR_INDEX=$SDR_INDEX"
|
||||
echo "SDR_SERIAL=$SDR_SERIAL"
|
||||
|
||||
if [ "${1:-}" = "-v" ]; then
|
||||
echo "---" >&2
|
||||
echo "DUT: $DUT_PORT -> $(readlink -f "$DUT_PORT")" >&2
|
||||
echo "SDR: index $SDR_INDEX, serial $SDR_SERIAL" >&2
|
||||
echo "$sdr_matches" >&2
|
||||
fi
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build + flash the firmware to the discovered DUT. Refuses ambiguous devices.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
eval "$(./tools/discover_devices.sh)"
|
||||
echo "Flashing DUT: $DUT_PORT" >&2
|
||||
|
||||
cd firmware
|
||||
idf.py build
|
||||
idf.py -p "$DUT_PORT" flash
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Hard-reset the DUT via esptool (RTS/DTR toggle), leaving flash intact.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
eval "$(./tools/discover_devices.sh)"
|
||||
esptool.py --port "$DUT_PORT" --before default_reset --after hard_reset chip_id >/dev/null 2>&1 || true
|
||||
echo "DUT reset: $DUT_PORT"
|
||||
Reference in New Issue
Block a user