From 68fd0715b8a08f261a95713615e08c40bbd3c648 Mon Sep 17 00:00:00 2001 From: mikkeli Date: Fri, 9 Oct 2026 17:03:20 +0900 Subject: [PATCH] SIM7600: power the active GNSS antenna on every modem start An active antenna on the roof received nothing until the modem's antenna supply was switched on (AT+CVAUXV=3050, AT+CVAUXS=1); then +5.5 dB over the passive one. The settings reset on every modem restart and AT&W doesn't keep them, so interface 03 is reserved as /dev/sim7600-at (ModemManager ignores it) and a udev-started oneshot re-applies them. gpsd now re-attaches via gpsdctl after re-enumeration. Verified with a live modem reset: antenna, LTE and the GNSS fix all recovered unattended. Co-Authored-By: Claude Opus 5.5 --- docs/impl/reports/DEVICE-NAMING.md | 1 + docs/impl/reports/SIM7600-SETUP.md | 58 ++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/docs/impl/reports/DEVICE-NAMING.md b/docs/impl/reports/DEVICE-NAMING.md index 485f4ae..0663104 100644 --- a/docs/impl/reports/DEVICE-NAMING.md +++ b/docs/impl/reports/DEVICE-NAMING.md @@ -20,6 +20,7 @@ can point at a different device after a reboot or replug. | Onboard MTTCAN | platform device `c310000.mttcan` | `can_onboard` | | PEAK PCAN-USB | USB `0c72:000c` | `can_pcan` | | SIM7600 NMEA port | USB `1e0e:9001`, interface 01 | `/dev/sim7600-gps` (symlink) | +| SIM7600 spare AT port | USB `1e0e:9001`, interface 03 (ModemManager ignores it) | `/dev/sim7600-at` (symlink) | | SIM7600 modem | ModemManager `simtech` plugin (USB IDs and per-interface port probing) | n/a, nothing configured by port name | | SIM7600 data | NetworkManager `povo` connection with `ifname '*'` | n/a, follows whatever modem ModemManager exposes | diff --git a/docs/impl/reports/SIM7600-SETUP.md b/docs/impl/reports/SIM7600-SETUP.md index 48e3ab2..9ecd7c7 100644 --- a/docs/impl/reports/SIM7600-SETUP.md +++ b/docs/impl/reports/SIM7600-SETUP.md @@ -22,15 +22,18 @@ date: 2026-10-07 ### USB interfaces (PID 9001) -| Iface | Port | Driver | Role (as ModemManager sees it) | -|-------|------|--------|-------------------------------| -| 0 | ttyUSB0 | option | diagnostics (ignored) | -| 1 | ttyUSB1 | option | **NMEA GPS** → `/dev/sim7600-gps` | -| 2 | ttyUSB2 | option | AT (primary) | -| 3 | ttyUSB3 | option | AT | +| Iface | Port (typical) | Driver | Role | +|-------|------|--------|------| +| 0 | ttyUSB0 | option | diagnostics (ignored by ModemManager) | +| 1 | ttyUSB1 | option | **NMEA GPS** → `/dev/sim7600-gps` (gpsd) | +| 2 | ttyUSB2 | option | AT, used by ModemManager | +| 3 | ttyUSB3 | option | AT, **reserved for us** → `/dev/sim7600-at`, ModemManager told to ignore it | | 4 | ttyUSB4 | option | audio | | 5 | `cdc-wdm0` + `wwan0` | **qmi_wwan** (self-built) | QMI control + network | +⚠ The `ttyUSB` numbers are **not** stable: after a modem reset they shifted (e.g. NMEA on ttyUSB2, AT on ttyUSB3/4) because the old +nodes were still held open. Use the `/dev/sim7600-*` symlinks or `/dev/serial/by-id/*-ifNN-port0`, never a bare `ttyUSBn`. + ## Problems hit and fixes ### 1. `sim-missing`: SIM inserted after the modem powered up @@ -130,9 +133,12 @@ brief NM connectivity-check penalty (`+20000`) after WiFi returns. - GNSS engine was already running (`AT+CGPS?` → `1,1`). Set to start on boot: `AT+CGPSAUTO=1` (persists in modem). - ModemManager location is **not** used. gpsd owns the NMEA port; ModemManager only labels it `(gps)` and leaves it unopened. -- Stable device name, `/etc/udev/rules.d/99-sim7600-gps.rules`: +- Stable device names, `/etc/udev/rules.d/99-sim7600-gps.rules`: ``` - SUBSYSTEM=="tty", ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="sim7600-gps" + # if01: NMEA. Re-attach gpsd on every appearance (USBAUTO is off, so gpsd would otherwise lose it after a modem reset). + SUBSYSTEM=="tty", ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="sim7600-gps", RUN+="/usr/sbin/gpsdctl add /dev/sim7600-gps" + # if03: spare AT port, reserved for us (ModemManager keeps if02). Powers the active GNSS antenna on every modem start. + SUBSYSTEM=="tty", ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9001", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="sim7600-at", ENV{ID_MM_PORT_IGNORE}="1", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sim7600-gnss-antenna.service" ``` - `apt install gpsd gpsd-clients`, `/etc/default/gpsd`: ``` @@ -146,7 +152,36 @@ Check: `cgps` or `gpspipe -w -n 10`. On 2026-10-07, tested indoors, gpsd saw `nS Next: test with the GNSS antenna (IPEX, labeled GNSS on the HAT) with a clear view of the sky. A cold start can take a few minutes. **2026-10-09, in the car:** first fix, `mode: 3` (3D) with 4 of 9 satellites used, GPS time valid. Passive GNSS antenna on the dashboard, facing the sky. No setup changes were needed; -the indoor tests simply lacked sky view. If fixes prove slow or drop out while driving, try an active antenna (check the HAT supplies antenna bias first). +the indoor tests simply lacked sky view. + +#### Active antenna (2026-10-09) + +Swapped to an active GNSS antenna (spec 2.7–5.0 V) on the car roof. At first it **received nothing** (8 of 9 satellites at 0 dB-Hz): +the modem's antenna supply was off. `AT+CVAUXS?` → `0`, `AT+CVAUXV?` → `1700` (mV, below the antenna's minimum). + +``` +AT+CVAUXV=3050 # modem range 1700–3050 mV; 3.05 V is inside the antenna's 2.7–5.0 V +AT+CVAUXS=1 # switch the supply on → fix back within 1 s +``` + +| | Passive, dashboard | Active, roof (powered) | +|---|---|---| +| Satellites used | 6.3 avg (max 7) | 6.5 avg (max 7) | +| Signal of used satellites | 31.3 dB-Hz | **36.8 dB-Hz** (peaks 43–47) | + +Satellites used barely change; that count looks limited by which constellations are enabled (GPS and GLONASS in use; BeiDou visible in +NMEA; QZSS/Galileo not checked yet). The gain is ~5.5 dB of margin, which is what matters under trees and between buildings. + +**Both settings are volatile.** They reset to off/1.7 V on every modem restart (`AT+CRESET` tested), and `AT&W` does not save them. So: + +- `/usr/local/sbin/sim7600-gnss-antenna` sends them over `/dev/sim7600-at` (retrying while the modem boots) and verifies them; +- `sim7600-gnss-antenna.service` (oneshot, `BindsTo=dev-sim7600\x2dat.device`) runs it, started by the udev rule above whenever + interface 03 appears: boot, hot-plug, modem reset. + +Verified with `mmcli -m any --reset` while everything was running: the antenna supply was re-applied as soon as the ports returned, +LTE reconnected ~50 s after the reset, and gpsd re-attached via `gpsdctl` with a 3D fix. + +With a **passive** antenna the supply does no harm, but it can be turned off by disabling the service. ## Rebuilding qmi_wwan after a kernel update @@ -163,6 +198,7 @@ sudo modprobe qmi_wwan && sudo systemctl restart ModemManager ## Useful one-offs -- Talk to the modem directly: `sudo systemctl stop ModemManager`, then use a terminal on `/dev/ttyUSB2`; start ModemManager again afterwards. - (ModemManager holds ttyUSB2/3 while running.) +- Talk to the modem directly: use **`/dev/sim7600-at`**. ModemManager ignores it, so there's no need to stop anything + (e.g. `picocom -b 115200 /dev/sim7600-at`, or `minicom -D /dev/sim7600-at`). Don't send commands that change the data + connection behind ModemManager's back. - Verbose ModemManager log incl. AT traffic: `sudo mmcli -G debug` then `journalctl -u ModemManager -f` (resets on restart).