gn_unwrap.c now passes BTP ports 2003 (MAPEM) and 2018 (VAM), signed or not, besides CAM, DENM and SPATEM. A message over 494 bytes still does not fit one 512-octet link message (also the largest GATT value) and is dropped and counted, not fragmented. The bench RSU's MAPEM is 295 bytes. CONFIG_MICROBU_BENCH_LISTEN (off in sdkconfig) is for a board whose only PC connection is the UART0 console: it configures itself receive-only at boot and logs every V2X_RX message; tools/bench_listen_watch.py tallies the log. On air on 2026-10-28 it forwarded 104 MAPEM, 185 SPATEM and 472 CAM in 90 s, with nothing oversize. The RSU sent all of them unsigned. Host tests: signed GeoBroadcast SPATEM/MAPEM frames of 58 to 1243 bytes with every truncation length; the replay cuts frames at c5_radio.cpp's 2346 bytes (not the old C firmware's 800) and checks MAPEMs with asn1tools.
6.1 KiB
obu-firmware
Since 2026-09-23: signed ITS on vanetza-idf
This firmware is a port of the colleague's standalone ESP32-C5 VRU station
(microbu-esp32c5/firmware, in their own repository; only its external/vanetza-idf is copied
here, to obu-firmware/external/vanetza-idf).
From it: the vanetza-idf C-ITS stack (BTP, GeoNetworking, the TS 103 097 security entity with
credentials in NVS), the station-link protocol v1 (link_protocol.*, link_service.*) over the
native USB port (serial_link.*, frame type 0x10 in the same 0xAA55 framing as before) and over BLE
GATT (simple_ble.*), and the radio adapter (c5_radio.*, otm_tx_custom.c). Build with ESP-IDF
6.0.2; see FLASHING.md.
The phone builds CAM or VAM, configures the station, provisions credentials, sends PoTi and hands
each message over as a BTP-DATA.request; the firmware adds GN/BTP, signs with the authorization
ticket, and transmits. The phone side is Esp32Link.kt in the app.
Changed or added for this project (search for MicrOBU: in the sources):
- Reception stays as it was. vanetza-idf decapsulates with
itsGnSnDecapResultHandling = STRICT, so it drops unsigned traffic (the bench sim car) and everything signed under a root other than the provisioned demo root (every RSU). Every captured frame therefore also goes through the previous firmware'sgn_unwrap.cand reaches the phone as link opcodeV2X_RX(0x85), whose body is exactly the oldSERIAL_MSG_V2X_RXpayload (Station::forward_raw). The app's receive side is unchanged. Signed or not, BTP ports 2001 CAM, 2002 DENM, 2003 MAPEM, 2004 SPATEM and 2018 VAM pass (MAPEM and VAM since 2026-10-28); a message over 494 bytes does not fit a 512-octet link message and is dropped and counted, not fragmented. - Bench listener (
CONFIG_MICROBU_BENCH_LISTEN, off insdkconfig): for a board whose only PC connection is the UART0 console. It configures itself receive-only at boot and logs every V2X_RX;tools/bench_listen_watch.py COMxtallies the log. Build it from a copy ofsdkconfigwith the option on andCONFIG_MICROBU_BATTERY_ADC_GPIO=-1(on a board without the XIAO's cell divider, GPIO6 floats and can read like a flat cell, which deep-sleeps the board), e.g.idf.py -B build-bench -DSDKCONFIG=<copy> build. - Unsigned transmission is still possible. The colleague's station refuses unsecured requests.
Here a request with GN security profile 1 goes out with the previous firmware's
geonet.cheader and the position of the last PoTi (Station::unsecured_request); the app's "Sign outgoing messages" setting decides per message. - Console on UART0. ESP_LOG stays on UART0 (GPIO11/12, pads D6/D7 on the XIAO); the native port
carries only link frames. The earlier bench board had a CH343 bridge on UART0 (COM3); the XIAO has
none, so its log is invisible unless a UART adapter is attached. The colleague's single-port board
routes the log into LOG frames on the native port (
CONFIG_MICROBU_LOG_OVER_LINK, off here). - BLE pauses while USB is in use (
CONFIG_MICROBU_BLE_USB_IDLE_MS, 3 s): BLE and ITS-G5 share the C5's one RF front end. Whether a live BLE connection disturbs 5.9 GHz is still unmeasured (TODO.md). - A serial write no longer stalls the station task when no USB host is present (BLE-only use).
- A notification longer than the ATT MTU is dropped instead of silently truncated.
- The Wi-Fi RX callback's 2.4 KB capture buffer is static rather than on the driver task's stack
(the previous firmware's commit
04b0076fixed the same risk). - Manual country policy and the TX-power read-back from the previous firmware's radio bring-up.
- The activity LED (GPIO27 on the XIAO) is off unless configured (
CONFIG_MICROBU_TX_LED_GPIO). - Production board is the XIAO ESP32-C5 (2026-10-05): 8 MB flash, one native USB-C port, flashed
on COM10 on the bench. Battery: STATUS carries
battery_mv/battery_flags(octets 103-105, a MicrOBU extension; decoders accept 103 or >= 106 octets) and the board deep-sleeps below 3.30 V when no phone is on USB, to protect a cell with no protection board. Details and thresholds: FLASHING.md, "Battery and pins".
Credentials: the app ships assets/demo-chain.vcr, a throwaway chain generated 2026-09-23 with the
colleague's vidf_issue (root 6E7D0374FB021901, AA B3312F29844299E0, AT B80B49387A4C12EB
valid two years, permissions psid 36 SSP 010000 and psid 638 SSP 01). The colleague's own demo
chain only grants psid 638 and so cannot sign CAMs. Not EU-registered: receivers that verify against
the EU trust list drop what it signs.
Time: the signature's generationTime comes from the PoTi timestamp, which follows the app's
ItsTime: TimestampIts counts TAI milliseconds since 2004 (TS 102 894-2 V2.5.1), so it includes the
5 leap seconds inserted since then, as the colleague's VBS does. Until 2026-10 the app left them out:
its PoTi set the micrOBU's clock 5 s behind, which made it reject other stations' messages as
Invalid_Timestamp and restart its stack whenever a correctly timed source had set the clock before.
Earlier notes (Phase 2, superseded)
OBU transmit firmware - Phase 2 (in progress: HLN-SV DENM beacon)
Started. See docs/04-transmit-setup.md in the project root for build/flash
steps and how to validate this against your own sniffer.
Implements one profile so far: HLN-SV (aftermarket stationary recovery vehicle), causeCode 94 (stationaryVehicle), subCauseCode 0, active while the hazard-light GPIO is grounded. No location/alacarte containers.
main/main.c- entry point, thephy_11p_set/phy_change_channel(5900,...)register hack, GPIO polling, TX loopmain/denm.c/.h- ASN.1 UPER encoding of a minimal DENMmain/geonet.c/.h- GeoNetworking Basic/Common/SHB headers + BTP-Bmain/dot11p.c/.h- 802.11 OCB (QoS Data, broadcast) frame + LLC/SNAP
Known gaps, tracked as TODOs in the source: no real GNSS (lat/long hardcoded 0), no real time source (detectionTime/referenceTime hardcoded 0, decodes as 2004-01-01), fixed (non-rotating) pseudonym MAC, SHB instead of GeoBroadcast (no multi-hop forwarding), unsecured (no IEEE 1609.2 signing).