Update the diagrams, READMEs and spec for the two receive paths
Add data-flow diagrams of both paths (V2X_RX and RAW_FRAME with the app's Receive path switch) to the app README, the firmware README and docs/06, and bring the draw.io architecture labels up to station-link revision 2. The spec (revision 2) gains "V2X_RX and RAW_FRAME: both stay" and "Fragmentation on the host side". Document the corpus generator in test/host.
This commit is contained in:
@@ -39,6 +39,7 @@ link:
|
||||
max_message: 512 octets, fragmented above that by the spec
|
||||
microbu_extensions:
|
||||
V2X_RX: opcode 0x90, every ITS message heard on air, verified or not
|
||||
receive_paths: V2X_RX and the spec's RAW_FRAME both stay; the app chooses (Settings > Receive path), RAW_CAPTURE mode 3 turns raw on
|
||||
unsigned_tx: security profile 1, or 0 with station security 0
|
||||
radio: polled from STATION_CONFIGURE on
|
||||
battery_guard: deep sleep below 3.30 V, no phone on USB, runs again from 3.60 V
|
||||
@@ -89,6 +90,26 @@ It prints the log, the 131-octet STATUS once a second (uptime, signing and radio
|
||||
battery) and the first V2X_RX messages. Status exchange: the host sends `STATUS_REQUEST` every
|
||||
1000 ms; `CONFIRM.detail` contains the snapshot.
|
||||
|
||||
Received messages reach the phone on two paths that both stay in the firmware: `V2X_RX` (ours, always on, already unwrapped, up to 494 octets) and `RAW_FRAME` (the spec's debug capture, on after `RAW_CAPTURE`, the whole radio frame, fragmented when large). The Android app has a switch for which one it consumes; the board always sends `V2X_RX`. See [NOTES.md](NOTES.md).
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
Air[ITS-G5 frame on air] --> Radio[C5 radio, promiscuous RX]
|
||||
Radio --> Stack[Vanetza stack: decap and verify]
|
||||
Radio --> Unwrap[gn_unwrap.c: 802.11, LLC, GN, BTP, signature envelope]
|
||||
Radio -->|only while RAW_CAPTURE is on| Cap[Raw capture tap: ITS5 record]
|
||||
Stack -->|verified only| Ind[BTP_DATA_INDICATION 0x81]
|
||||
Unwrap -->|always, signed or not, up to 494 octets| Rx[V2X_RX 0x90, MicrOBU]
|
||||
Cap -->|fragmented if large| Raw[RAW_FRAME 0x85, spec]
|
||||
Ind --> Link[Station link: USB or BLE]
|
||||
Rx --> Link
|
||||
Raw --> Link
|
||||
Link --> App[Android app]
|
||||
App -->|Receive path: V2X_RX| UseA[uses V2X_RX, ignores RAW_FRAME]
|
||||
App -->|Receive path: Raw frames| UseB[reassembles, unwraps with GnUnwrap, ignores V2X_RX]
|
||||
```
|
||||
|
||||
|
||||
## BLE pairing
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -1174,6 +1174,15 @@ Delivers every ITS message heard on air, verified or not. The station stack deca
|
||||
{\ttfamily 12} & {\ttfamily area\_\allowbreak{}distance\_\allowbreak{}a} & {\ttfamily u16} & m & Radius or first dimension of the destination area; 0 when bit 0 is clear. \\
|
||||
{\ttfamily 14} & {\ttfamily its\_\allowbreak{}payload} & {\ttfamily remaining bytes} & \textemdash & The ITS message (CAM, DENM, MAPEM, SPATEM, VAM) in its UPER encoding. \\
|
||||
\end{longtable}}
|
||||
\Needspace{8\baselineskip}\subsection{\texttt{V\_\allowbreak{}2X\_\allowbreak{}RX} and \texttt{RAW\_\allowbreak{}FRAME}: both stay}\label{sec:microbu-rxpaths}
|
||||
Revision 2 does not replace the debug capture of revision 1 with \texttt{V\_2X\_RX}: the station keeps both, and the host chooses.
|
||||
\begin{itemize}
|
||||
\item \texttt{V\_2X\_RX} is sent for every ITS message heard, always, once the radio runs (it needs no \texttt{RAW\_CAPTURE}). The station has already unwrapped the frame, so a host decodes the payload at once; the message is at most 494 octets and is never fragmented.
|
||||
\item \texttt{RAW\_FRAME} (revision 1) is sent only while \texttt{RAW\_CAPTURE} is on, as a copy of the whole 802.11 frame, fragmented when it exceeds one link message. A host that uses it unwraps the frame itself, is not limited to 494 octets, and accepts that copies may be dropped when the transport is busy.
|
||||
\end{itemize}
|
||||
The station does not know which path the host uses and sends \texttt{V\_2X\_RX} regardless. The MicrOBU Android app offers both as a setting (Receive path). In raw mode it sends \texttt{RAW\_CAPTURE} with mode 0x03 (capture on, broadcast frames only), reassembles fragments as described in Section~\ref{sec:fragmentation-host}, unwraps each frame with the same rules as the station does for \texttt{V\_2X\_RX} (single-hop broadcast and GeoBroadcast, BTP-B ports 2001--2004 and 2018, a signature envelope unwrapped without verification) and ignores the \texttt{V\_2X\_RX} messages. In \texttt{V\_2X\_RX} mode it sends mode 0 and ignores \texttt{RAW\_FRAME}.
|
||||
\Needspace{8\baselineskip}\subsection{Fragmentation on the host side}\label{sec:fragmentation-host}
|
||||
The MicrOBU host reassembles fragmented station-to-host messages as the fragmentation section of revision 1 states: fragments of one message share opcode and sequence, flags 1, 2 and 3 mark first, middle and last, each fragment body starts with total length and offset, a gap, a duplicate, a wrong order or a changed total drops the stream, an unfinished stream is discarded after 2000 ms, at most 8 streams are held, and a complete body is at most 65535 octets. A message that fits one link message (flags 0) passes through unchanged.
|
||||
\Needspace{8\baselineskip}\subsection{Unsecured transmission}\label{sec:microbu-unsecured}
|
||||
A BTP\_DATA\_REQUEST with \texttt{gn\_security\_profile} 0x01, or 0x00 while the station is configured with \texttt{security} 0, is transmitted without a signature instead of being refused. The station builds the GeoNetworking header itself from the last POTI\_UPDATE, so the same preconditions apply as for a signed request.
|
||||
{\small\begin{longtable}{@{}P{45mm}P{55mm}P{72.8mm}@{}}
|
||||
@@ -1225,6 +1234,6 @@ MicrOBU extension. While no USB host is connected to the native port (the phone
|
||||
\toprule\textbf{Revision} & \textbf{Date} & \textbf{Changes} \\\midrule\endhead
|
||||
\bottomrule\endfoot
|
||||
1 & 2026-11 & Niklas Dathe: the microbu-firmware interface reference, commit e4e4bd8. \\
|
||||
2 & 2026-11-10 & MicrOBU additions: opcode 0x90 V2X\_RX (all heard ITS messages, unverified); unsecured transmission for security profile 0x01 and for profile 0x00 with \texttt{security} 0, from a random MAC per configuration, or the MAC named by the host in the 16-octet STATION\_CONFIGURE; the radio is polled from STATION\_CONFIGURE on; battery protection by deep sleep; no USB writes without a host. Wire format of revision 1 unchanged; the original is kept as microbu-firmware/docs/station-link.pdf. \\
|
||||
2 & 2026-11-10 & MicrOBU additions: opcode 0x90 V2X\_RX (all heard ITS messages, unverified); unsecured transmission for security profile 0x01 and for profile 0x00 with \texttt{security} 0, from a random MAC per configuration, or the MAC named by the host in the 16-octet STATION\_CONFIGURE; V\_2X\_RX and RAW\_FRAME both kept, the host choosing (Section~\ref{sec:microbu-rxpaths}); the radio is polled from STATION\_CONFIGURE on; battery protection by deep sleep; no USB writes without a host. Wire format of revision 1 unchanged; the original is kept as microbu-firmware/docs/station-link.pdf. \\
|
||||
\end{longtable}}
|
||||
\end{document}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
results under "Running". Toolchain: MSYS2 UCRT64 gcc, Option B below (chosen and
|
||||
installed 2026-09-11).
|
||||
|
||||
**Corpus for the app (`make corpus`, `dump_corpus.c`):** runs the firmware's `gn_unwrap_its` on frames from the recorded captures, copies of them cut at several lengths and copies with flipped bytes, and writes the verdict and fields of each to `app/src/test/resources/gn_unwrap_corpus.tsv`. The app's `GnUnwrapTest` requires its Kotlin port of `gn_unwrap.c` (used for the raw frame receive path) to match every line.
|
||||
|
||||
**Firmware unit tests (`make firmware`, `test_firmware.cpp`, 40 tests):** the station-link codec byte-exact against
|
||||
the app's `StationLinkTest` hex, the 131-octet STATUS offsets, request reassembly, the V2X_RX extension
|
||||
(`main/v2x_rx.hpp`; the 494-octet limit, the 14-octet prefix, TX code -> air frame -> RX path), radio operating
|
||||
|
||||
Reference in New Issue
Block a user