12-OBD-Speed: read-only UDS DID scan of the car's modules
- Log page now runs a diagnostic scan instead of CAN listening (the Fiesta's OBD port carries no broadcast traffic): unfiltered check, module discovery 0x700-0x7EF (22F188, then 3E00 with 1 s timeout), all 65536 DIDs per module, progress in NVS, speed/voltage polled every 2 s in between - Result (drives 2026-11-12..18): only the PCM 0x7E0 answers; 389 DIDs supported (logs in docs/canlog/scan, scan2) - Reset scan button, BLE connection interval request, progress lines - CLAUDE.md: screen-has-priority rule, web UI future idea, findings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
60cd7cf262
commit
c9ad39c8ed
27 files changed
+15622
-380
No files matched your search
+35
-19
@@ -16,9 +16,9 @@ Uses the shared board library and LVGL 9.6 (`../shared`), NimBLE-Arduino 2.5.1.
|
||||
dimensions shown; not 360×360 in orange). Tap one: it is copied into the device's flash (progress shown) and
|
||||
played from there, so the SD card is not needed afterwards. At boot the device checks (in the background)
|
||||
whether the chosen file on the SD card changed (size/date) and re-copies it. **Rescan** re-reads the card.
|
||||
- **Swipe left once more → CAN log** (temporary, to find the cruise/ACC set speed and speed-sign messages, see below).
|
||||
**Start/Stop** (remembered: logging resumes by itself after power-up), **Mark**, the last frame of the three Ford
|
||||
candidate IDs, and the file on the SD card. While logging, the speed page shows a red `REC <marks>` pill and
|
||||
- **Swipe left once more → CAN log** (temporary: diagnostic scan to find the cruise/ACC set speed and speed limit, see below).
|
||||
**Start/Stop** (remembered: logging resumes by itself after power-up), **Mark**, scan progress, **Reset scan**,
|
||||
and the file on the SD card. While logging, the speed page shows a red `REC <marks>` pill and
|
||||
**a tap on the speed page adds a mark** (pill flashes `MARK n`).
|
||||
- **Idle** — after that time without speed data (ignition off, adapter gone) the screen goes dark, the GIF pauses and
|
||||
OBD polling stops; only `ATRV` every 30 s (answered by the adapter itself, doesn't wake the car's bus).
|
||||
@@ -33,34 +33,50 @@ Service `FFF0`, notifications + commands on `FFF1` (verified with the user's "OB
|
||||
Init: `ATZ`, `ATE0`, `ATL0`, `ATS0`, `ATH0`, `ATSP0`, `0100`; then `010D` (speed) is polled continuously.
|
||||
Serial (115200) prints status changes as `[obd] ...`.
|
||||
|
||||
## CAN logger (finding ACC set speed / speed sign)
|
||||
Neither value is a standard OBD PID; on Fords they are broadcast CAN messages. Candidates from opendbc
|
||||
(`ford_lincoln_base_pt.dbc`, made for newer Fords; **not yet confirmed on the Fiesta Mk8**):
|
||||
`0x165` EngBrakeData `Veh_V_DsplyCcSet` (set speed as shown) + `CcStat_D_Actl`, `0x202` `Veh_V_RqCcSet` (0.5 km/h),
|
||||
`0x3D9` IPMA_Data2 `IsaVLim_D_Rq` (speed limit, 254 = no data) + `IsaVLimUnit_D_Rq` (1 km/h, 2 mph).
|
||||
## Log page: diagnostic scan (finding ACC set speed / speed sign)
|
||||
Neither value is a standard OBD PID. **First test drive (2026-11-02, `docs/canlog`)**: listening on the OBD port
|
||||
(ELM327 `ATMA`, ID survey with wildcard filters) saw **no broadcast frames at all**, only diagnostic replies: the
|
||||
Fiesta Mk8's gateway passes only diagnostics to the OBD socket. (Broadcast candidates from opendbc for newer Fords,
|
||||
for reference: `0x165` `Veh_V_DsplyCcSet`, `0x202` `Veh_V_RqCcSet`, `0x3D9` `IsaVLim_D_Rq`; the Mk7.5 Fiesta sheet in
|
||||
github.com/consp/ford-can-stuff lists `0x3CD` "Traffic Recognition Data" on the infotainment bus.)
|
||||
|
||||
While logging, the OBD task (after `ATCSM1` silent monitoring, `ATH1`, `ATCAF0`):
|
||||
1. **Survey**: listens to the ID ranges `0XX`..`7XX` (`ATCRA` with wildcards + `ATMA`, 1.3 s each); a range that
|
||||
overflows the adapter (`BUFFER FULL` / 300 lines) is split into 16 smaller ones. Repeated every 10 min.
|
||||
2. **Capture**: one frame of every ID found, in turn; the three candidates after every 8 others.
|
||||
3. Every 2 s `ATAR` + `ATCAF1` + `010D` (speed, so the display keeps working, a bit laggy) and `ATRV`.
|
||||
If the adapter can't filter by wildcard it falls back to unfiltered 2 s windows.
|
||||
So the values have to be asked from the modules. While logging is on, the OBD task runs a **read-only scan**
|
||||
(only UDS `22` ReadDataByIdentifier in the default session; nothing in the car is changed), progress kept in NVS
|
||||
(namespace `scan`) so it continues on every drive:
|
||||
1. **Unfiltered listen check** (once): 2 × 5 s `ATMA` without filter, CAF off and on.
|
||||
2. **Module discovery**: `22F188` (software number) to every address 0x700..0x7EF (`ATSH` + `ATCRA` addr+8,
|
||||
`ATST19` = 100 ms timeout). Logged as `D <addr> <reply>`, list as `I`. Repeated if the PCM (0x7E0) didn't answer.
|
||||
3. **DID scan**: all 65536 DIDs of each module, order 0x706 (IPMA camera), 0x764 (CCM radar), 0x720 (IPC), 0x7E0 (PCM),
|
||||
then the other modules found; per module the DID ranges D000-DFFF, 4000-4FFF, 0000-3FFF, 5000-CFFF, E000-FFFF.
|
||||
Positive replies `S <addr> <did> <data>`, other negative responses than 0x31 `R <addr> <did> <nrc>`. A module
|
||||
without service 22 (NRC 0x11) is skipped; 20 requests without a reply = module asleep: back up and wait.
|
||||
The `<request>1` suffix (return after the first reply) is used when the adapter supports it.
|
||||
**Probe** (once, after drive 2 found only the PCM): `3E00` TesterPresent with a 1 s timeout to every address not
|
||||
found yet. DIDs are asked **3 per request** (`22 D000 D001 D002`, one CAN frame; the module returns only the
|
||||
supported ones) when the module passes the test `22F1FFF188F1FE`; a hit is re-asked one DID at a time.
|
||||
`E progress` every 512 DIDs (with ms/DID).
|
||||
4. Every 2 s `ATSH 7DF` / `ATAR` + `010D` (speed, so the display keeps working, a bit laggy) and `ATRV`.
|
||||
|
||||
Page: Start/Stop (remembered), Mark, progress (module, DID, %), modules found, DIDs found, last positive reply,
|
||||
**Reset scan** (starts over the next time logging runs). While logging the speed page shows `REC <marks>`; a tap on
|
||||
it adds a mark.
|
||||
|
||||
Log: `/canlog/log_NNN.txt` (new file per session, appended every 2 s; kept in RAM while the card is missing).
|
||||
Lines `<ms> <type> <data>`: `C` adapter, `P` protocol, `V` speed, `B` voltage, `M` mark, `F id data` frame,
|
||||
`N id` no frame, `I` survey IDs, `E` adapter message/note. Test drive: change the set speed and pass signs, tap
|
||||
for a mark each time (passenger, or only when safe).
|
||||
Lines `<ms> <type> <data>`: `C` adapter, `P` protocol, `V` speed, `B` voltage, `M` mark, `D`/`I` modules,
|
||||
`S`/`R` DID replies, `F` raw frame, `E` adapter message/note.
|
||||
**Download over USB** (no card reader needed): serial commands `ls` and `get <file>` (115200 baud).
|
||||
|
||||
## Files
|
||||
| File | What |
|
||||
|---|---|
|
||||
| `src/main.cpp` | LVGL UI (tileview: speed, adapter menu, settings, background, CAN log) |
|
||||
| `src/obd_link.cpp/.h` | BLE scan, connect/reconnect, ELM327 init and speed polling, CAN logging steps (background task on core 0) |
|
||||
| `src/obd_link.cpp/.h` | BLE scan, connect/reconnect, ELM327 init and speed polling, diagnostic scan steps (background task on core 0) |
|
||||
| `src/font_speed_120.c` | Montserrat Medium 120 px, digits and `-`, 4 bpp (generated with `lv_font_conv`, see header) |
|
||||
| `src/can_log.cpp/.h` | CAN log buffer + SD writer (background task), marks, values shown on the log page |
|
||||
| `src/can_log.cpp/.h` | Log buffer + SD writer (background task), marks, info shown on the log page, serial `ls`/`get` |
|
||||
| `src/sd_card.cpp/.h` | Shared, reference-counted SD_MMC mount (background store + logger) |
|
||||
| `src/bg_store.cpp/.h` | Background GIF from the SD card: list `/gifs`, copy into the `bggif` flash partition (header written last), mmap for playback, change check at boot (background task) |
|
||||
| `partitions.csv` | 4 MB app (no OTA) + 11.9 MB `bggif` raw area + NVS |
|
||||
| `docs/canlog/` | Logs of the test drives |
|
||||
| `data/bg.gif` | Built-in background (`ezgif-5-cb56986bc7.gif`, 360×360), linked into the firmware via `board_build.embed_files` |
|
||||
| `sd/gifs/` | (not in git) GIFs converted with `../tools/gif_to_360.py`, ready to copy to the SD card |
|
||||
|
||||
|
||||
Reference in new issue
Block a user