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.
Phase 1 of GNSS/IMU sensor fusion: record what the filter needs, so it can
be built and tuned offline against real rides before it changes anything
on air (docs/07-sensor-fusion-logging.md).
Settings > Ride replaces Units, whose metric switch did nothing (the app is
metric throughout). It holds the phone position (handlebar, bag or pocket),
written into every V2X log as meta.phone_mount, and "Record motion
sensors", off by default.
With that switch on when a V2X log starts, the log (schema 2, file name
ending in _imu-<mount>) also records:
- accelerometer, gyroscope and gravity at 100 Hz into a new imu table, each
sample with its own SensorEvent timestamp, collected on a background
thread;
- raw GPS_PROVIDER fixes as gnss source phone_gps, next to the fused
location, and for every phone fix its monotonic time, speed and bearing
accuracy and provider;
- the monotonic, wall and GNSS clocks once a second into a new clock table,
to line all timestamps up afterwards and show any phone clock step;
- the sensors' names and rates and the GNSS chip in meta.
Both settings are read once at the start, so one log is one mount and one
mode. The logger screen shows the mount, the motion sensor row count and
the raw GPS fix age while it runs.
tools/fusion_log_check.py checks a recorded log (sensor rates and gaps, both
phone sources, clock alignment and steps) and ends in PASS, WARN or FAIL.
Tested on synthetic logs built from V2xLogWriter's own table definitions;
the bench and ride checks on the Pixel 9 Pro are in TODO.
Both JSON parsers returned null for every real CiT One message, checked
against the logged runs:
- ObuGnssParser read everything from own_info, but obu_gnss keeps the
position, speed, heading and acceleration under gnss (as its API document
shows). So on the CiT One the ego state never came from obu_gnss, the own
station ID was never learned from it, and the V2X logger wrote no OBU
fixes. Kinematics now come from gnss and identity, yaw rate and vehicle
size from own_info. The documented no-fix (91/181) and invalid-speed
(163.82) markers are rejected.
- CamParser only took stationType as a number, but the CAM topic sends the
name ("passengerCar"), so the processed CAM fallback was dead. Names are
now mapped too, and the vehicle size is read from vehicleLength_m and
vehicleWidth_m, the keys actually sent.
The name table moves from DenmEvent into StationType.fromApiName so the
DENM and CAM parsers share one copy. The tests use payloads with the keys,
nesting and types of the logged ones.
YawRateValue is positive to the left (degSec-000-01ToLeft(1), TS 102 894-2),
while Cam.yawRateDps is positive clockwise, to the right, which is what the
use-case engine and its heading-trend fallback assume. CamUperCodec used the
value as it is in both directions, so every CAM this phone sent showed a
standard receiver the opposite turn, and received CAMs were read the wrong
way round in turn detection. It now negates on encode and decode. The
expected bytes for a right turn in CamEncodeGoldenTest come from asn1tools,
not from this encoder.
The CiT One's CAM topic (v2x-uca/output/json/cam) is left-positive too, as
its API document says and as 316 of 316 turning samples in the logged runs
confirm, so CamParser negates as well. Its obu_gnss topic is documented as
left-positive but sends yawRate_degps right-positive in practice (27 of 27
turning windows in the 2026-03-18 bacospat log), so ObuGnssParser keeps the
value and now reads that documented key, which it used to miss.
The phone's CAM and VAM used the gyroscope's z axis as the yaw rate. That
is rotation about the screen's normal, so it only matched the bike's
turning with the phone flat, screen up: tilted on a handlebar it read about
64 % at 50 degrees, upright close to nothing. The gyroscope is now projected
onto gravity (TYPE_GRAVITY), which gives the rotation about the true
vertical however the phone is held, averaged over 100 ms. Gyroscope and
gravity run at SENSOR_DELAY_GAME for this; the yaw rate used to come from a
single sample at SENSOR_DELAY_UI.
Fixes now carry their own monotonic time (Location.getElapsedRealtimeNanos),
speed and bearing accuracy and provider, and sensor samples their own
SensorEvent.timestamp. What goes on air is the GNSS time of the fix itself,
from its monotonic age (GnssTimeSource.atElapsedRealtime), so neither the
phone's clock setting nor a step of it between the fix and transmission
reaches the CAM or GN timestamps. The loop's own intervals (elevated rate,
VAM generation rules) and the GNSS speed differencing for acceleration use
the monotonic clock too, so a clock set back can no longer hold VAMs off.
This is phase 0 of GNSS/IMU sensor fusion: YawRateEstimator is the first
piece of domain/fusion. Unit-tested; the bench and ride checks are in TODO.
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.
Settings > Connection > ESP32-C5 > Receive path chooses where received ITS messages come from.
V2X_RX (default) is the MicrOBU extension the board builds with gn_unwrap.c. Raw frames is the
station-link RAW_FRAME debug capture: the app switches RAW_CAPTURE on (mode 3), reassembles
fragmented link messages as the spec defines (LinkReassembly), parses the ITS5 record
(RawFrame) and unwraps the 802.11 frame with GnUnwrap, a Kotlin port of gn_unwrap.c. Both end
as the same V2X_RX frames, so nothing above the link changes, and the firmware keeps both.
GnUnwrapTest checks the port against the C code on 602 recorded, cut and corrupted frames
(corpus from obu-firmware/test/host: make corpus). 145 app tests. Fix the Connection text that
claimed the app picks the strongest micrOBU.
The new table ended its rows with a single backslash, which gave 'Extra alignment tab'
errors and a broken layout. Built with two pdflatex passes, so the footer shows the page
count (24). The remaining 'infinite glue shrinkage in box being split' messages are the
same harmless kind Niklas Dathe's original produces.
Document the MAC rotation (16-octet STATION_CONFIGURE), the ATT MTU of 517, the battery
reading fix, pairing and bonds with several boards, tools/station_tx_test.py, what was
dropped from the earlier MicrOBU version and what Niklas Dathe's latest firmware added,
and the measured results (BLE adds no transmit loss over USB). Test counts: 40 firmware,
131 app.
The app requests 517 and needs 515 for a 494-octet V2X_RX; the station's 512 left a
message of 492 to 494 octets to be fragmented, which the app does not reassemble.
Record the TX-loss measurement in TODO: BLE adds no measurable loss over USB.
The app sends the pseudonym's MAC in the 16-octet STATION_CONFIGURE (address_configuration
0), the station uses it for unsigned frames too, and a different MAC reconfigures the
station. A ride rotates it with the station ID; the bench CAM pinger keeps one. Without a
MAC the station behaves as before (ticket-derived when signed, random when unsigned).
tools/station_tx_test.py plays the phone over USB and reads the station's own raw capture
(source MAC, signed or not, submitted and completed counts). Add the 16-octet form to the
spec (revision 2), a firmware unit test and an app test. Fix the stale Connection texts.
At CONFIG_FREERTOS_HZ=100 pdMS_TO_TICKS(5) is zero ticks, so the switched divider
had not settled when the ADC was read and battery_mv came out as 0. Wait 5 ms with
esp_rom_delay_us and configure GPIO26 with gpio_config. The XIAO on COM10 now
reads 4153-4156 mV on a charging cell.
obu-firmware/README.md follows Niklas Dathe's microbu-firmware README: station
diagram with the MicrOBU raw receive, unsigned transmit and battery paths, a
summary block, build and flash, BLE pairing, host tests and links.
The app README gets an architecture diagram and a summary block, corrects the
pseudonym description for the 2026-11-10 firmware (the link has no MAC field any
more) and the unit test count (130).
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.
CONFIRM replaces RESULT, the status snapshot is polled with STATUS_REQUEST once a
second (131 octets, battery_mv at octet 129; low and critical are derived from the
voltage), STATION_CONFIGURE is the 6-octet form without the pseudonym MAC, and
V2X_RX moves to opcode 0x90. StationLinkTest is updated to the new bytes.
Replace the vanetza-idf port with his current station firmware (microbu-firmware
e4e4bd8: main/, components/microbu_v2x, components/vanetza, external/vanetza) and
re-apply the MicrOBU additions, each marked "MicrOBU:" in the sources:
- V2X_RX (opcode 0x90): every received ITS message, signed or not, through
gn_unwrap.c, because the stack drops unsigned and foreign-root traffic. 0x85 is
the spec's RAW_FRAME and 0x86 is reserved. The body is built in v2x_rx.hpp.
- Unsigned transmission (geonet.c) for security profile 1 or station security 0,
from a random MAC per configuration.
- Radio polled from STATION_CONFIGURE on; manual country policy, TX power
read-back, static RX buffer, short frames ignored.
- Battery guard (battery_policy.hpp): deep sleep below 3.30 V with no phone on USB.
- No USB writes without a host; last_frame_ms() for the guard.
- 80 KB NVS with the app at 0x20000, 8 MB flash, XIAO ESP32-C5 board, 20 dBm.
Remove the old C firmware, the bench listener and the old vanetza-idf copy. Add
docs/station-link.tex as revision 2 of the interface reference (V2X_RX, unsigned
sending, battery rule, revision history). Add 39 host unit tests (make firmware in
test/host) next to the existing chain, replay, fuzz and battery tests, and point
tools/station_status_watch.py at the new CONFIRM-based status.
The README predated the vanetza-idf port. It now describes the ESP32-C5 as
the XIAO running a signing ITS station, the station-link protocol over
USB-C and Bluetooth LE (GATT layout, pairing, reconnect, USB priority),
the raw receive path and its five BTP ports, phone-built CAM or VAM sent
signed or unsigned, traffic lights per lane from SPATEM and MAPEM, the
V2X data logger and the battery display. Architecture, verification,
documentation links, getting started and the known limitations follow
the current code; the version is the build's versionName, 0.1.0.
main.c (the pre-port firmware, kept on disk but no longer compiled) reads
back and logs the TX power the driver actually set instead of trusting
the request. obu-cam-transmistter/NOTES.md drops its stale "Phase 2, in
progress" title.
MapemUperCodec decodes MAPEM (MapData) from the ESP32-C5 (BTP port 2003)
and the CiT One's v2x/rx/mapem topic: intersection and lane names, the
reference point, lane types and directions, all node offset sizes and node
attributes, and each lane's connections with their signal groups. It
returns null on what it cannot size (extensions, regional data, computed
lanes) rather than guess.
TrafficLights.join places SPATEM signal groups on the MAPEM's ingress
lanes, gives each connection its turn (its maneuver, else the lane's, else
the angle between the lanes), picks the MAPEM whose revision the SPATEM
names when two are on air, and matches the rider to an ingress lane from
position and heading. The dashboard card then names the intersection and
shows the rider's lane, the distance to its stop line and one chip per
signal group with its turn arrows; the V2X map puts the light on the
reference point and draws the lanes in their signal colours.
Tested on recorded messages only: every distinct MAPEM on record (17 from
the 2026-03-18 drive, 288-1348 bytes, plus the bench RSU's) decodes field
for field like asn1tools; with a recorded SPATEM of the same intersection
and revision, 340 of 341 signalled exits find their movement (3/165's
group 65 never appears in its SPATEMs), and the geometric turn agrees with
198 of 201 stated maneuvers. tools/mapem_corpus.py rebuilds the fixtures.
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.
The production OBU is now a Seeed XIAO ESP32-C5 (8 MB flash, one native
USB-C port) on a LiPo with no protection board. The firmware reads the
cell on GPIO6 (divider switched by GPIO26) every 5 s, sends it in STATUS
(battery_mv and battery_flags, octets 103-105; decoders accept 103 or
>= 106 octets), warns below 3.50 V and deep-sleeps below 3.30 V when no
phone is on USB, waking every 5 min to check the cell again. Thresholds
are in Kconfig; host test `make battery`.
The app shows voltage, a rough percentage and the low/critical state on
the ESP32-C5 card and in the top bar. With several bonded micrOBUs (a
replaced board stays bonded), the BLE link tries the one that last
connected first and moves on to the next after each failure.
tools/station_status_watch.py reads STATUS from the native port.
The disconnect icon sits next to the map button and dropped the ESP32-C5 or
CiT One link on a single tap. It now opens a standard confirmation dialog first.
Connecting still needs no confirmation.
Checked on a Pixel 9 Pro (ESP32 path): Cancel, Back and rotation keep the link
and the dialog; confirming disconnects.
TimestampIts is TAI-based (TS 102 894-2 V2.5.1), 5 s ahead of UTC. ItsTime
left the leap seconds out, so the PoTi set the micrOBU's clock 5 s behind:
it rejected other stations' VAMs as Invalid_Timestamp and restarted its
stack (time_regression). CAM/VAM generationDeltaTime and the GN TST were
5 s off too.
ItsTime adds the leap seconds (IANA leap-seconds.list) and converts back
for received DENMs. Golden vectors regenerated through asn1tools.
Records every received V2X message (CAM, DENM, SPATEM, MAPEM, VAM) into one
SQLite file per run, with a timestamp, the phone's GNSS fix, the OBU's GNSS fix
where there is one (CiT One), and RSSI where the hardware reports it (ESP32-C5).
Works on both hardware paths: V2X_RX frames from the ESP32 link, and the raw
v2x/rx plus processed v2x-uca topics over MQTT. The UPER bytes are stored
untouched; CAM, DENM and SPATEM also get a few decoded columns.
A foreground service keeps it recording with the screen locked. Subscribes to
v2x/rx/mapem so MAPEM is received on the CiT One.
The current ESP32-C5 firmware forwards only BTP ports 2001, 2002 and 2004, so
MAPEM and VAM appear in an ESP32 log only once it accepts 2003 and 2018.
Checked on a Pixel 9 Pro against a simulated car and an RSU: 10 minutes with the
screen locked and forced deep Doze, no gaps, files pass integrity_check.
Includes ci/upstream/microbu-tests.yml from microbu-tests: a trigger job that runs the test plans affected by the pushed commit (official ETSI TTCN-3 ATS suites for now) and takes their result (strategy: depend), so that "Pipelines must succeed" blocks merging a failing change.
docs/Architecture-signed-its.drawio (with a PNG export beside it, like
Architecture2): PKI (today's demo chain, and dashed the future EU C-ITS path
with the lab's registered root), the phone app's transmit and receive path,
the USB-C and BLE links with their heartbeats, the ESP32-C5 firmware (link
endpoints, session, signing through vanetza-idf with the key in NVS, the
unsigned geonet.c path, radio and raw receive), the ITS-G5 air and the bench
receivers (V2X2MAP with signature check, CiT One, RSU, sim car), and a legend
of the station-link messages and recovery behaviour.
FLASHING.md still described flashing as for the previous firmware. The port
changed the partition table (NVS 24 KB -> 80 KB, app 0x10000 -> 0x20000), so a
board coming from the previous firmware needs its NVS range erased once and a
full flash, not app-flash; without the erase the BLE bond cannot be stored and
the phone pairs on every connection. Documented that, what the boot log and
the app show afterwards (credentials provisioned on first Connect, stale phone
pairings to forget), both ways back to the previous firmware (the backup image,
or commit 7285fa1 built with IDF 6.1), the production board's port (COM3,
UART bridge), the station-link names in the phone and bring-up sections, and
that the build is self-contained with obu-firmware/external/vanetza-idf.
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.
The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
docs/06-signed-its-vam-ble.md: who does what between phone and ESP32-C5
(signing lives on the board), the link protocol, recovery paths (USB
heartbeat watchdog, BLE supervision timeout and auto-reconnect, board-reset
reconfiguration, app restart), the demo PKI, and what is still open.
obu-firmware/test/verify_signed_pcap.py checks the IEEE 1609.2 signatures in
a pcap with asn1tools and OpenSSL, independent of the firmware. On a capture
of the CAM pinger (2026-09-23) all 12 signed CAMs verify under the demo
ticket, whose chain verifies too. The CiT One receives the same CAMs but its
MQTT interface exposes no security information, so it cannot confirm the
signature itself. The V2X2MAP bridge on COM10 now verifies against the demo
chain as well (change in the colleague's repository); signed CAMs and VAMs
show as verified.
TODO.md: bench checks confirmed so far ticked; open are BLE/ITS-G5
coexistence, time_regression over a longer stationary run, and board reset
recovery over BLE.
The app now speaks the station-link protocol of the new obu-firmware.
Esp32Link picks the transport from Settings (UsbSerialTransport or the new
BleLinkTransport), tells the previous firmware from the new one by its
heartbeat, and runs the session: STATION_CONFIGURE with the current pseudonym
MAC (which also starts the board's radio), CREDENTIALS_PROVISION of the
bundled demo chain when the board has no ticket, then per message a
POTI_UPDATE and a BTP_DATA_REQUEST. Received messages still arrive as
V2X_RX frames, so the receive side is unchanged. A board on the previous
firmware keeps working for CAM over USB.
Settings > Connection > ESP32-C5: link USB-C or Bluetooth, transmit CAM or
VAM, "Sign outgoing messages" (on by default). The connection card, top bar
and dashboard show the link in use, the pairing passkey and signing counters.
- VAM: VamUperCodec (TS 103 300-3 V2.3.1, bytes checked against asn1tools)
and VamGenerationRules (clause 6.4, Tables 16/17).
- BLE: the firmware's GATT layout (service 0000C175-...), MTU 517, pairing
and encryption settled before any other operation (short timeouts during
pairing made it loop), backoff between attempts, reasons on the card.
- Clock: a PoTi goes to the board once per new fix and never moves the
board's clock backwards except for a real correction (>= 60 s); stale and
wobbling fix times made the board answer time_regression and restart its
stack every few seconds. GnssTimeSource keeps the last measured phone-clock
error while GNSS time drops out indoors: the bench phone is 14 minutes fast,
and falling back to it made every transmitted timestamp jump by that much.
- assets/demo-chain.vcr: throwaway, not EU-registered demo chain generated
2026-09-23 (AT B80B49387A4C12EB, psid 36 and 638). Its private key ships
with the app on purpose; receivers verifying against the EU trust list
drop what it signs.
- Bluetooth permissions requested at start-up on Android 12+.
StationLinkTest pins the codec to bytes from the colleague's Python
implementation (microbu_link/messages.py). 103 unit tests pass.
obu-firmware is now a port of the colleague's standalone VRU station
(microbu-esp32c5/firmware, kept beside this repository and gitignored): the
vanetza-idf C-ITS stack with the TS 103 097 security entity, credentials in
NVS, the station-link v1 protocol over the native USB port (frame type 0x10
in the existing 0xAA55 framing) and over a BLE GATT peripheral, and its
ITS-G5 radio adapter. The phone still builds CAM and VAM; the board adds
GeoNetworking/BTP and signs with the provisioned authorization ticket. The
private key never leaves the board. Builds with ESP-IDF 6.0.2 only, which
vanetza-idf pins for the radio's private driver ABI. The previous C firmware
stays on disk unbuilt; a full-flash backup of the bench board is kept in
firmware-backups/ (gitignored).
Changed against the colleague's firmware, marked MicrOBU: in the sources:
- Reception unchanged for the app. vanetza-idf drops what it cannot verify
(unsigned traffic, every RSU), so each captured frame also goes through the
previous gn_unwrap.c and reaches the phone as link opcode V2X_RX (0x85),
whose body is the old SERIAL_MSG_V2X_RX payload.
- Unsigned transmission still possible, with the previous geonet.c header;
the phone chooses per message.
- Console on UART0 (CH343 port); the native USB port carries only link frames.
- BLE advertising pauses while the USB link is in use: BLE and ITS-G5 share
one RF front end.
- NVS 80 KB (app at 0x20000). At 24 KB, with Wi-Fi settings the previous
firmware left behind, the BLE bond could not be stored and the phone had to
pair on every connection.
- Bench fixes: the radio queue is drained before the first PoTi (no RX and
~177 queue drops before); the station loop waited pdMS_TO_TICKS(5) = 0
ticks at 100 Hz and starved the idle task; the 2.4 KB RX capture buffer is
off the Wi-Fi task stack; BLE notifications longer than the MTU are dropped
instead of cut short, MTU 517; serial writes are skipped with no USB host.
- Manual country policy and TX-power read-back from the previous radio setup;
logs for BLE encryption changes and the number of stored bonds.
Verified on the bench board (COM3) with the phone over USB and BLE: CAM and
VAM, signed and unsigned, go out; reception of the sim car and the RSU's
CAM/SPATEM/MAPEM continues; the board survives app restarts and reconnects.
See docs/06-signed-its-vam-ble.md.
wifi_promisc_rx_cb() fed s_rx_queue with a 0-timeout xQueueSend() and never
checked whether it succeeded, so a burst of captured frames arriving faster
than rx_forward_task could drain them vanished with no counter anywhere -
none of oversizeDrops/txFailures/rxCrcErrors caught it. Added a rxQueueDrops
counter, threaded it through the STATUS heartbeat as a new trailing uint16
(old firmware/app on either side still parse fine), and surfaced it on the
CAM Pinger card.
Confirmed on the bench: flashed to the production OBU (COM3) and installed
the matching app build on the phone, then watched the counter over logcat
against obu-cam-transmistter's ~3.3 Hz beacon - it is real (0 -> 89 -> 90
across two sessions) but bursty around connect/reconnect rather than a
continuous overflow under steady single-station traffic.
The bench transmitter sent a parked car: one fixed position, speed 0,
no heading, a CAM every second. It now simulates a car driving a loop
through six waypoints around Berliner Tor on the real streets, which
makes it a moving target for the app's map and the use case detection
without taking a car out.
The route is generated, not hand-traced. tools/make_route.py asks the
OSRM demo server for a driving route through the waypoints and back to
the first, thins the 371 street points to 103 (none more than 1.5 m off
the line), and writes main/route_points.h. It also saves OSRM's answer
(--offline rebuilds from it) and a map page to check the route before
flashing. Each waypoint is sent with the direction towards the next one:
without it, points on divided roads such as Beim Strohhause snapped to
the opposite carriageway and the loop came out at 8.4 km of U-turns.
With it the loop is 5.2 km, still including two turn-round detours
that OSRM needs to reach the waypoints legally (Borgfelder Strasse /
Anckelmannsplatz, and Nagelsweg / Norderstrasse / Repsoldstrasse).
Route data (c) OpenStreetMap contributors, ODbL.
main/route.c moves the car along the points. It cruises at 50 km/h and
limits each bend to the speed that keeps sideways acceleration at
2 m/s^2, so a junction turn is taken at about 15 km/h and a gentle curve
barely slows it; braking (2 m/s^2) and acceleration (1.5 m/s^2) are
planned across as many points as a bend needs. A simulated lap on the
host is 5.16 km in 7.7 min, averaging 40 km/h.
CAMs now follow the EN 302 637-2 generation rules instead of a fixed
1 Hz: checked every 100 ms, sent on a heading change over 4 degrees, a
move over 4 m, a speed change over 0.5 m/s, or after 1 s - about 3 Hz
at 50 km/h. generationDeltaTime is milliseconds since boot. The
GeoNetworking source position vector now carries the same speed and
heading as the CAM instead of zeros.
NOTES.md gains build and flash steps (including reading a board's app
descriptor first, since both firmwares name their image
obu_firmware.bin) and a section on the simulated drive. The pointer to
docs/04-transmit-setup.md is corrected: that file is not in the repo.
Flashed to the COM8 board and checked on its console: it starts driving
on power-up and sends CAMs with changing position, speed and heading.
Not yet received over the air.
The map was a third view mode inside the V2X Monitor's topic pane, below
the use case alert panel and the DENM/CAM TX cards. On a phone that left
it about a third of the display tall, which is not enough to see where
anything is relative to anything else - the one thing a map is for. It
is now its own destination, V2xMapScreen on route v2x_map, reached from
a map button in that screen's header. The button sits in the header
rather than the view-mode row so it is also reachable from the message
detail pane and does not move as the available modes change with the
selected hardware. The status bar and bottom nav are hidden on this
route; the screen carries its own floating back button, and system back
still works. Both hardware paths get the same screen: everything drawn
comes from CamUseCaseRepository, which already merges the CiT One's MQTT
feed and the ESP32-C5's serial feed into one set of flows.
With the map gone from the toggle row, the row offers a single choice on
the ESP32-C5 path - there is no broker there and `topics` is always
empty - so it is hidden entirely in that mode.
SPATEM markers. Hazards already drew as a warning triangle; signalised
intersections did not draw at all. They now draw as a traffic light with
one lamp lit. Two things are worth knowing, because neither is forced by
the data:
- SPATEM carries signal state but no geometry, which is MAPEM's job and
MAPEM is not decoded. The only position available is the sending RSU's
own CAM, so the light is drawn there, and that RSU is drawn once - as
the light, not as a CAM pin with a light on top of it. An intersection
whose sender has not been heard over CAM cannot be placed; the map
says how many rather than dropping them silently.
- Which lamp lights follows the rule DashboardScreen's SignalCard
already uses, the signal group changing soonest speaking for the
intersection, so the same intersection reads the same way in both
places instead of inventing a second convention.
Four drawables rather than one tinted at runtime: setTint recolours
every path in a vector, so a single shared asset would turn the whole
light one flat colour and stop it reading as a traffic light.
Marker reuse. Every incoming message recomposes the map, and the update
block cleared the overlay list and rebuilt every Marker, decoding and
mutating a fresh Drawable per marker - at up to 10 Hz per station. It
also called animateTo(own) on every update, restarting the pan animation
before it could finish. Drawables are now loaded once per alert level
and phase and shared (osmdroid sets the icon's bounds on each draw, so
one instance across markers is safe), Markers are cached by key, and the
overlay list is only reordered, which moves references without
allocating. Following uses setCenter, keeping animateTo for the one move
worth seeing: the rider asking for follow back.
Follow-own now hands over to the rider on the first touch and returns
via the location button, which lights up while following. Before this
the map could not be panned at all while traffic was flowing, since the
next CAM dragged the viewport back.
Also on the map view: tiles scaled to DPI, the floating +/- buttons off
(they sit where the thumb lands and duplicate pinch), a zoom range, and
more tile threads so a pan that exposes a screenful of new tiles is not
served two at a time.
Compiles and the unit tests pass. None of it has been seen with live
traffic; TODO.md lists the on-device checks under "Waiting on hardware",
including which of the HAW RSUs send CAM alongside SPATEM.
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Signed packets. A GeoNetworking Basic Header NextHeader of 2 means a
TS 103 097 (IEEE 1609.2) envelope follows, with the Common Header
inside it. gn_unwrap_its rejected all of these, and most real traffic is
signed: the 2026-08-17 capture holds 157 signed frames from 15 source
MACs against 2 unsecured stations. It now opens a COER-encoded
signedData, or a bare unsecuredData, and parses the inner packet as
before. The inner packet comes first inside tbsData, so the certificate
and signature are never parsed, and the signature is not verified - the
firmware has no trust store. Such messages reach the phone with the new
V2X_RX flags bit1, signed but not verified. The app reads only bit0 and
is unaffected until it learns the flag. Encrypted payloads, nested
signing and the legacy v1.2.1 envelope are still rejected. All 157
recorded signed frames have the layout this reads, in all three COER
length forms, and asn1tools decodes every envelope to the same inner
packet.
Payload bounds. Every frame recorded through the ESP32-C5's promiscuous
RX, about 15 000 of them, ends in 8 bytes that are not part of the
802.11 frame and not a valid FCS. obu-firmware reads frames through the
same API and took the rest of the frame as the message, so it forwarded
those 8 bytes to the phone after every message. UPER decoders stop where
the message ends, so nothing visibly broke, but the bytes cost serial
bandwidth and 8 bytes of the DENM's headroom, and they stayed attached
wherever raw payloads were stored or passed on. The payload is now
exactly what the Common Header's payload-length field declares, which is
also what separates a signed message from its signature.
A frame longer than main.c's 800-byte capture buffer is now reported as
truncated instead of being forwarded cut off, and counted as an oversize
drop through the new serial_link_note_oversize_drop, as it was when the
cut-off frame failed serial_link's size check.
Host tests in obu-firmware/test/host build the firmware sources
unmodified with MSYS2 gcc; `make` runs all three.
- test_chain: frames from the firmware's TX code checked byte by byte
against EN 302 636-4-1 and parsed back, including hand-built signed
frames, the payload-length rule, the RX trailer, and every truncation
length against a no-access guard page. 1731 checks, 0 failures.
- test_replay and check_replay.py: all 15 145 recorded frames through
gn_unwrap_its, cut to 800 bytes as on the board, and re-derived
independently in Python with the envelope decoded by asn1tools. They
agree on every record; 15 131 accepted, 157 of them signed. 11 043 of
the 11 106 distinct messages re-encode byte-identically. The other 63
fail the same way with the old 8 bytes put back, so the boundary is
not the cause: 5 are our own CAMs from before the 2026-08-20
yawRateConfidence fix, and the rest, from other stations, are a
follow-up in TODO.md.
- fuzz_gn_unwrap: random edits of every recorded frame, each run against
the guard page. 50 000 000 iterations, no crash.
obu-firmware/test/pcap_gn_tally.py tallies GeoNetworking header fields
per station over captures; it is how the other stations' lifetimes were
measured. TODO.md collects what is still open, including the on-air
check for this change: it builds on IDF 6.1 but has not been flashed.
YawRateConfidence has nine enumerands, degSec-000-01(0) to
unavailable(8) (cdd_1_3_1_1.asn), so UPER needs 4 bits and
"unavailable" is 8. Both firmware copies of cam.c wrote 3 bits with
value 7, which is also the wrong symbol (outOfRange), and every field
after it shifted by one bit. The app's CamUperCodec fixed the same line
on 2026-08-20; these two copies were missed.
obu-cam-transmistter compiles its cam.c, so a board running that bench
beacon sent CAMs no standards-compliant station could decode.
obu-firmware's copy is reference only - it is not in SRCS, since the
phone encodes the CAM - and is kept in step because the app's encoder
was ported from it. The production OBU runs obu-firmware and was never
affected.
Every other field width was compared against CamUperCodec.kt and
matches. Checked with asn1tools against asn1/cam_1_4_1.asn and
cdd_1_3_1_1.asn: the CAM both fixed copies emit decodes with every
expected value and re-encodes byte-identically, while the version before
this change fails on yawRateConfidence. obu-cam-transmistter builds on
IDF 5.5.4.
geonet_wrap_shb wrote lifetime 0x83, commented as about 60 s. The field
holds the multiplier in its upper six bits and the base in the lower two
(50 ms, 1 s, 10 s, 100 s), so 0x83 is 32 x 100 s = 3200 s. That is over
the 600 s itsGnMaxPacketLifetime a sender may use at all; vanetza
refuses to send such a packet. The byte arrived with the Phase 03 commit
as a placeholder and was never checked against the encoding.
For a single-hop CAM this is non-compliance rather than a functional
fault: nothing stores or forwards an SHB packet, so no receiver acts on
the value, and no dropped CAM was ever traced to it.
0x05 (1 x 1 s) is what every other station in
its-g5-receiver-firmware/recordings sends its CAMs with; the recorded
GeoBroadcast DENMs use 0x79 (30 s). Changed in obu-cam-transmistter's
copy as well. Both firmwares build (IDF 6.1 and 5.5.4), and the
disassembled geonet_wrap_shb of each stores 0x05. Not yet seen on air:
the production OBU still runs the 2026-09-10 build, and the on-air
check is listed in TODO.md.
vanetza is a clone of the open-source ETSI C-ITS stack, kept beside the
project as a reference in the same way as C-ITS-Parser. It is read, not
built, and it carries its own .git, so a plain `git add .` would have
picked it up as an embedded repository.
__pycache__/ appears when obu-firmware/test/host/check_replay.py is
imported rather than run.