Update the notes for the new firmware and name Niklas Dathe

README, docs/06, TODO and the architecture diagram describe the microbu-firmware
based obu-firmware and station-link revision 2, add the hardware checks for the
new image, and credit Niklas Dathe as the author of the station firmware and its
interface specification. Ignore LaTeX build output next to station-link.tex.
This commit is contained in:
Ashin Walpola
2026-11-11 00:13:58 +01:00
parent 4ce1aaf250
commit fd006192e7
5 changed files with 94 additions and 69 deletions
+7 -1
View File
@@ -55,7 +55,7 @@ sdkconfig.old
# dependencies.lock beside the project pins them and is committed; this is its cache. # dependencies.lock beside the project pins them and is committed; this is its cache.
managed_components/ managed_components/
# The colleague's standalone ESP32-C5 VRU station (its own repository, HAW GitLab # Niklas Dathe's standalone ESP32-C5 VRU station (its own repository, HAW GitLab
# urban-mobility-lab/microbu/microbu-esp32c5). Kept beside the project on the lab laptop, for # urban-mobility-lab/microbu/microbu-esp32c5). Kept beside the project on the lab laptop, for
# reference and because the V2X2MAP bridge runs from its tools/, but not part of this repository: # reference and because the V2X2MAP bridge runs from its tools/, but not part of this repository:
# obu-firmware only needs its vanetza-idf, which is copied to obu-firmware/external/vanetza-idf. # obu-firmware only needs its vanetza-idf, which is copied to obu-firmware/external/vanetza-idf.
@@ -63,3 +63,9 @@ managed_components/
# draw.io keeps a backup beside an open diagram. # draw.io keeps a backup beside an open diagram.
*.drawio.bkp *.drawio.bkp
# LaTeX build output of obu-firmware/docs/station-link.tex (the PDF itself is committed)
obu-firmware/docs/*.aux
obu-firmware/docs/*.log
obu-firmware/docs/*.out
obu-firmware/docs/*.synctex.gz
+16 -11
View File
@@ -18,7 +18,7 @@ The project began against the consider it CiT One and later added the ESP32-C5 a
| | consider it CiT One | ESP32-C5 (micrOBU, `obu-firmware/`) | | | consider it CiT One | ESP32-C5 (micrOBU, `obu-firmware/`) |
|---|---|---| |---|---|---|
| What it is | Complete V2X on-board unit | Seeed XIAO ESP32-C5 running a vanetza-idf ITS station | | What it is | Complete V2X on-board unit | Seeed XIAO ESP32-C5 running Niklas Dathe's microbu-firmware ITS station |
| Transport | IP over USB tethering, MQTT | Station-link protocol over native USB-C or Bluetooth LE | | Transport | IP over USB tethering, MQTT | Station-link protocol over native USB-C or Bluetooth LE |
| Reaches the phone as | Processed JSON, plus raw protobuf-wrapped UPER | Raw ASN.1 UPER per message, with RSSI | | Reaches the phone as | Processed JSON, plus raw protobuf-wrapped UPER | Raw ASN.1 UPER per message, with RSSI |
| V2X stack lives | On the OBU | Facilities (CAM/VAM/DENM/SPATEM/MAPEM codecs) on the phone; BTP, GeoNetworking, security and radio on the board | | V2X stack lives | On the OBU | Facilities (CAM/VAM/DENM/SPATEM/MAPEM codecs) on the phone; BTP, GeoNetworking, security and radio on the board |
@@ -75,9 +75,10 @@ app/src/main/java/com/hawhamburg/micr0bu/
domain/cam/ Cam, CamParser, PhoneCamBuilder, CamTransmitConfig, Pseudonym domain/cam/ Cam, CamParser, PhoneCamBuilder, CamTransmitConfig, Pseudonym
service/ TripRecordingService, CamTransmitLoop, CamPinger, V2xLogService service/ TripRecordingService, CamTransmitLoop, CamPinger, V2xLogService
obu-firmware/ ESP32-C5 OBU: vanetza-idf station (signing, BTP, GeoNetworking), station link over obu-firmware/ ESP32-C5 OBU on Niklas Dathe's microbu-firmware (station, signing, BTP, GeoNetworking,
USB and BLE, raw receive path (gn_unwrap.c), battery monitor; host tests in test/ station link over USB and BLE) plus our raw receive path (gn_unwrap.c, V2X_RX),
obu-firmware/external/vanetza-idf/ the C-ITS library the firmware builds against (vendored, unchanged) unsigned TX and battery guard; host tests in test/
obu-firmware/{components,external}/ microbu_v2x, Vanetza and its patched source (vendored, unchanged)
obu-cam-transmistter/ Bench CAM beacon (the "simulated car"), fixed station ID, drives a loop in St. Georg obu-cam-transmistter/ Bench CAM beacon (the "simulated car"), fixed station ID, drives a loop in St. Georg
asn1/ Vendored ETSI ASN.1 modules the codecs are verified against asn1/ Vendored ETSI ASN.1 modules the codecs are verified against
tools/ Bench scripts: STATUS watcher, bench-listener tally, MAPEM test-corpus generator tools/ Bench scripts: STATUS watcher, bench-listener tally, MAPEM test-corpus generator
@@ -97,7 +98,7 @@ The `domain/` packages contain no Android imports. That is what makes the 132-te
On the CiT One path the MQTT broker runs on the OBU (Mosquitto 2.0.11, port 1883); Android USB tethering exposes it as a virtual Ethernet interface at `192.168.42.x` and the app auto-detects the gateway IP on plug-in. On the CiT One path the MQTT broker runs on the OBU (Mosquitto 2.0.11, port 1883); Android USB tethering exposes it as a virtual Ethernet interface at `192.168.42.x` and the app auto-detects the gateway IP on plug-in.
On the ESP32-C5 path there is no network layer. Both links carry the same **station-link protocol v1** (from the colleague's `microbu-esp32c5` station): `[opcode][flags][sequence LE][body]`, at most 512 octets per message (`LINK_MAX_MESSAGE` in the app, `link::maximum_message` in the firmware). The phone configures the station, provisions the demo credentials once, keeps the board's clock and position current (`POTI_UPDATE` per new GNSS fix) and submits messages (`BTP_DATA_REQUEST`); the board answers with `RESULT`, sends `STATUS` every second, and forwards every ITS message it hears as `V2X_RX` (0x85, a MicrOBU extension). Over USB each message is one `0xAA55` frame with CRC-16; over BLE it is one GATT value. Details: [docs/06-signed-its-vam-ble.md](docs/06-signed-its-vam-ble.md). On the ESP32-C5 path there is no network layer. Both links carry the same **station-link protocol**, revision 2 ([obu-firmware/docs/station-link.tex](obu-firmware/docs/station-link.tex); revision 1 is Niklas Dathe's, revision 2 adds our extensions): `[opcode][flags][sequence LE][body]`, at most 512 octets per message (`LINK_MAX_MESSAGE` in the app, `link::maximum_message` in the firmware). The phone configures the station, provisions the demo credentials once, keeps the board's clock and position current (`POTI_UPDATE` per new GNSS fix) and submits messages (`BTP_DATA_REQUEST`); the board answers every request with `CONFIRM`, the phone asks for `STATUS_REQUEST` every second (the status snapshot is in the CONFIRM), and the board forwards every ITS message it hears as `V2X_RX` (0x90, a MicrOBU extension). Over USB each message is one `0xAA55` frame with CRC-16; over BLE it is one GATT value. Details: [docs/06-signed-its-vam-ble.md](docs/06-signed-its-vam-ble.md).
### Bluetooth LE ### Bluetooth LE
@@ -106,7 +107,7 @@ Settings > Connection > ESP32-C5 > link: Bluetooth.
- **GATT layout**: service `0000C175-BA5E-4C17-8000-00805F9B34FB`, one characteristic per primitive. Each value is one whole link message, never fragmented, so the app raises the ATT MTU to 517 first; the firmware drops a notification rather than send it cut short. - **GATT layout**: service `0000C175-BA5E-4C17-8000-00805F9B34FB`, one characteristic per primitive. Each value is one whole link message, never fragmented, so the app raises the ATT MTU to 517 first; the firmware drops a notification rather than send it cut short.
- **Pairing**: the board advertises as `micrOBU-XXXX`. LE Secure Connections with a fixed passkey, **123456**, entered once in Android's own pairing dialog. The bond is kept on both sides (the board stores it in its 80 KB NVS). The passkey is public, so this gives an encrypted link but no protection against an active attacker during that first pairing. - **Pairing**: the board advertises as `micrOBU-XXXX`. LE Secure Connections with a fixed passkey, **123456**, entered once in Android's own pairing dialog. The bond is kept on both sides (the board stores it in its 80 KB NVS). The passkey is public, so this gives an encrypted link but no protection against an active attacker during that first pairing.
- **Reconnect**: after a drop (4 s supervision timeout) the app reconnects by itself, 1 s later and then backing off to 30 s. With several bonded micrOBUs (a replaced board stays bonded), the one that connected last is tried first, then the others in turn. - **Reconnect**: after a drop (4 s supervision timeout) the app reconnects by itself, 1 s later and then backing off to 30 s. With several bonded micrOBUs (a replaced board stays bonded), the one that connected last is tried first, then the others in turn.
- **USB takes priority**: the board stops advertising while its USB link is in use (`CONFIG_MICROBU_BLE_USB_IDLE_MS`, 3 s), because BLE and ITS-G5 share the C5's single RF front end. - **BLE and ITS-G5 share the C5's single RF front end**: the firmware holds an ITS-G5 frame out of the BLE connection-event windows (`CONFIG_MICROBU_TX_BLE_GUARD`).
- **Permissions**: `BLUETOOTH_SCAN` and `BLUETOOTH_CONNECT` (Android 12+), requested at start-up. - **Permissions**: `BLUETOOTH_SCAN` and `BLUETOOTH_CONNECT` (Android 12+), requested at start-up.
Whether an active BLE connection costs 5.9 GHz reception has not been measured yet. Whether an active BLE connection costs 5.9 GHz reception has not been measured yet.
@@ -124,7 +125,7 @@ Verification therefore uses an independent oracle: `asn1tools` compiled from the
- **Golden-byte fixtures** assert exact encoder output (CAM, VAM), with expected values produced by the oracle rather than by this encoder. - **Golden-byte fixtures** assert exact encoder output (CAM, VAM), with expected values produced by the oracle rather than by this encoder.
- **Bulk replay** compares every field over real captures: 79,042 SPATEMs and 1,885 DENMs, zero mismatches. - **Bulk replay** compares every field over real captures: 79,042 SPATEMs and 1,885 DENMs, zero mismatches.
- **MAPEM**: every distinct MAPEM on record (17 from the 2026-03-18 drive, 288 to 1348 bytes, plus the bench RSU's) decodes field for field like asn1tools (`MapemUperCodecTest`; fixtures from `tools/mapem_corpus.py`). Joined with recorded SPATEMs of the same intersections, 340 of 341 signalled lane exits find their signal group (`TrafficLightsTest`). - **MAPEM**: every distinct MAPEM on record (17 from the 2026-03-18 drive, 288 to 1348 bytes, plus the bench RSU's) decodes field for field like asn1tools (`MapemUperCodecTest`; fixtures from `tools/mapem_corpus.py`). Joined with recorded SPATEMs of the same intersections, 340 of 341 signalled lane exits find their signal group (`TrafficLightsTest`).
- **Station link**: the codec is pinned to bytes from the colleague's Python implementation (`StationLinkTest`). - **Station link**: the codec is pinned to bytes from Niklas Dathe's Python implementation (`StationLinkTest`).
- **Signatures on air**: `obu-firmware/test/verify_signed_pcap.py` checks captured frames with asn1tools and OpenSSL, sharing no code with the firmware: 12 of 12 signed CAMs valid, demo chain valid (2026-09-23). The CiT One and the V2X2MAP bridge receive them too. - **Signatures on air**: `obu-firmware/test/verify_signed_pcap.py` checks captured frames with asn1tools and OpenSSL, sharing no code with the firmware: 12 of 12 signed CAMs valid, demo chain valid (2026-09-23). The CiT One and the V2X2MAP bridge receive them too.
- **Firmware receive path**: host tests (`obu-firmware/test/host`, `make`) run the TX-to-RX chain, every recorded frame cross-checked by asn1tools, and a guard-page fuzz of `gn_unwrap_its`. - **Firmware receive path**: host tests (`obu-firmware/test/host`, `make`) run the TX-to-RX chain, every recorded frame cross-checked by asn1tools, and a guard-page fuzz of `gn_unwrap_its`.
- **Off-air confirmation**: 26 of this project's own CAMs captured back by an independent receiver, all accepted. - **Off-air confirmation**: 26 of this project's own CAMs captured back by an independent receiver, all accepted.
@@ -144,7 +145,7 @@ Never regenerate a golden fixture from this project's own encoder output. See `a
| [05-obu-bench-test-2026-08-25.md](05-obu-bench-test-2026-08-25.md) | Bench campaign T1 to T9, measured results | | [05-obu-bench-test-2026-08-25.md](05-obu-bench-test-2026-08-25.md) | Bench campaign T1 to T9, measured results |
| [04-transmit-setup.md](04-transmit-setup.md) | Transmitter bring-up, radio configuration diagnosis, the TX bypass | | [04-transmit-setup.md](04-transmit-setup.md) | Transmitter bring-up, radio configuration diagnosis, the TX bypass |
| [obu-firmware/FLASHING.md](obu-firmware/FLASHING.md) | Toolchain setup (ESP-IDF 6.0.2), flashing, battery and pins, phone-to-board bring-up | | [obu-firmware/FLASHING.md](obu-firmware/FLASHING.md) | Toolchain setup (ESP-IDF 6.0.2), flashing, battery and pins, phone-to-board bring-up |
| [obu-firmware/NOTES.md](obu-firmware/NOTES.md) | What the firmware changes against the colleague's station, and why | | [obu-firmware/NOTES.md](obu-firmware/NOTES.md) | What the firmware changes against Niklas Dathe's station, and why |
| [obu-firmware/test/host/README.md](obu-firmware/test/host/README.md) | Host tests of the firmware's frame code | | [obu-firmware/test/host/README.md](obu-firmware/test/host/README.md) | Host tests of the firmware's frame code |
| [TODO.md](TODO.md) | Open engineering items, including the hardware checks still to run | | [TODO.md](TODO.md) | Open engineering items, including the hardware checks still to run |
| [asn1/README.md](asn1/README.md) | ASN.1 module provenance and the fixture regeneration rule | | [asn1/README.md](asn1/README.md) | ASN.1 module provenance and the fixture regeneration rule |
@@ -184,14 +185,18 @@ Never regenerate a golden fixture from this project's own encoder output. See `a
The Wi-Fi transport (broker at `192.168.3.202`) remains available in developer builds via Settings > Developer. The Wi-Fi transport (broker at `192.168.3.202`) remains available in developer builds via Settings > Developer.
Keep app and firmware in step: both cap a link message at 512 octets, and the app speaks the station-link protocol (it still falls back to the previous firmware's frames for CAM over USB). Keep app and firmware in step (the app from 2026-11-10 needs the firmware from 2026-11-10: `CONFIRM` and `STATUS_REQUEST`, `V2X_RX` is 0x90, the configure message has 6 octets): both cap a link message at 512 octets, and the app speaks station-link revision 2 (it still falls back to the previous firmware's frames for CAM over USB).
## Credits
The ESP32-C5 station firmware (BTP, GeoNetworking, TS 103 097 security, the station-link protocol, BLE and the radio driver) and its interface specification are by **Niklas Dathe** (HAW Hamburg, microbu-firmware). `obu-firmware/` is his firmware with the MicrOBU additions listed in [obu-firmware/NOTES.md](obu-firmware/NOTES.md).
## Status and known limitations ## Status and known limitations
Bench verified against live ITS-G5 traffic on 2026-08-25: 2868 frames over 305 seconds, zero decode failures, zero USB errors, zero crashes. Signed CAM and VAM, the BLE link and reception over both links were checked on the bench on 2026-09-23; on 2026-10-28 the ESP32-C5 forwarded the bench RSU's MAPEM (295 bytes), SPATEM and CAM with nothing dropped. Not yet road validated. Bench verified against live ITS-G5 traffic on 2026-08-25: 2868 frames over 305 seconds, zero decode failures, zero USB errors, zero crashes. Signed CAM and VAM, the BLE link and reception over both links were checked on the bench on 2026-09-23; on 2026-10-28 the ESP32-C5 forwarded the bench RSU's MAPEM (295 bytes), SPATEM and CAM with nothing dropped. On 2026-11-10 the firmware was rebuilt on Niklas Dathe's newer microbu-firmware layout and the app's link followed (link spec revision 2); that firmware boots, advertises and answers STATUS on the XIAO, while reception, transmission, signing and the battery guard on real hardware are still to be re-checked (`TODO.md`). Not yet road validated.
- **Requirement 11.6, Phase A success criteria, is not met.** The bench proves reception. It cannot prove the use case behaves correctly with two genuinely moving stations, because nothing on the bench moves. This is the main open evidence gap for the project's central claim. - **Requirement 11.6, Phase A success criteria, is not met.** The bench proves reception. It cannot prove the use case behaves correctly with two genuinely moving stations, because nothing on the bench moves. This is the main open evidence gap for the project's central claim.
- **Demo PKI only.** Signed messages carry a throwaway chain shipped with the app, not an EU-registered one; receivers that verify against the EU trust list drop them. No TS 102 941 enrolment. Received signatures are not verified on the ESP32-C5 path. - **Demo PKI only.** Signed messages carry a throwaway chain shipped with the app, not an EU-registered one; receivers that verify against the EU trust list drop them. No TS 102 941 enrolment. The board's stack verifies signatures (counted in STATUS), but the `V2X_RX` path the app uses delivers everything without a verdict, only whether a signature is present.
- **Detection thresholds are untuned engineering estimates**, not calibrated against real intersection data. - **Detection thresholds are untuned engineering estimates**, not calibrated against real intersection data.
- **494-byte receive limit on the ESP32-C5 path.** A larger message does not fit one link message and is dropped: about 70% of real road SPATEMs (median 555 bytes) and many road MAPEMs. The CiT One path is not limited. - **494-byte receive limit on the ESP32-C5 path.** A larger message does not fit one link message and is dropped: about 70% of real road SPATEMs (median 555 bytes) and many road MAPEMs. The CiT One path is not limited.
- **Traffic lights per lane not yet seen live.** Tested on recorded messages only. Riders on crosswalks or sidewalks are not matched to a lane, and computed lanes (`ComputedLane`) are not decoded. - **Traffic lights per lane not yet seen live.** Tested on recorded messages only. Riders on crosswalks or sidewalks are not matched to a lane, and computed lanes (`ComputedLane`) are not decoded.
+19 -6
View File
@@ -5,6 +5,19 @@ Engineering to-do list. The reviewer-facing open items live in
## Waiting on hardware ## Waiting on hardware
### obu-firmware on Niklas Dathe's microbu-firmware (added 2026-11-10)
Flashed on the XIAO at COM6 (the board that held an Arduino sketch; backup in
`firmware-backups/COM6-arduino-first4MB-2026-11-10.bin`). Seen on the bench: boots, advertises BLE
as `micrOBU-894A`, answers STATUS (131 octets), STATION_CONFIGURE starts the radio. Not yet seen,
because nothing was transmitting nearby and no phone ran the updated app:
- [ ] A beacon on air (simulated car on COM8/COM5 or the bench RSU): `py -3.11 tools/station_status_watch.py COM6 30 --configure --rx` prints V2X_RX lines (port 2001, signed=0) and `radio rx` counts up.
- [ ] Unsigned CAM from the phone (Sign outgoing messages off) is heard by a second ESP32-C5 receiver (`obu-firmware/test/pcap_gn_tally.py` on its capture).
- [ ] Signed CAM with the demo chain: tickets=1 and `signed` counts up in STATUS, `obu-firmware/test/verify_signed_pcap.py` accepts the capture.
- [ ] BLE: pairing with passkey 123456, bond survives a reconnect (80 KB NVS), TX while connected (TX BLE guard).
- [ ] Battery: with a cell on the BAT pads, `battery` in STATUS matches a multimeter; the shutdown rule is untested on hardware.
### MAPEM decoder and traffic lights per lane (added 2026-10-28) ### MAPEM decoder and traffic lights per lane (added 2026-10-28)
`MapemUperCodec` decodes every recorded MAPEM (17 from the 2026-03-18 drive + the bench RSU's) `MapemUperCodec` decodes every recorded MAPEM (17 from the 2026-03-18 drive + the bench RSU's)
@@ -98,7 +111,7 @@ Settings > Developer > V2X data logger. 110 unit tests pass. ESP32-C5 path check
### Signed-TX firmware (vanetza-idf port), VAM and BLE: first on-air checks (added 2026-09-23) ### Signed-TX firmware (vanetza-idf port), VAM and BLE: first on-air checks (added 2026-09-23)
obu-firmware is now a port of the colleague's `microbu-esp32c5` station (vanetza-idf, TS 103 097 obu-firmware is now a port of Niklas Dathe's `microbu-esp32c5` station (vanetza-idf, TS 103 097
signing, station-link protocol, BLE GATT), built with **ESP-IDF 6.0.2**. See `obu-firmware/NOTES.md`. signing, station-link protocol, BLE GATT), built with **ESP-IDF 6.0.2**. See `obu-firmware/NOTES.md`.
The previous firmware is backed up in `firmware-backups/` (restore command in its README.txt). The previous firmware is backed up in `firmware-backups/` (restore command in its README.txt).
The app speaks the new protocol over USB or BLE and still falls back to the old frames against the The app speaks the new protocol over USB or BLE and still falls back to the old frames against the
@@ -106,14 +119,14 @@ old firmware.
Done without hardware: IDF 6.0.2 build clean (39 % app partition free); host suite (`make` in Done without hardware: IDF 6.0.2 build clean (39 % app partition free); host suite (`make` in
`obu-firmware/test/host`) passes unchanged; app unit tests 103/103, including the VAM encoder `obu-firmware/test/host`) passes unchanged; app unit tests 103/103, including the VAM encoder
against asn1tools, the station-link codec against the colleague's Python `messages.py`, and the VAM against asn1tools, the station-link codec against Niklas Dathe's Python `messages.py`, and the VAM
generation rules. Flashed to **COM3** 2026-09-23 (hash verified); boot log: IDF v6.0.2, generation rules. Flashed to **COM3** 2026-09-23 (hash verified); boot log: IDF v6.0.2,
`BLE advertising started as 'micrOBU-4AFA'`, station task ready. The radio stays off until the app `BLE advertising started as 'micrOBU-4AFA'`, station task ready. The radio stays off until the app
configures the station. New app build installed on the Pixel 9 Pro (adb, `install -r`). configures the station. New app build installed on the Pixel 9 Pro (adb, `install -r`).
First phone session (user, 2026-09-23): BLE works and CAMs go out. Three faults, fixed and First phone session (user, 2026-09-23): BLE works and CAMs go out. Three faults, fixed and
reflashed/reinstalled the same day: reflashed/reinstalled the same day:
1. No RX until the CAM pinger ran, with ~177 RX-queue drops: the colleague's `Station::tick()` 1. No RX until the CAM pinger ran, with ~177 RX-queue drops: Niklas Dathe's `Station::tick()`
returned before draining the radio until the first PoTi had set the clock. Now drained always. returned before draining the radio until the first PoTi had set the clock. Now drained always.
2. "refused a request: time_regression": the loops re-send the latest fix every tick; a stale fix 2. "refused a request: time_regression": the loops re-send the latest fix every tick; a stale fix
timestamp read as the clock going back > 1 s, and each time the board rebuilt its stack. timestamp read as the clock going back > 1 s, and each time the board rebuilt its stack.
@@ -124,7 +137,7 @@ reflashed/reinstalled the same day:
Second session (user, 2026-09-23): USB, RX and signing work; BLE still prompted every time and Second session (user, 2026-09-23): USB, RX and signing work; BLE still prompted every time and
never connected; time_regression every ~8 s. Found and fixed, reflashed (full flash, NVS erased): never connected; time_regression every ~8 s. Found and fixed, reflashed (full flash, NVS erased):
4. The board never stored a bond: NVS (24 KB, the colleague's 4 MB-board layout) was full, mostly 4. The board never stored a bond: NVS (24 KB, Niklas Dathe's 4 MB-board layout) was full, mostly
Wi-Fi settings the previous firmware left behind, and NimBLE's bond write failed. NVS is now Wi-Fi settings the previous firmware left behind, and NimBLE's bond write failed. NVS is now
80 KB (app moved to 0x20000) and was erased; boot logs `N bonded phone(s) in NVS`. 80 KB (app moved to 0x20000) and was erased; boot logs `N bonded phone(s) in NVS`.
5. The station loop waited `pdMS_TO_TICKS(5)` = 0 ticks at 100 Hz, so it spun on the single core 5. The station loop waited `pdMS_TO_TICKS(5)` = 0 ticks at 100 Hz, so it spun on the single core
@@ -160,13 +173,13 @@ resets the board, the phone is on the other port.
- [x] **Unsigned toggle.** Signing off: the same capture shows next header 1 (common header), as - [x] **Unsigned toggle.** Signing off: the same capture shows next header 1 (common header), as
the previous firmware sent. The card's `signed` count stops rising. the previous firmware sent. The card's `signed` count stops rising.
Confirmed 2026-09-23: unsigned pinger CAMs show on V2X2MAP as unsigned. Confirmed 2026-09-23: unsigned pinger CAMs show on V2X2MAP as unsigned.
- [x] **Signed VAM on V2X2MAP.** Since 2026-09-23 17:16 the COM10 bridge is the colleague's - [x] **Signed VAM on V2X2MAP.** Since 2026-09-23 17:16 the COM10 bridge is Niklas Dathe's
v2x2map-0.3.0 from source with a new `verify.py` and `--trust demo-chain.vcr` (launcher: v2x2map-0.3.0 from source with a new `verify.py` and `--trust demo-chain.vcr` (launcher:
`micrOBU_workspace/v2x-obu-esp32c5/start-v2x2map-signed.bat`, replacing its-g5-bridge.exe). `micrOBU_workspace/v2x-obu-esp32c5/start-v2x2map-signed.bat`, replacing its-g5-bridge.exe).
Signed CAMs from the pinger already show "signature verified" live. Switch to VAM with signing Signed CAMs from the pinger already show "signature verified" live. Switch to VAM with signing
on: the VAM must be decoded (cyclist, position) and show "signature verified" too. on: the VAM must be decoded (cyclist, position) and show "signature verified" too.
Confirmed by the user 2026-09-23: signed VAMs decode and verify. Confirmed by the user 2026-09-23: signed VAMs decode and verify.
- [x] **VAM.** Transmit VAM: BTP port 2018, psid 638; with `tools/wireshark/psid-vru.lua` from the colleague's microbu-esp32c5 repository - [x] **VAM.** Transmit VAM: BTP port 2018, psid 638; with `tools/wireshark/psid-vru.lua` from Niklas Dathe's microbu-esp32c5 repository
Wireshark decodes the VAM (stationType cyclist, bicyclist profile in every ~2 s VAM). Rate: Wireshark decodes the VAM (stationType cyclist, bicyclist profile in every ~2 s VAM). Rate:
≥1 per 5 s standing still, about one per GNSS fix while riding. ≥1 per 5 s standing still, about one per GNSS fix while riding.
Covered by the V2X2MAP check above (decoded VAM, psid 638); Wireshark not needed. Covered by the V2X2MAP check above (decoded VAM, psid 638); Wireshark not needed.
+51 -50
View File
@@ -1,19 +1,21 @@
# 06 – Signed ITS messages, VAM and the BLE link (2026-09-23) # 06 – Signed ITS messages, VAM and the BLE link (2026-09-23, firmware part updated 2026-11-10)
What changed when the ESP32-C5 OBU moved onto the colleague's vanetza-idf station, how the pieces What changed when the ESP32-C5 OBU moved onto Niklas Dathe's station, how the pieces
fit together, how it was verified, and what is still open. Hardware checks still to do are in fit together, how it was verified, and what is still open. Since 2026-11-10 the firmware is built on
Niklas Dathe's newer `microbu-firmware` layout (link spec revision 2, `obu-firmware/docs/station-link.tex`);
the parts below that describe the earlier vanetza-idf port say so. Hardware checks still to do are in
`TODO.md` ("Signed-TX firmware ..."). `TODO.md` ("Signed-TX firmware ...").
## Summary ## Summary
- **Signing lives on the ESP32-C5.** The authorization ticket's private key is in the board's NVS; - **Signing lives on the ESP32-C5.** The authorization ticket's private key is in the board's NVS;
vanetza-idf's security entity signs every secured message there (IEEE 1609.2 / ETSI TS 103 097, the station's security entity signs every secured message there (IEEE 1609.2 / ETSI TS 103 097,
ECDSA NIST P-256). The phone never holds a key and never signs. ECDSA NIST P-256). The phone never holds a key and never signs.
- **The phone decides what to send and when.** It builds CAM or VAM (UPER) from its own GNSS/IMU, - **The phone decides what to send and when.** It builds CAM or VAM (UPER) from its own GNSS/IMU,
hands each message to the board with the flag "signed" or "unsigned", and keeps the board's clock hands each message to the board with the flag "signed" or "unsigned", and keeps the board's clock
and position current. and position current.
- **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 the colleague's station-link protocol v1 plus one MicrOBU extension for reception. 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.
- **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
@@ -35,73 +37,72 @@ fit together, how it was verified, and what is still open. Hardware checks still
## Firmware (obu-firmware) ## Firmware (obu-firmware)
obu-firmware is now a port of `microbu-esp32c5/firmware`, from the colleague's own repository obu-firmware is Niklas Dathe's `microbu-firmware` (commit e4e4bd8, HAW GitLab, not part of this
(not part of this one; nothing is pushed there). The C-ITS library it needs is copied into this repository; nothing is pushed there) with the MicrOBU additions: `main/`, `components/microbu_v2x`,
repository as `obu-firmware/external/vanetza-idf` (their commit cf4b99f, unchanged), so `components/vanetza` and the patched `external/vanetza` are copied in unchanged, so obu-firmware builds
obu-firmware builds from a plain clone. It builds from a plain clone. It builds with **ESP-IDF 6.0.2 only**: the raw-TX path uses private Wi-Fi driver
with **ESP-IDF 6.0.2 only**: the raw-TX path uses private Wi-Fi driver structures that vanetza-idf structures that `microbu_v2x` pins to that version. Setup and flashing: `obu-firmware/FLASHING.md`.
pins to that version. The previous C firmware (IDF 6.1) is backed up as a full flash image in Design notes and every deviation from Niklas Dathe's code (`MicrOBU:` in the sources):
`firmware-backups/` (gitignored, restore command in its README.txt); its sources stay on disk, `obu-firmware/NOTES.md`. The earlier port (vanetza-idf, 2026-09-23) and the previous C firmware are in
unbuilt. Setup and flashing: `obu-firmware/FLASHING.md`. Design notes and every deviation from the git history (`1c3a66e`, `7285fa1`).
colleague's code (`MicrOBU:` in the sources): `obu-firmware/NOTES.md`.
Main changes against the colleague's firmware: Main changes against Niklas Dathe's firmware:
- **Raw receive path kept.** vanetza-idf decapsulates strictly and would drop unsigned frames (the - **Raw receive path kept.** The stack decapsulates strictly and would drop unsigned frames (the
bench car) and anything not signed under the demo root (every RSU). Every captured frame also bench car) and anything not signed under the demo root (every RSU). Every received frame also
goes through the previous firmware's `gn_unwrap.c` and reaches the phone as link opcode goes through `gn_unwrap.c` and reaches the phone as link opcode `V2X_RX` (**0x90**; 0x85 is the
`V2X_RX` (0x85), whose body is the old `SERIAL_MSG_V2X_RX` payload. spec's RAW_FRAME), whose body is the old `SERIAL_MSG_V2X_RX` payload.
- **Unsigned sending kept.** The colleague's station refuses unsecured requests; here they go out - **Unsigned sending kept.** Niklas Dathe's station refuses unsecured requests; here they go out
with the previous firmware's `geonet.c` header. with `geonet.c`'s header and a random MAC per configuration.
- **Console on UART0** (GPIO11/12; the earlier two-port bench board had a CH343 bridge there, COM3); - **Production board: Seeed XIAO ESP32-C5** (8 MB flash, a single native USB-C port) running from a LiPo
the native USB port carries only link frames. The production board is now a **Seeed XIAO ESP32-C5** on its BAT pads. The log travels as LOG frames on the USB link (no UART adapter needed).
(8 MB flash, a single native USB-C port, COM10 on the bench) running from a LiPo on its BAT pads. - **Battery:** the XIAO's divider (GPIO6, enabled by GPIO26) is read every 5 s and reported in STATUS
- **Battery:** the XIAO's own divider (GPIO6, enabled by GPIO26) is read every 5 s and sent in STATUS (`battery_mv`, octets 129-130); the app shows the voltage, a rough percentage and a low (3.50 V) /
(`battery_mv`, `battery_flags`, octets 103-105); the app shows the voltage, a rough percentage and a critical (3.30 V) warning on the ESP32-C5 card and in the top bar. Below 3.30 V with no phone on USB
low/critical warning on the ESP32-C5 card and in the top bar. Below 3.30 V with no phone on USB the the board deep-sleeps, because the prototype cell has no protection board. See `obu-firmware/FLASHING.md`.
board deep-sleeps, because the prototype cell has no protection board. See `obu-firmware/FLASHING.md`. - **BLE and ITS-G5** share one RF front end. Niklas Dathe's TX guard (`CONFIG_MICROBU_TX_BLE_GUARD`)
- **BLE pauses advertising while USB is in use** (BLE and ITS-G5 share one RF front end). holds a frame out of the BLE connection-event windows; the earlier "pause advertising while USB is
in use" is gone.
- **NVS 80 KB instead of 24 KB**, app at 0x20000. At 24 KB the BLE bond could not be stored and the - **NVS 80 KB instead of 24 KB**, app at 0x20000. At 24 KB the BLE bond could not be stored and the
phone had to pair on every connection. phone had to pair on every connection.
- Fixes found on the bench: radio queue drained before the first PoTi (no RX, ~177 queue drops - Fixes carried over from the bench: radio queue drained before the first PoTi; 2.4 KB RX buffer off
before); station loop waited 0 ticks at 100 Hz and starved the idle task; 2.4 KB RX buffer moved the Wi-Fi task stack; serial writes skipped when no USB host is present; manual country policy.
off the Wi-Fi task stack; no silent truncation of BLE notifications; ATT MTU 517; serial writes
skipped when no USB host is present.
## Link protocol ## Link protocol
Station-link v1 (colleague's repository, `station-link/README.md`): `[opcode][flags][sequence LE][body]`, Station-link, revision 2 (`obu-firmware/docs/station-link.tex`; revision 1 is Niklas Dathe's): `[opcode][flags][sequence LE][body]`,
little-endian, at most 512 octets. Over USB each message is one `0xAA55` frame of type `0x10` little-endian, at most 512 octets (bodies above that are fragmented by the spec; this app never needs it). Over USB each message is one `0xAA55` frame of type `0x10`
(the old framing and CRC). Over BLE each message is one GATT value on service (the old framing and CRC). Over BLE each message is one GATT value on service
`0000C175-BA5E-4C17-8000-00805F9B34FB` (the README describes a different, Nordic-UART layout; the `0000C175-BA5E-4C17-8000-00805F9B34FB` (the README describes a different, Nordic-UART layout; the
firmware is what counts). firmware is what counts; the current spec table lists the same UUIDs).
| Direction | Message | Used for | | Direction | Message | Used for |
|---|---|---| |---|---|---|
| phone → board | `STATION_CONFIGURE` | pseudonym MAC, station type, channel 180, 20 dBm; starts the radio | | phone → board | `STATION_CONFIGURE` | station type, channel 180, 20 dBm (6 octets); starts the radio |
| phone → board | `CREDENTIALS_PROVISION` | the demo bundle, once, when the board reports no ticket | | phone → board | `CREDENTIALS_PROVISION` | the demo bundle, once, when the board reports no ticket |
| phone → board | `POTI_UPDATE` | position and ITS time, once per new GNSS fix | | phone → board | `POTI_UPDATE` | position and ITS time, once per new GNSS fix |
| phone → board | `BTP_DATA_REQUEST` | one CAM (port 2001, psid 36) or VAM (port 2018, psid 638), signed or not | | phone → board | `BTP_DATA_REQUEST` | one CAM (port 2001, psid 36) or VAM (port 2018, psid 638), signed or not |
| board → phone | `RESULT` | answer to a request | | phone → board | `STATUS_REQUEST` | once a second; the answer is the heartbeat |
| board → phone | `STATUS` | every second: counters, tickets, signed/refused counts | | board → phone | `CONFIRM` | answer to a request; for `STATUS_REQUEST` its detail is the 131-octet snapshot: counters, tickets, signed/refused counts, battery |
| board → phone | `V2X_RX` (0x85, MicrOBU) | every ITS message heard on air | | board → phone | `V2X_RX` (0x90, MicrOBU) | every ITS message heard on air |
The app side is `Esp32Link.kt` (session), `StationLink.kt` (codec, pinned by unit tests to bytes The app side is `Esp32Link.kt` (session), `StationLink.kt` (codec, pinned by unit tests to bytes
from the colleague's Python implementation), `UsbSerialTransport.kt` and `BleLinkTransport.kt`. from Niklas Dathe's Python implementation), `UsbSerialTransport.kt` and `BleLinkTransport.kt`.
A board still on the previous firmware is recognised by its old heartbeat and keeps working for A board still on the previous C firmware is recognised by its old heartbeat and keeps working for
CAM over USB. CAM over USB. The app does not rotate the board's MAC any more (STATION_CONFIGURE has none): a signed
station takes its address from the ticket, an unsigned one draws a random MAC per configuration.
## Redundancy and recovery ## Redundancy and recovery
| Situation | What notices | What happens | | Situation | What notices | What happens |
|---|---|---| |---|---|---|
| USB link dead (board hung, cable) | app watchdog: no frame for 3.5 s (the board's `STATUS` comes every second) | link marked ERROR on the card | | USB link dead (board hung, cable) | app watchdog: no frame for 3.5 s (the app polls `STATUS` every second) | link marked ERROR on the card |
| USB unplugged | Android detach broadcast | port closed; Connect again after re-plugging | | USB unplugged | Android detach broadcast | port closed; Connect again after re-plugging |
| BLE link lost | BLE supervision timeout (4 s) | app reconnects by itself: 1 s after a drop, then backing off to 30 s if attempts fail | | BLE link lost | BLE supervision timeout (4 s) | app reconnects by itself: 1 s after a drop, then backing off to 30 s if attempts fail |
| Board reset / power cycle | first `STATUS` says "not configured" | app reconfigures (and re-provisions if needed) without user action | | Board reset / power cycle | first `STATUS` reply says "not configured" | app reconfigures (and re-provisions if needed) without user action |
| App closed and reopened | new session | app configures the board again; BLE reconnects with the stored bond, no passkey (confirmed) | | App closed and reopened | new session | app configures the board again; BLE reconnects with the stored bond, no passkey (confirmed) |
| Phone clock or GNSS time jumping | app tracks the board's clock | PoTi never moves it backwards (except a real correction of ≥ 60 s), so the board does not restart its stack | | Phone clock or GNSS time jumping | app tracks the board's clock | PoTi never moves it backwards (except a real correction of ≥ 60 s), so the board does not restart its stack |
| Board firmware wedged | ESP task watchdog (30 s, logs on COM3) | the phone sees it as a dead link (above) | | Board firmware wedged | ESP task watchdog (30 s) | the phone sees it as a dead link (above) |
## App changes ## App changes
@@ -117,14 +118,14 @@ CAM over USB.
## Credentials (demo PKI) ## Credentials (demo PKI)
`app/src/main/assets/demo-chain.vcr`, generated 2026-09-23 with the colleague's `vidf_issue`: root `app/src/main/assets/demo-chain.vcr`, generated 2026-09-23 with Niklas Dathe's `vidf_issue`: root
`6E7D0374FB021901` → AA `B3312F29844299E0` → AT `B80B49387A4C12EB` (two years; psid 36 SSP `010000`, `6E7D0374FB021901` → AA `B3312F29844299E0` → AT `B80B49387A4C12EB` (two years; psid 36 SSP `010000`,
psid 638 SSP `01`). It is throwaway and not EU-registered; its private key ships with the app on psid 638 SSP `01`). It is throwaway and not EU-registered; its private key ships with the app on
purpose. The colleague's own demo chain only grants psid 638 and cannot sign CAMs. purpose. Niklas Dathe's own demo chain only grants psid 638 and cannot sign CAMs.
## Verification ## Verification
- **Unit tests** (103): VAM bytes against asn1tools, station-link messages against the colleague's - **Unit tests** (103): VAM bytes against asn1tools, station-link messages against Niklas Dathe's
Python encoder, VAM generation rules. Python encoder, VAM generation rules.
- **Signatures on air**: `obu-firmware/test/verify_signed_pcap.py` checks a pcap with asn1tools - **Signatures on air**: `obu-firmware/test/verify_signed_pcap.py` checks a pcap with asn1tools
and OpenSSL, sharing no code with the firmware. Pinger capture of 2026-09-23: 12/12 signed CAMs, and OpenSSL, sharing no code with the firmware. Pinger capture of 2026-09-23: 12/12 signed CAMs,
@@ -132,7 +133,7 @@ purpose. The colleague's own demo chain only grants psid 638 and cannot sign CAM
- **Third-party stack**: the CiT One receives the signed CAMs (~1 Hz on `v2x/rx/cam`), so its - **Third-party stack**: the CiT One receives the signed CAMs (~1 Hz on `v2x/rx/cam`), so its
stack unwraps our envelope. Its MQTT interface exposes no security information, and it forwards stack unwraps our envelope. Its MQTT interface exposes no security information, and it forwards
unsigned and unknown-root messages alike, so it cannot tell whether it verified the signature. unsigned and unknown-root messages alike, so it cannot tell whether it verified the signature.
- **V2X2MAP (COM10)**: now the colleague's v2x2map 0.3.0 bridge from source with a new - **V2X2MAP (COM10)**: now Niklas Dathe's v2x2map 0.3.0 bridge from source with a new
`verify.py` and `--trust demo-chain.vcr`; it shows "signature verified", "SIGNATURE INVALID" or `verify.py` and `--trust demo-chain.vcr`; it shows "signature verified", "SIGNATURE INVALID" or
"not verified" per packet. Signed CAMs and signed VAMs verified live; a one-bit change in a "not verified" per packet. Signed CAMs and signed VAMs verified live; a one-bit change in a
signed CAM comes out invalid. Launcher: `micrOBU_workspace/v2x-obu-esp32c5/start-v2x2map-signed.bat`. signed CAM comes out invalid. Launcher: `micrOBU_workspace/v2x-obu-esp32c5/start-v2x2map-signed.bat`.
File diff suppressed because one or more lines are too long