Update the notes, flashing guide and READMEs for the 2026-11-11 bench run
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.
This commit is contained in:
@@ -60,6 +60,18 @@ STATION_CONFIGURE; the app provisions the demo credentials on the first Connect.
|
||||
paired before must forget `micrOBU-XXXX` in Android's Bluetooth settings and pair again (passkey
|
||||
123456, `CONFIG_MICROBU_BLE_PASSKEY`).
|
||||
|
||||
### Pairing, bonds and several boards
|
||||
|
||||
- The name is `micrOBU-` plus the last two octets of the board's BLE address (`micrOBU-66AA` is the production
|
||||
XIAO on COM10, `10:BD:A3:CF:66:AA`). The board keeps **one** bond in NVS and refuses to replace it.
|
||||
- **With no bond the app connects to the first micrOBU it hears.** On a bench with several (2026-11-11: 4AFA, 3FAA,
|
||||
A25E and 66AA all at -49 to -55 dBm) that is not necessarily yours, and it can bond with the wrong board. Pair the
|
||||
right one first in Android's Bluetooth settings (Pair new device, passkey 123456); the app then prefers a
|
||||
bonded micrOBU. Forget a wrong bond there too.
|
||||
- If the phone has lost its bond but the board still holds one, the phone connects and drops again after about 3 s.
|
||||
Erase the board's NVS (`python -m esptool --chip esp32c5 -p COMx erase-region 0x9000 0x15000`) and pair again.
|
||||
- The bond survives a reflash that keeps the NVS and a reset of the board (checked 2026-11-11).
|
||||
|
||||
## Look at the board from the PC
|
||||
|
||||
```powershell
|
||||
@@ -68,7 +80,16 @@ py -3.11 tools/station_status_watch.py COM6 30 --configure --rx
|
||||
|
||||
prints the log, the STATUS snapshot once a second (uptime, signing and radio counters, heap,
|
||||
battery) and the first V2X_RX messages heard on air. DTR/RTS stay low in the script because toggling
|
||||
them resets the board.
|
||||
them resets the board. **Opening the port resets the board** (USB Serial/JTAG), so a phone on BLE is dropped.
|
||||
|
||||
```powershell
|
||||
py -3.11 tools/station_tx_test.py COMx --seconds 60 --mac 02:aa:bb:cc:dd:01 # signed CAMs from a named MAC
|
||||
py -3.11 tools/station_tx_test.py COMx --seconds 60 --unsigned # unsigned, a random MAC
|
||||
```
|
||||
|
||||
plays the phone over USB (configure, position, a CAM request per second) and reads the station's own raw capture, so it
|
||||
prints the 802.11 source address and whether each frame is signed, plus how many frames the radio submitted and
|
||||
completed. Pair it with a second board listening on the air to count what arrives.
|
||||
|
||||
## Production OBU checklist (board with the cell connected)
|
||||
|
||||
@@ -111,7 +132,10 @@ in `test/host`) adds the protection, every 5 s: the smoothed voltage below 3.30
|
||||
60 s after boot and with **no frame from a phone on USB in the last 5 s**, puts the board into deep
|
||||
sleep; it wakes every 300 s, measures, and runs again from 3.60 V. A phone on USB powers the board,
|
||||
so no shutdown happens then. Thresholds: `menuconfig -> micrOBU firmware`. The app shows
|
||||
low/critical from the same voltage and its own thresholds.
|
||||
low/critical from the same voltage and its own thresholds. The first XIAO build read 0 mV because the divider had
|
||||
no time to settle at `CONFIG_FREERTOS_HZ=100` (fixed 2026-11-11, see NOTES.md); it now reads 4.14-4.16 V on a charging
|
||||
cell. There is no calibration trim and no multimeter reference on the glued-in cell: the plateau at full charge
|
||||
should sit near the charger's 4.20 V.
|
||||
|
||||
## If the build fails
|
||||
|
||||
|
||||
+41
-4
@@ -18,7 +18,7 @@ Layout:
|
||||
| `external/vanetza/` | patched upstream Vanetza source (unchanged, see its `UPSTREAM`) |
|
||||
| `docs/station-link.tex` | the link interface reference this firmware and the app implement: **revision 2**, Niklas Dathe's revision 1 plus our extensions (the original PDF is `microbu-firmware/docs/station-link.pdf`; build ours with `pdflatex`, no LaTeX is installed on the lab laptop) |
|
||||
| `cmake/no_efuse_writes.cmake` | build guard: nothing in this firmware may program eFuses |
|
||||
| `test/host/` | PC tests (`make` in that folder): the MicrOBU C code (`gn_unwrap.c`, `geonet.c`), the battery policy and, with `make firmware`, 39 unit tests of the link codec, V2X_RX and the policies |
|
||||
| `test/host/` | PC tests (`make` in that folder): the MicrOBU C code (`gn_unwrap.c`, `geonet.c`), the battery policy and, with `make firmware`, 40 unit tests of the link codec, V2X_RX and the policies |
|
||||
|
||||
Take a newer release from Niklas Dathe by copying `firmware/{main,components,cmake}` and
|
||||
`external/vanetza` over these folders and re-applying the `MicrOBU:` changes (search the sources
|
||||
@@ -62,6 +62,12 @@ custom PCB; pick it in `menuconfig -> micrOBU firmware -> Board`.
|
||||
- **Partition table**: 80 KB NVS (Niklas Dathe's 24 KB filled up and BLE bonds stopped persisting),
|
||||
app at `0x20000`. A plain app-only flash of an older layout is wrong: flash everything.
|
||||
- **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.
|
||||
- **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.
|
||||
|
||||
### Link spec revision 2
|
||||
|
||||
@@ -69,14 +75,45 @@ custom PCB; pick it in `menuconfig -> micrOBU firmware -> Board`.
|
||||
e4e4bd8, kept unchanged as `microbu-firmware/docs/station-link.pdf`) plus a section "MicrOBU extensions": `V2X_RX`
|
||||
(0x90), unsigned transmission (security profile 0x01, or 0x00 with `security` 0; random MAC per configure),
|
||||
the battery shutdown rule, no USB writes without a host, and a revision history. The wire format of
|
||||
revision 1 is unchanged, so a revision 1 host still works. No LaTeX is installed on the lab laptop: build
|
||||
the PDF with `pdflatex station-link.tex` (twice) elsewhere.
|
||||
revision 1 is unchanged, so a revision 1 host still works. Build the PDF with `pdflatex station-link.tex`
|
||||
(twice) and commit it with the `.tex`; the LaTeX build files next to it are ignored. The section "Naming the MAC"
|
||||
documents the 16-octet STATION_CONFIGURE, which revision 1 retires but the station still decodes.
|
||||
|
||||
### Dropped from the earlier MicrOBU version, and why
|
||||
|
||||
The first port (2026-09-23) carried a few things that Niklas Dathe's current firmware makes unnecessary:
|
||||
|
||||
- **Bench listener** (`CONFIG_MICROBU_BENCH_LISTEN`): his `RAW_CAPTURE` / `RAW_FRAME` does the same over the link.
|
||||
- **BLE pauses advertising while USB is in use**: his TX guard now holds each frame out of the BLE connection-event windows.
|
||||
- **Battery flags at STATUS octets 103-105**: his layout puts channel-load fields there; the app derives low (3.50 V)
|
||||
and critical (3.30 V) from `battery_mv` at octet 129.
|
||||
- **The ETSI test channel** and the UART0 console: the log travels as LOG frames on the USB link.
|
||||
- **`CONFIG_MICROBU_BATTERY_SCALE_PERMILLE`**: his battery code has no trim. The XIAO's reading was never compared
|
||||
with a multimeter on the glued-in cell; the app shows 4.14-4.16 V on a charging cell, close to the charger's 4.20 V.
|
||||
|
||||
### What Niklas Dathe's latest firmware added over his earlier one
|
||||
|
||||
The station grew from about 580 to 1,360 lines. From his commit messages (not all of it read line by line): ITS clock
|
||||
slewing, a TX guard against BLE collisions, stale-request refusal (`generated_at_ms`), a pending queue that replaces an
|
||||
unsent VAM with a newer one, Adaptive DCC with channel-busy-ratio measurement, declared radio operating points from
|
||||
EN 302 571 measurements, robust CCA counters and TX retry, heap diagnostics, asn1c tables kept in flash, BLE with no
|
||||
eFuse-based gates, an on-device TS 102 941 client (enrolment and authorisation relayed by the phone, trust bootstrap and
|
||||
update), the `RAW_CAPTURE` debug path, fragmentation of link messages, the XIAO and `mainboard-v5` boards, and the
|
||||
battery reading.
|
||||
|
||||
### Measured on the bench, 2026-11-11
|
||||
|
||||
Production XIAO on COM10, Pixel 9 Pro on BLE, COM3 board as an on-air listener (details and open points in `TODO.md`):
|
||||
the simulated car's CAMs reach the app; signed CAMs from the phone (tickets 1) and unsigned ones are heard by the
|
||||
listener; over USB with BLE off 95.7 % of 300 signed CAMs were heard and over BLE with the screen on 95.7 % of 188, so
|
||||
the BLE link adds no measurable loss; the BLE bond survives a board reset. `tools/station_tx_test.py` plays the phone
|
||||
over USB and reads the station's own raw capture, which shows the 802.11 source address of what leaves the radio.
|
||||
|
||||
### What the new firmware changes for the phone
|
||||
|
||||
See `docs/station-link.tex` (revision history at its end). In short: `RESULT`/`STATUS` became `CONFIRM` (0x80) with the 131-octet
|
||||
status in `CONFIRM.detail` of `STATUS_REQUEST`; STATION_CONFIGURE is 6 octets (type, channel, power,
|
||||
security, beaconing; no MAC, the address derives from the ticket); BTP-DATA.request carries
|
||||
security, beaconing; no MAC unless the 16-octet form names one, else the address derives from the ticket); BTP-DATA.request carries
|
||||
`generated_at_ms` (requests older than 1 s are refused); request bodies up to 1536 and indications up
|
||||
to 65535 octets are fragmented; logs travel as LOG frames (0x7F) on the USB link, so a XIAO needs no
|
||||
UART adapter any more.
|
||||
|
||||
@@ -82,6 +82,7 @@ the board from the PC:
|
||||
|
||||
```powershell
|
||||
py -3.11 tools/station_status_watch.py COMx 30 --configure --rx
|
||||
py -3.11 tools/station_tx_test.py COMx --seconds 60 --mac 02:aa:bb:cc:dd:01 # plays the phone, reads the raw own-TX capture
|
||||
```
|
||||
|
||||
It prints the log, the 131-octet STATUS once a second (uptime, signing and radio counters, heap,
|
||||
@@ -107,14 +108,14 @@ BLE_pairing:
|
||||
The passkey is public, so the link is encrypted but not protected against an active attacker during
|
||||
the first pairing. A phone that was paired before must forget `micrOBU-XXXX` in Android's Bluetooth
|
||||
settings after the board's NVS was erased. BLE and ITS-G5 share one RF front end: the firmware holds a
|
||||
frame out of the BLE connection-event windows (`CONFIG_MICROBU_TX_BLE_GUARD`).
|
||||
frame out of the BLE connection-event windows (`CONFIG_MICROBU_TX_BLE_GUARD`; calibrated for a 20 ms connection interval only). The bond is one per board and survives a reset; with several micrOBUs nearby pair the right one in Android first (FLASHING.md).
|
||||
|
||||
## Tests
|
||||
|
||||
```powershell
|
||||
$env:PATH = "C:\msys64\ucrt64\bin;C:\msys64\usr\bin;$env:PATH"
|
||||
cd obu-firmware\test\host
|
||||
make firmware # 39 unit tests: link codec, STATUS, reassembly, V2X_RX, policies. PASS or FAIL per test
|
||||
make firmware # 40 unit tests: link codec, STATUS, reassembly, V2X_RX, policies. PASS or FAIL per test
|
||||
make # everything: chain, replay of recorded frames, fuzz, battery, firmware
|
||||
```
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
results under "Running". Toolchain: MSYS2 UCRT64 gcc, Option B below (chosen and
|
||||
installed 2026-09-11).
|
||||
|
||||
**Firmware unit tests (`make firmware`, `test_firmware.cpp`, 39 tests):** the station-link codec byte-exact against
|
||||
**Firmware unit tests (`make firmware`, `test_firmware.cpp`, 40 tests):** the station-link codec byte-exact against
|
||||
the app's `StationLinkTest` hex, the 131-octet STATUS offsets, request reassembly, the V2X_RX extension
|
||||
(`main/v2x_rx.hpp`; the 494-octet limit, the 14-octet prefix, TX code -> air frame -> RX path), radio operating
|
||||
points, the BLE TX guard, the ITS clock, CCA counters, BLE security and the battery policy. It prints PASS or FAIL
|
||||
|
||||
Reference in New Issue
Block a user