Rebuild obu-firmware on Niklas Dathe's microbu-firmware
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.
This commit is contained in:
@@ -1,83 +1,83 @@
|
||||
menu "micrOBU firmware"
|
||||
config MICROBU_TEST_CHANNEL
|
||||
bool "Test channel on the serial link (software lower tester, ETSI campaign hooks)"
|
||||
choice MICROBU_BOARD
|
||||
prompt "Board"
|
||||
default MICROBU_BOARD_MAINBOARD_V5
|
||||
config MICROBU_BOARD_MAINBOARD_V5
|
||||
bool "micrOBU mainboard v5"
|
||||
config MICROBU_BOARD_XIAO_C5
|
||||
bool "Seeed XIAO ESP32-C5"
|
||||
endchoice
|
||||
config MICROBU_XIAO_C5_BATTERY
|
||||
bool "XIAO ESP32-C5 battery voltage monitor (GPIO6/26)"
|
||||
depends on IDF_TARGET_ESP32C5 && MICROBU_BOARD_XIAO_C5
|
||||
default y
|
||||
help
|
||||
Serves serial frame type 0x11: mirror or divert every AL_DATA.request the stack
|
||||
makes to the tester, inject AL_DATA.indication, GN-DATA.request for the
|
||||
Security ATS. Not part of the phone interface; disable for a production image.
|
||||
config MICROBU_LOG_OVER_LINK
|
||||
bool "Also carry ESP_LOG output as LOG frames (0x7F) on the native USB link"
|
||||
Calibrated ADC voltage through the onboard 100k/100k divider.
|
||||
Disable when building for another board. No percentage or charging state is inferred.
|
||||
config MICROBU_STATUS_LED
|
||||
bool "Drive the TX/RX indication LED"
|
||||
default y if MICROBU_BOARD_XIAO_C5
|
||||
default n
|
||||
help
|
||||
The colleague's single-port board has no other place for its log. This board keeps
|
||||
the console on UART0 (the CH343 bridge port), so the phone's link carries no text.
|
||||
config MICROBU_BLE_USB_IDLE_MS
|
||||
int "USB link idle time before BLE advertising resumes (ms)"
|
||||
range 1000 60000
|
||||
default 3000
|
||||
help
|
||||
BLE and the 5.9 GHz radio share the C5's single RF front end. While the phone is
|
||||
using the USB link (any frame received within this window), BLE advertising is
|
||||
stopped so it cannot take airtime from ITS-G5. An existing BLE connection is left
|
||||
alone. The phone sends a PoTi update with every GNSS fix, which keeps the window
|
||||
open for as long as it is connected over USB.
|
||||
Disable for power measurements and on boards whose GPIO27 is not a plain LED
|
||||
(ESP32-C5-DevKitC-1: addressable RGB LED and strapping pin). The GPIO is then never touched.
|
||||
config MICROBU_TX_LED_GPIO
|
||||
int "Active-low activity LED GPIO (-1: none)"
|
||||
range -1 28
|
||||
default -1
|
||||
int "Active-low transmit LED GPIO"
|
||||
depends on MICROBU_STATUS_LED
|
||||
range 0 28
|
||||
default 27
|
||||
help
|
||||
The colleague's XIAO ESP32-C5 has its yellow user LED on GPIO27. On this project's
|
||||
board GPIO27 is not a plain LED, so the indicator is off unless configured.
|
||||
GPIO27 drives the on-board yellow user LED on the XIAO ESP32-C5.
|
||||
config MICROBU_TX_LED_BLINK_MS
|
||||
int "LED indication pulse (ms)"
|
||||
range 10 2000
|
||||
default 100
|
||||
help
|
||||
Duration in milliseconds for the LED visual indication (pulse on for TX, pulse off for RX).
|
||||
config MICROBU_LED_INVERTED_RX
|
||||
bool "Inverted LED mode for receiver/bridge (normally ON, blink OFF on packet)"
|
||||
default n
|
||||
config MICROBU_BENCH_LISTEN
|
||||
bool "Bench listener: receive from boot and log every V2X_RX on the console"
|
||||
depends on MICROBU_STATUS_LED
|
||||
default n
|
||||
help
|
||||
For a test board whose PC connection is only the UART0 console (no phone, no USB
|
||||
Serial/JTAG link): the station configures itself at boot with the radio receive only and
|
||||
security off, and logs one line per ITS message the raw path (gn_unwrap.c) unwraps: BTP
|
||||
port, messageID, length, RSSI, signed, GeoBroadcast, and whether it fits a link message.
|
||||
A phone that configures the station later replaces this configuration. Never enable it in
|
||||
the production image.
|
||||
config MICROBU_BATTERY_ADC_GPIO
|
||||
int "Battery voltage ADC GPIO (-1: no battery monitoring)"
|
||||
range -1 6
|
||||
default 6
|
||||
When enabled, the LED stays constantly ON and blinks OFF briefly whenever a packet is
|
||||
received (useful for bridge and receiver nodes). When disabled, the LED stays OFF and
|
||||
blinks ON briefly whenever a packet is disseminated (sender mode).
|
||||
config MICROBU_BLE_PASSKEY
|
||||
int "Station BLE pairing passkey (0 disables BLE)"
|
||||
range 0 999999
|
||||
default 123456
|
||||
help
|
||||
The XIAO ESP32-C5 reads its battery on GPIO6 (BAT_VOLT_PIN) through two 100 k resistors.
|
||||
config MICROBU_BATTERY_EN_GPIO
|
||||
int "Battery divider enable GPIO"
|
||||
range 0 28
|
||||
default 26
|
||||
Override the public default with a random six-digit passkey per station.
|
||||
Supply it to the owner separately. It is never advertised or logged.
|
||||
BLE does not require secure boot or flash encryption. The bond is kept
|
||||
in NVS. This firmware rejects build settings that could program eFuses.
|
||||
config MICROBU_BLE_ADVERTISE_AT_BOOT
|
||||
bool "Start BLE advertising at boot"
|
||||
default y
|
||||
help
|
||||
XIAO ESP32-C5: GPIO26 (BAT_VOLT_PIN_EN) switches the divider on for the reading.
|
||||
config MICROBU_BATTERY_SCALE_PERMILLE
|
||||
int "Battery reading trim (1000 = none)"
|
||||
range 800 1200
|
||||
default 1000
|
||||
Disable for power measurements driven over USB: the board then stays silent on BLE
|
||||
until a serial RAW_CAPTURE request switches advertising back on.
|
||||
config MICROBU_TX_BLE_GUARD
|
||||
bool "Hold ITS-G5 frames out of BLE connection events"
|
||||
default y
|
||||
help
|
||||
Multiplies the reading. Compare the STATUS battery voltage with a multimeter on the cell
|
||||
and set this to 1000 * multimeter / reading if the divider or ADC is off.
|
||||
The C5 shares its RF between BLE and ITS-G5: a frame handed to the driver while a BLE
|
||||
connection event holds the RF is accepted but never sent. The station delays such a frame
|
||||
to the end of the calibrated connection event window (main/tx_policy.hpp). Disable only
|
||||
to measure the losses without it.
|
||||
config MICROBU_BATTERY_WARN_MV
|
||||
int "Low-battery warning below this cell voltage (mV)"
|
||||
range 3000 4200
|
||||
default 3500
|
||||
config MICROBU_BATTERY_SHUTDOWN_MV
|
||||
int "Shutdown below this cell voltage (mV), see battery_monitor.hpp"
|
||||
int "Shutdown below this cell voltage (mV), see battery_policy.hpp"
|
||||
range 3000 4200
|
||||
default 3300
|
||||
help
|
||||
There is no protection board on the prototype cell, so this is the only guard against
|
||||
over-discharge. The board shuts down (deep sleep) once the smoothed voltage has stayed below
|
||||
this for 30 s and no phone is talking over USB; it checks the cell again every
|
||||
MICROBU_BATTERY_SLEEP_S and runs again from 3600 mV.
|
||||
MICROBU_BATTERY_SLEEP_S and runs again from MICROBU_BATTERY_RESUME_MV.
|
||||
config MICROBU_BATTERY_RESUME_MV
|
||||
int "After a shutdown, run again at or above this cell voltage (mV)"
|
||||
range 3300 4200
|
||||
|
||||
Reference in New Issue
Block a user