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:
@@ -165,6 +165,19 @@ vanetza-idf verifies strictly and would drop anything unsigned or signed under a
|
|||||||
| Size | up to 494 octets | not limited: fragments are reassembled (`LinkReassembly`, as the spec defines) |
|
| Size | up to 494 octets | not limited: fragments are reassembled (`LinkReassembly`, as the spec defines) |
|
||||||
| Reliability | normal indication | debug copy: can be dropped when the link is busy, more bandwidth, especially over BLE |
|
| Reliability | normal indication | debug copy: can be dropped when the link is busy, more bandwidth, especially over BLE |
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
Air[ITS-G5 frame] --> Board[ESP32-C5: radio, gn_unwrap.c, raw capture tap]
|
||||||
|
Board -->|V2X_RX 0x90, always| Link[USB or BLE]
|
||||||
|
Board -->|RAW_FRAME 0x85, after RAW_CAPTURE| Link
|
||||||
|
Link --> Re[LinkReassembly]
|
||||||
|
Re --> Sel{Receive path setting}
|
||||||
|
Sel -->|V2X_RX, default| Dec[V2xRxFrame]
|
||||||
|
Sel -->|Raw frames| Raw[RawFrame + GnUnwrap]
|
||||||
|
Raw --> Dec
|
||||||
|
Dec --> Rest[Codecs, use cases, V2X screens, logger]
|
||||||
|
```
|
||||||
|
|
||||||
The board always sends `V2X_RX`; the app consumes one path and ignores the other. Changing the setting takes effect at once on a configured station (`RAW_CAPTURE` mode 3 = on and broadcast frames only, mode 0 = off). `GnUnwrapTest` checks the Kotlin unwrapper against `obu-firmware/test/host/dump_corpus.c`'s output for 602 recorded, cut and corrupted frames.
|
The board always sends `V2X_RX`; the app consumes one path and ignores the other. Changing the setting takes effect at once on a configured station (`RAW_CAPTURE` mode 3 = on and broadcast frames only, mode 0 = off). `GnUnwrapTest` checks the Kotlin unwrapper against `obu-firmware/test/host/dump_corpus.c`'s output for 602 recorded, cut and corrupted frames.
|
||||||
|
|
||||||
## Verification
|
## Verification
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ the parts below that describe the earlier vanetza-idf port say so. Hardware chec
|
|||||||
- **Two links, one protocol.** USB-C (native USB Serial/JTAG) or Bluetooth LE, chosen in Settings.
|
- **Two links, one protocol.** USB-C (native USB Serial/JTAG) or Bluetooth LE, chosen in Settings.
|
||||||
Both carry Niklas Dathe's station-link protocol (revision 2 of the spec adds the MicrOBU extensions: `V2X_RX`, unsigned sending, battery guard).
|
Both carry Niklas Dathe's station-link protocol (revision 2 of the spec adds the MicrOBU extensions: `V2X_RX`, unsigned sending, battery guard).
|
||||||
- **Reception is unchanged for the app.** Every ITS message heard on air reaches the phone, signed
|
- **Reception is unchanged for the app.** Every ITS message heard on air reaches the phone, signed
|
||||||
or not, verifiable or not, exactly as with the previous firmware.
|
or not, verifiable or not, exactly as with the previous firmware. Since 2026-11-11 the app can instead take the spec's
|
||||||
|
`RAW_FRAME` debug capture and unwrap it itself (Settings > Receive path); both paths stay in the firmware.
|
||||||
- **Demo PKI, not the EU trust list.** Signed messages carry a throwaway chain. Receivers that
|
- **Demo PKI, not the EU trust list.** Signed messages carry a throwaway chain. Receivers that
|
||||||
verify against the EU trust list drop them; unsigned sending remains available.
|
verify against the EU trust list drop them; unsigned sending remains available.
|
||||||
|
|
||||||
@@ -96,6 +97,31 @@ spec retires but the station still decodes, and revision 2 documents): a ride ro
|
|||||||
pinger keeps one fixed MAC, and a new MAC reconfigures the station. Without one a signed station takes its address from the
|
pinger keeps one fixed MAC, and a new MAC reconfigures the station. Without one a signed station takes its address from the
|
||||||
ticket and an unsigned one draws a random MAC per configuration. With one, signed and unsigned frames both leave from it.
|
ticket and an unsigned one draws a random MAC per configuration. With one, signed and unsigned frames both leave from it.
|
||||||
|
|
||||||
|
Data flow of a received frame, with both paths:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TB
|
||||||
|
subgraph Board[ESP32-C5 board]
|
||||||
|
Air[ITS-G5 frame] --> Radio[Radio, promiscuous RX]
|
||||||
|
Radio --> Stack[Vanetza: decap, verify]
|
||||||
|
Radio --> Unwrap[gn_unwrap.c]
|
||||||
|
Radio -->|RAW_CAPTURE on| Tap[Raw capture tap]
|
||||||
|
Stack -->|verified| Ind[BTP_DATA_INDICATION]
|
||||||
|
Unwrap --> Rx[V2X_RX 0x90]
|
||||||
|
Tap --> RawF[RAW_FRAME 0x85, fragmented]
|
||||||
|
end
|
||||||
|
Ind & Rx & RawF --> Link[USB or BLE link]
|
||||||
|
subgraph Phone[Android app]
|
||||||
|
Link --> Re[LinkReassembly]
|
||||||
|
Re --> Sel{Receive path}
|
||||||
|
Sel -->|V2X_RX| Dec[V2xRxFrame]
|
||||||
|
Sel -->|Raw frames| Pr[RawFrame, then GnUnwrap]
|
||||||
|
Pr --> Dec
|
||||||
|
Dec --> Cod[CAM, DENM, SPATEM, MAPEM, VAM codecs]
|
||||||
|
Cod --> UI[Use cases, V2X screens, logger]
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
The app also **reassembles fragmented link messages** (flags 1-3 of the spec) and has two receive paths: `V2X_RX`
|
The app also **reassembles fragmented link messages** (flags 1-3 of the spec) and has two receive paths: `V2X_RX`
|
||||||
(default) and `RAW_FRAME`, which it unwraps itself with `GnUnwrap.kt`; see the README for the comparison.
|
(default) and `RAW_FRAME`, which it unwraps itself with `GnUnwrap.kt`; see the README for the comparison.
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -39,6 +39,7 @@ link:
|
|||||||
max_message: 512 octets, fragmented above that by the spec
|
max_message: 512 octets, fragmented above that by the spec
|
||||||
microbu_extensions:
|
microbu_extensions:
|
||||||
V2X_RX: opcode 0x90, every ITS message heard on air, verified or not
|
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
|
unsigned_tx: security profile 1, or 0 with station security 0
|
||||||
radio: polled from STATION_CONFIGURE on
|
radio: polled from STATION_CONFIGURE on
|
||||||
battery_guard: deep sleep below 3.30 V, no phone on USB, runs again from 3.60 V
|
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
|
battery) and the first V2X_RX messages. Status exchange: the host sends `STATUS_REQUEST` every
|
||||||
1000 ms; `CONFIRM.detail` contains the snapshot.
|
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
|
## BLE pairing
|
||||||
|
|
||||||
```yaml
|
```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 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. \\
|
{\ttfamily 14} & {\ttfamily its\_\allowbreak{}payload} & {\ttfamily remaining bytes} & \textemdash & The ITS message (CAM, DENM, MAPEM, SPATEM, VAM) in its UPER encoding. \\
|
||||||
\end{longtable}}
|
\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}
|
\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.
|
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}@{}}
|
{\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
|
\toprule\textbf{Revision} & \textbf{Date} & \textbf{Changes} \\\midrule\endhead
|
||||||
\bottomrule\endfoot
|
\bottomrule\endfoot
|
||||||
1 & 2026-11 & Niklas Dathe: the microbu-firmware interface reference, commit e4e4bd8. \\
|
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{longtable}}
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
results under "Running". Toolchain: MSYS2 UCRT64 gcc, Option B below (chosen and
|
results under "Running". Toolchain: MSYS2 UCRT64 gcc, Option B below (chosen and
|
||||||
installed 2026-09-11).
|
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
|
**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
|
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
|
(`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