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:
Ashin Walpola
2026-11-23 17:34:56 +01:00
parent 7dd83dba3d
commit ce18a393ea
24 changed files with 3305 additions and 2305 deletions
+11 -3
View File
@@ -35,8 +35,16 @@ custom PCB; pick it in `menuconfig -> micrOBU firmware -> Board`.
(`Station::forward_raw`) and reaches the phone as `V2X_RX`. Body: `u16 port, i8 rssi, u8 flags
(bit0 GBC area, bit1 signed), i32 lat, i32 lon, u16 distance_a, ITS payload`. `0x85` is the spec's
`RAW_FRAME` debug capture and `0x86` is reserved by Niklas Dathe, hence `0x90`. BTP ports 2001
CAM, 2002 DENM, 2003 MAPEM, 2004 SPATEM, 2018 VAM pass; a message over 494 bytes does not fit a
512-octet link message and is dropped and counted (not fragmented).
CAM, 2002 DENM, 2003 MAPEM, 2004 SPATEM, 2018 VAM pass. A message up to 494 bytes is one link
message, unchanged. Since 2026-11-23 a larger one (a road SPATEM or MAPEM, 555-1243 bytes; up to
`v2x_rx_max_forward` = 2300) goes out in link fragments (`link_fragment.hpp`, flags 1/2/3 as the spec
defines them), best effort: no retry and no waiting, a fragment no transport takes ends that message
(the app drops the incomplete stream) and `raw_fragment_failed_` counts it, and the serial fragments use
the non-blocking `try_write` so a stalled USB host cannot hold the station task that drains the radio queue.
A transport that would need more than 8 fragments (ATT MTU 23) skips the message. While `RAW_CAPTURE` is on
the app reads `RAW_FRAME`, so a large message is not sent a second time as `V2X_RX` (`raw_covered_`).
Before this change a message over 494 bytes was dropped and counted (the 2026-11-23 bench run lost every
888-byte SPATEM and 1198-byte MAPEM that way).
- **Unsigned transmission.** Niklas Dathe's station signs everything. A request with GN security
profile 1 (or 0 while the station is configured `security = 0`) goes out unsigned with
`geonet.c`'s header and the position of the last PoTi (`Station::unsecured_request`), from a
@@ -64,7 +72,7 @@ custom PCB; pick it in `menuconfig -> micrOBU firmware -> Board`.
- **Flash size 8 MB** (XIAO), TX power ceiling 20 dBm (`radio_policy.hpp` admits 20 dBm on channel 180).
- **ATT MTU 517** (`CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU`, Niklas Dathe's 512): the app asks for 517 and a 494-octet
V2X_RX is a 512-octet link message, which needs a value of 512, i.e. an MTU of 515. At 512 such a message was
split into fragments the app does not reassemble.
split into fragments the app did not reassemble then (it does now, `LinkReassembly`).
- **Link-layer address.** A signed station without a named MAC uses the address derived from its ticket; with the
16-octet STATION_CONFIGURE the phone names it (see "Unsigned transmission"). The CAM and VAM station ID still
rotates in the app; the app now rotates the MAC with it on a ride and keeps one fixed for the bench pinger.