From f812c62a3d374cfc13761992a3ed9e07be1509c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Martin?= Date: Sun, 4 Oct 2026 22:05:01 +0200 Subject: [PATCH] M2 step 1: gnss probe finds the receiver on RX 15 / TX 13 at 115200 A temporary `gnss probe` command listens on both pin orders at 115200 and 9600. Only RX 15 / TX 13 at 115200 carries NMEA, as Meshtastic's board file says; M5Stack's GPIO 8/9 are the keyboard's I2C bus. The output format (NMEA 4.10, GSA system IDs, GSV per signal) is recorded in docs/milestones/M2.md. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT --- docs/milestones/M2.md | 2 +- src/main.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/milestones/M2.md b/docs/milestones/M2.md index 6a07a08..0cbbbc1 100644 --- a/docs/milestones/M2.md +++ b/docs/milestones/M2.md @@ -2,7 +2,7 @@ **Goal:** the device knows where it is and what time it is without a network: a GNSS Service in the background, a GNSS App with the position and a sky view of the satellites, the clock set from satellites when there's no NTP, and Tracks recorded to the SD card. -**Hardware:** the Cap LoRa-1262 carries an ATGM336H-6N (AT6668), multi-constellation (GPS, BeiDou, Galileo, GLONASS, QZSS), with a ceramic antenna. NMEA over UART, 115200 8N1. Meshtastic's board file for this hardware uses GPIO 15 (ESP32 RX) and 13 (TX); M5Stack's page names GPIO 8 and 9, which the keyboard controller already uses. Step 1 checks on the device. +**Hardware:** the Cap LoRa-1262 carries an ATGM336H-6N (AT6668), multi-constellation (GPS, BeiDou, Galileo, GLONASS, QZSS), with a ceramic antenna. NMEA over UART, 115200 8N1. **Measured (step 1, `gnss probe`): RX GPIO 15, TX GPIO 13, 115200 8N1**, as in Meshtastic's board file; M5Stack's page names GPIO 8 and 9, which are the internal I2C bus the keyboard controller sits on. Output is NMEA 4.10 style: `GN` RMC, VTG and GGA, one GSA per constellation with the system ID (1 GPS, 2 GLONASS, 3 Galileo, 4 BeiDou, 5 QZSS) in its last field, and a GSV sequence per constellation and signal (`GP`, `GL`, `GA`, …) with the signal ID last. RMC carries a time even without a Fix (status `V`), so only a Fix makes it trustworthy. ## Decisions (design round 2026-10-04) diff --git a/src/main.cpp b/src/main.cpp index cd7b2d2..2fa7fb4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,8 @@ #include #include +#include + #include #include @@ -384,6 +386,33 @@ static void runCommand(String line) { }); } if (line.startsWith("install ")) update->installFromSd(line.substring(8).c_str()); // Update from SD + if (line == "gnss probe") { // M2 step 1: which pins and baud rate carry NMEA (temporary) + struct Try { int rx, tx; uint32_t baud; } tries[] = {{15, 13, 115200}, {13, 15, 115200}, {15, 13, 9600}, {13, 15, 9600}}; + for (auto& t : tries) { + Serial1.begin(t.baud, SERIAL_8N1, t.rx, t.tx); + uint32_t start = millis(), bytes = 0, lines = 0; + std::string current, sample; + while (millis() - start < 1200) { + esp_task_wdt_reset(); // four listens outlast the 5 s loop watchdog + while (Serial1.available()) { + char c = Serial1.read(); + bytes++; + if (c == '\n') { + if (current.size() > 6 && current[0] == '$') { + lines++; + if (sample.size() < 400) sample += " " + current + "\n"; + } + current.clear(); + } else if (c != '\r' && current.size() < 120) current += c; + } + delay(5); + } + Serial1.end(); + console.printf("gnss probe: rx %d tx %d at %lu: %lu bytes, %lu NMEA lines\n", t.rx, t.tx, + (unsigned long)t.baud, (unsigned long)bytes, (unsigned long)lines); + if (lines) console.print(sample.c_str()); + } + } if (line == "crash") crash_report::print(console, nvs); if (line == "coredump erase") console.println(crash_report::erase() ? "coredump: erased" : "coredump: nothing to erase"); #ifdef RORO_DEBUG