Fragment large V2X_RX messages and decode road-RSU SPATEMs
The firmware dropped every received ITS message over 494 bytes (one link message), so a road RSU's 888-byte SPATEM and 1198-byte MAPEM never reached the phone. V2X_RX now goes out in link fragments up to 2300 bytes, best effort and non-blocking; messages up to 494 bytes are unchanged. The app's SPATEM decoder then refused those messages because they carry intersection and movement names and advisory speed lists. It now reads past both, checked against asn1tools on 718 distinct messages. Adds the pure fragmenter with host tests and a pcap replay, a Kotlin cross-check on the firmware's own fragments, tools/rx_size_compare.py, docs/08-large-message-reception.md and station-link revision 3.
This commit is contained in:
+2400
-2240
File diff suppressed because it is too large
Load Diff
@@ -21,15 +21,15 @@
|
||||
\newcolumntype{F}{@{}|P{12mm}|P{43mm}|P{36mm}|P{25mm}|P{48.15mm}|@{}}
|
||||
\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\fancyfoot[L]{\footnotesize Document revision 2 (MicrOBU)}
|
||||
\fancyfoot[L]{\footnotesize Document revision 3 (MicrOBU)}
|
||||
\fancyfoot[R]{\footnotesize\thepage\ / \pageref{LastPage}}
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\renewcommand{\footrulewidth}{0pt}
|
||||
\hypersetup{pdftitle={microbu station link interface reference, revision 2 (MicrOBU)}}
|
||||
\hypersetup{pdftitle={microbu station link interface reference, revision 3 (MicrOBU)}}
|
||||
\begin{document}
|
||||
microbu station link interface reference, revision 2 (MicrOBU)\par
|
||||
microbu station link interface reference, revision 3 (MicrOBU)\par
|
||||
\vspace{3mm}
|
||||
Revision 1 was written by Niklas Dathe (microbu-firmware, commit e4e4bd8); revision 2 is revision 1 plus the additions of the MicrOBU production firmware (obu-firmware). Every addition is marked \textbf{MicrOBU extension}; the revision history is at the end.\par\smallskip
|
||||
Revision 1 was written by Niklas Dathe (microbu-firmware, commit e4e4bd8); revisions 2 and 3 are revision 1 plus the additions of the MicrOBU production firmware (obu-firmware). Every addition is marked \textbf{MicrOBU extension}; the revision history is at the end.\par\smallskip
|
||||
The maximum link message is 512 bytes, including the four-byte header.\par\smallskip
|
||||
USB Serial/JTAG and BLE GATT carry the same messages.
|
||||
The host sends a status request as a link heartbeat.\par\smallskip
|
||||
@@ -1147,7 +1147,7 @@ Marks record origin and time basis.
|
||||
{\ttfamily 12} & {\ttfamily frame\_\allowbreak{}length} & {\ttfamily u16} & bytes & Gives the raw radio-frame size in bytes. \\
|
||||
{\ttfamily 14} & {\ttfamily frame} & {\ttfamily bytes[\allowbreak{}frame\_\allowbreak{}length]} & \textemdash & Contains the raw radio-frame bytes. \\
|
||||
\end{longtable}}
|
||||
\Needspace{7\baselineskip}\section{MicrOBU extensions (revision 2)}\label{sec:microbu-extensions}
|
||||
\Needspace{7\baselineskip}\section{MicrOBU extensions (revisions 2 and 3)}\label{sec:microbu-extensions}
|
||||
These additions are not in revision 1. A host written for revision 1 keeps working: it never sees opcode 0x90 unless it listens for it, and it never sends security profile 0x01.
|
||||
\Needspace{8\baselineskip}\subsection{{\ttfamily V2X\_\allowbreak{}RX}}
|
||||
{\small\color{ink}\textbf{0x90}\quad STATION TO HOST \quad (MicrOBU extension)}
|
||||
@@ -1156,8 +1156,8 @@ Delivers every ITS message heard on air, verified or not. The station stack deca
|
||||
\toprule\textbf{Parameter} & \textbf{Setting} & \textbf{Description} \\\midrule\endfirsthead
|
||||
\toprule\textbf{Parameter} & \textbf{Setting} & \textbf{Description} \\\midrule\endhead
|
||||
\bottomrule\endfoot
|
||||
{\ttfamily reply} & {\ttfamily none} & One-way indication, not fragmented. \\
|
||||
{\ttfamily maximum\_\allowbreak{}payload} & {\ttfamily 494 bytes} & 512 minus the four-byte header and the 14-byte prefix. A longer message is dropped and counted, never fragmented. \\
|
||||
{\ttfamily reply} & {\ttfamily none} & One-way indication. Fragmented when the body exceeds one link message (revision 3, Section~\ref{sec:microbu-v2xrx-frag}). \\
|
||||
{\ttfamily maximum\_\allowbreak{}payload} & {\ttfamily 2300 bytes} & Up to 494 bytes (512 minus the four-byte header and the 14-byte prefix) the message is one link message. Revision 3: a longer one is fragmented, up to 2300 bytes; beyond that it is dropped and counted. Revision 2 dropped everything over 494 bytes. \\
|
||||
{\ttfamily btp\_\allowbreak{}ports} & {\ttfamily 2001--2004, 2018} & CAM, DENM, MAPEM, SPATEM, VAM. Other ports are not delivered. \\
|
||||
{\ttfamily availability} & {\ttfamily from configure} & The radio is polled from STATION\_CONFIGURE on, before the first POTI\_UPDATE. \\
|
||||
\end{longtable}}
|
||||
@@ -1177,10 +1177,27 @@ Delivers every ITS message heard on air, verified or not. The station stack deca
|
||||
\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.
|
||||
\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; a message of up to 494 octets is one link message, a larger one is fragmented (revision 3, Section~\ref{sec:microbu-v2xrx-frag}).
|
||||
\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 (neither is \texttt{V\_2X\_RX} since revision 3), 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{Fragmented \texttt{V\_\allowbreak{}2X\_\allowbreak{}RX} (revision 3)}\label{sec:microbu-v2xrx-frag}
|
||||
Road roadside units send SPATEMs and MAPEMs of 555 to 1243 octets (the Berliner Tor unit: 888 and 1198), more than the 494 octets one link message carries. Revision 2 dropped them in the station, silently as far as the host could tell. From revision 3 the station sends them in fragments, with the framing of the fragmentation section of revision 1 (flags 1, 2 and 3; the same opcode 0x90 and sequence on every fragment; each fragment body starts with total length and offset). The body that is reassembled is the ordinary \texttt{V\_2X\_RX} body of this section, the 14-octet prefix included.
|
||||
{\small\begin{longtable}{@{}P{45mm}P{55mm}P{72.8mm}@{}}
|
||||
\toprule\textbf{Parameter} & \textbf{Setting} & \textbf{Description} \\\midrule\endfirsthead
|
||||
\toprule\textbf{Parameter} & \textbf{Setting} & \textbf{Description} \\\midrule\endhead
|
||||
\bottomrule\endfoot
|
||||
{\ttfamily single message} & {\ttfamily up to 494 bytes} & Unchanged from revision 2: flags 0, one link message, byte for byte. \\
|
||||
{\ttfamily fragmented} & {\ttfamily 495 to 2300 bytes} & Body of 14 + payload octets, split into fragments of at most the transport message size minus eight octets (four of link header, four of fragment header): 504 octets of body on serial and on BLE with ATT MTU 517. An 888-byte SPATEM is two fragments, a 1198-byte MAPEM three. \\
|
||||
{\ttfamily dropped} & {\ttfamily over 2300 bytes} & Counted by the station, not sent. Truncated and empty messages are never sent. \\
|
||||
{\ttfamily delivery} & {\ttfamily best effort} & No acknowledgement, retry or wait. A fragment the transport does not take ends that message; the host discards the incomplete stream (2000 ms idle, or the next first fragment of the same opcode and sequence). A lost fragment costs only that message and never slows reception. \\
|
||||
{\ttfamily serial} & {\ttfamily non-blocking} & Fragments are queued without waiting for the host, as \texttt{RAW\_FRAME} is, so a stalled USB host cannot hold up the station. Nothing is queued while no USB host is connected. A message that fits one link message keeps its blocking write. \\
|
||||
{\ttfamily fragment cap} & {\ttfamily 8 per message} & A transport that would need more than eight fragments (an ATT MTU that was never raised, 23) skips the message. \\
|
||||
{\ttfamily raw capture on} & {\ttfamily large not sent} & While \texttt{RAW\_CAPTURE} is on the host reads \texttt{RAW\_FRAME}, so a message above 494 octets is left to that copy instead of being sent a second time. Messages up to 494 octets are still sent as \texttt{V\_2X\_RX}. \\
|
||||
\end{longtable}}
|
||||
A host that already reassembles fragmented messages (the revision 1 requirement, Section~\ref{sec:fragmentation-host}) needs no change. A host that handled only unfragmented \texttt{V\_2X\_RX} sees flags 1 to 3 on opcode 0x90 for the first time and must reassemble or ignore them. The wire format of every other message is unchanged.
|
||||
\Needspace{5\baselineskip}\paragraph{Host decoding of the larger messages}
|
||||
Roadside units also fill the messages out: a SPATEM names the intersection and each movement (\texttt{DescriptiveName}, IA5String of 1 to 63 characters) and gives each signal event a list of advisory speeds (greenwave, ecoDrive). A host decoder must read past these optional fields, not refuse the message. A decoder written against shorter messages and refusing them showed no signal state for the Berliner Tor unit, although every SPATEM had arrived and was in the host's log. The MicrOBU app reads past both since 2026-11-23.
|
||||
\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}
|
||||
@@ -1235,5 +1252,6 @@ MicrOBU extension. While no USB host is connected to the native port (the phone
|
||||
\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; 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. \\
|
||||
3 & 2026-11-23 & \texttt{V\_2X\_RX} larger than 494 octets is fragmented, up to 2300 octets, best effort and non-blocking (Section~\ref{sec:microbu-v2xrx-frag}); revision 2 dropped it. Serial writes of fragments and of \texttt{RAW\_FRAME} are skipped while no USB host is connected. Found on the 2026-11-23 bench run against the Berliner Tor roadside unit (888-byte SPATEM, 1198-byte MAPEM); the findings are in docs/08-large-message-reception.md. Wire format of messages up to 494 octets unchanged. \\
|
||||
\end{longtable}}
|
||||
\end{document}
|
||||
|
||||
Reference in New Issue
Block a user