Run the overnight bench test on the spare board, and document it
Track the bench scripts (run_overnight.py and its stages, the link and ITS client libraries, the phone-vs-node comparison) with the first reports. Changes for the spare XIAO (no cell): - run_overnight.py picks the single Espressif board by default and refuses to test a build that is not this checkout's HEAD. - The unsigned soak stops as "transmit path wedged" after 40 resource_limit refusals in a row and tries whether a repeated STATION_CONFIGURE clears it. - "Refused requests put nothing on the radio" counts only own transmissions; frames heard from other stations are copied by RAW_CAPTURE too. - start_overnight.ps1: optional build and flash, host C tests in the background, Windows kept awake. setup_workstation.ps1 checks and installs git, Python 3.11, pyserial, asn1tools, MSYS2 gcc and make, ESP-IDF 6.0.2. - obu-firmware/docs/overnight-bench-test.tex (and PDF) describe the test, the workstation set-up and the findings of the 2026-11-25 runs.
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,102 @@
|
||||
\documentclass[10pt,a4paper]{article}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lmodern}
|
||||
\usepackage{helvet}
|
||||
\renewcommand{\familydefault}{\sfdefault}
|
||||
\usepackage[a4paper,left=18mm,right=18mm,top=18mm,bottom=18mm,headheight=13pt]{geometry}
|
||||
\usepackage{xcolor}
|
||||
\usepackage{array,longtable,booktabs}
|
||||
\usepackage{fancyhdr,lastpage,needspace}
|
||||
\usepackage[hidelinks]{hyperref}
|
||||
\definecolor{ink}{HTML}{193447}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{4pt}
|
||||
\setlength{\tabcolsep}{1.5mm}
|
||||
\renewcommand{\arraystretch}{1.12}
|
||||
\setlength{\emergencystretch}{3em}
|
||||
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
|
||||
\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\fancyfoot[L]{\footnotesize Overnight bench test of the micrOBU firmware}
|
||||
\fancyfoot[R]{\footnotesize\thepage\ / \pageref{LastPage}}
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
\hypersetup{pdftitle={Overnight bench test of the micrOBU firmware}}
|
||||
\newcommand{\cmd}[1]{\texttt{\small #1}}
|
||||
\begin{document}
|
||||
{\Large\bfseries\color{ink} Overnight bench test of the micrOBU firmware}\par
|
||||
\smallskip
|
||||
Status: 2026-11-25. Scripts: \cmd{obu-firmware/test/bench}. Companion documents: \cmd{obu-firmware/test/bench/README.md}, \cmd{obu-firmware/test/host/README.md}, \cmd{obu-firmware/FLASHING.md}.\par
|
||||
|
||||
\section*{1\quad Purpose}
|
||||
The test checks the integrity and function of \cmd{obu-firmware} on a real board over many hours, without a phone. A PC plays the phone over the USB station link, drives every kind of request, resets and reconfigures the board, listens to the air, and watches the board's own counters and heap. A second, board-free part runs the PC-side C tests and a long fuzz of the receive parser.
|
||||
|
||||
\section*{2\quad Boards}
|
||||
\begin{longtable}{@{}P{22mm}P{32mm}P{108mm}@{}}
|
||||
\toprule\textbf{Port (lab)} & \textbf{Board} & \textbf{Role}\\\midrule\endhead
|
||||
COM10 & XIAO ESP32-C5 with cell & production OBU. Never used for this test.\\
|
||||
\textbf{COM6} & XIAO ESP32-C5, no cell & \textbf{spare board: the board under test}, also taken home.\\
|
||||
COM4 & ESP32-C5 & V2X node (a second station on the air).\\
|
||||
COM8 & CH343 board & simulated car (CAM beacon).\\\bottomrule
|
||||
\end{longtable}
|
||||
The spare's single USB-C port is the chip's native USB Serial/JTAG (VID 303A, PID 1001). \textbf{Opening the port resets the board}, so nothing else may hold it (phone app, \cmd{station\_status\_watch.py}, serial monitor). A board without a cell still reports about 4000\,mV in \cmd{battery\_mv} (the USB charger node), so the battery value cannot tell the spare from the production board: plug in only the spare. The run writes the demo ticket to the board's NVS.
|
||||
|
||||
\section*{3\quad What a run does}
|
||||
Every run starts and ends with the conformance stage, so drift shows as a different result. In between, cycles of about 45 minutes repeat until the time is up.
|
||||
\begin{longtable}{@{}P{30mm}P{132mm}@{}}
|
||||
\toprule\textbf{Stage} & \textbf{What it checks}\\\midrule\endhead
|
||||
conformance & about 100 checks of the link protocol against the specification and the firmware source: opcodes, malformed lengths, fragment reassembly (1536-octet requests, gaps, 2\,s timeout, 8 pending), CRC and resynchronisation, configure and POTI, BTP requests, stale requests, counter wrap.\\
|
||||
soak-unsigned & BTP requests at 4\,Hz, payload 24 to 1480 octets in turn (494 and 495 are the V2X\_RX edge). Every accepted request must leave the radio byte for byte, with the MAC the phone named. 40 refusals (\cmd{resource\_limit}) in a row end the phase as ``transmit path wedged'', and a repeated configure is tried.\\
|
||||
soak-signed & the same at 3\,Hz up to 1200 octets, signed with the demo chain; \cmd{sign\_failed} must stay 0.\\
|
||||
raw-toggle & \cmd{RAW\_CAPTURE} modes 0x00, 0x01, 0x03, 0x05, 0x07 in turn: copies of the station's own frames must appear exactly in the modes with the own-TX bit.\\
|
||||
reconfigure & \cmd{STATION\_CONFIGURE} every second or two with a new MAC, security on or off, radio TX+RX or RX only; the next frame must carry the new MAC and security.\\
|
||||
fuzz & the board is reset, then seeded random frames are sent while it is unconfigured, so nothing reaches the radio. Heap afterwards must be within 8\,KB.\\
|
||||
resets & the port is reopened five times; each time the board must boot, come back unconfigured, configure and transmit.\\
|
||||
idle-listen & radio receive-only, STATUS once a second; counts what else is on the air and checks the receive queue never overflows.\\\bottomrule
|
||||
\end{longtable}
|
||||
\textbf{How a transmitted frame is proven.} One board has no second receiver, so the test uses \cmd{RAW\_CAPTURE} mode 0x05: every frame the station submits to the radio is copied back over the link. The copy is unwrapped by a Python port of \cmd{gn\_unwrap.c} written separately from the firmware, and its ITS payload is compared with what was sent. The payload carries its own size and CRC-32. This does not prove that another station can hear the frame.
|
||||
|
||||
\textbf{On the air.} Transmit phases send at most 4 frames per second at 5\,dBm on channel 180. The payload is a made-up ItsPduHeader with messageID \cmd{0xF1}, which is not an assigned ETSI message, so receivers refuse it. MACs are locally administered, \cmd{02:b3:0a:ce:xx:xx}. \cmd{--no-tx} keeps the radio silent.
|
||||
|
||||
\textbf{PC-side tests} (\cmd{run\_host\_tests\_overnight.ps1}, no board): \cmd{make check} of \cmd{test/host} (chain test, replay of recorded captures, fuzz, battery policy, 40 firmware unit tests, fragments), then the \cmd{gn\_unwrap} fuzzer with new seeds until the time is up. A \cmd{CRASH} line or a non-zero exit is a failure.
|
||||
|
||||
\section*{4\quad Running it}
|
||||
Close everything that holds the port, run \cmd{git pull}, then from the repository root:
|
||||
\begin{center}\small\texttt{powershell -ExecutionPolicy Bypass -File obu-firmware\textbackslash test\textbackslash bench\textbackslash start\_overnight.ps1 -Flash -Hours 8}\end{center}
|
||||
\begin{longtable}{@{}P{34mm}P{128mm}@{}}
|
||||
\toprule\textbf{Option} & \textbf{Effect}\\\midrule\endhead
|
||||
\cmd{-Flash} & builds this checkout with ESP-IDF 6.0.2 and writes it to the board first (first build about 20 minutes: components are downloaded).\\
|
||||
\cmd{-Quick} & about 8 minutes on the board, no host fuzz: does it all work?\\
|
||||
\cmd{-Port COMx} & names the board; the default finds the one Espressif USB board plugged in and refuses if there are several.\\
|
||||
\cmd{-NoTx} & the radio stays silent: protocol, fuzz, resets and idle only.\\
|
||||
\cmd{-NoHostTests} & skips the PC-side C tests.\\\bottomrule
|
||||
\end{longtable}
|
||||
The script keeps Windows awake while it runs. \cmd{run\_overnight.py} refuses a board whose firmware is not this checkout's HEAD (\cmd{--allow-stale-firmware} overrides), because the results would then describe another build. Exit status: 0 if no check failed, 1 otherwise, 2 if the board does not speak the station link.
|
||||
|
||||
\section*{5\quad Setting up the workstation}
|
||||
\cmd{setup\_workstation.ps1 -CheckOnly} reports what is missing; without \cmd{-CheckOnly} it installs it (about 3\,GB, 20 to 40 minutes, internet needed). It can be run again after a failure.
|
||||
\begin{longtable}{@{}P{44mm}P{62mm}P{56mm}@{}}
|
||||
\toprule\textbf{Needed} & \textbf{Why} & \textbf{Installed as}\\\midrule\endhead
|
||||
Git, \cmd{core.longpaths true} & \cmd{git pull}; ESP-IDF paths exceed 260 characters & winget \cmd{Git.Git}\\
|
||||
Python 3.11 (\cmd{py -3.11}) & board tests, \cmd{check\_replay.py} & winget \cmd{Python.Python.3.11}\\
|
||||
\cmd{pyserial} & the station link & \cmd{pip install --user}\\
|
||||
\cmd{asn1tools} & host replay check only & \cmd{pip install --user}\\
|
||||
MSYS2 UCRT64 \cmd{gcc}, \cmd{make} & PC-side C tests & winget \cmd{MSYS2.MSYS2}, then pacman\\
|
||||
\textbf{ESP-IDF 6.0.2}, esp32c5, in \cmd{C:\textbackslash Espressif} & build and flash; exactly this version, because \cmd{components/microbu\_v2x} pins the radio driver ABI to it & \cmd{git clone --branch v6.0.2 --recursive}, then \cmd{install.ps1 esp32c5}\\\bottomrule
|
||||
\end{longtable}
|
||||
Nothing to install for the board itself: the native USB port uses the Windows built-in driver. Internet is needed on the first build (\cmd{espressif/esp-boost}, about 125\,MB, into \cmd{managed\_components/}). \cmd{setup\_workstation.ps1 -PreventSleep} turns off sleep, hibernate, display-off and USB selective suspend on mains power; a suspended USB port drops the board. Pause Windows Update and use mains power.
|
||||
|
||||
Not in git, so absent on a fresh checkout: \cmd{its-g5-receiver-firmware/recordings/*.pcap} (the host replay test then skips itself), \cmd{vanetza/} (\cmd{check\_replay.py} then does not decode the 1609.2 envelopes independently) and \cmd{firmware-backups/}.
|
||||
|
||||
\textbf{Flashing trouble.} If the flash reports ``No serial data received'': unplug the board, hold BOOT, plug in, release, flash again, then unplug and replug without BOOT. If the flasher stub does not start, use the \cmd{--no-stub} recipe in \cmd{FLASHING.md}.
|
||||
|
||||
\section*{6\quad Reading the result}
|
||||
Results go to \cmd{obu-firmware/test/results/overnight-<time>/}: \cmd{report.txt} (read this), \cmd{results.json}, \cmd{status.csv} (STATUS every few seconds), \cmd{device.log}, \cmd{boot.log} (ROM text and panics), \cmd{run.log}. \textbf{FAIL} contradicts the specification, the source or what the radio did. \textbf{WARN} is a disagreeing counter, a heap trend or a version mismatch. \textbf{INFO} is something the source leaves open, with the observed value. A fuzz failure prints its seed; replay it with \cmd{--fuzz-seed N}. Heap leaks are judged per phase over readings without a reset in between (warning below $-2$\,KB per hour, failure below $-20$\,KB per hour), and the lowest heap ever seen must stay above 16\,KB.
|
||||
|
||||
\section*{7\quad Findings so far}
|
||||
\textbf{Overnight run 2026-11-25 (6.3\,h, home workstation, stale build).} The board ran \cmd{1c3a66e-dirty} of 10 November, which predates the pseudonym MAC commit \cmd{3770754}, because the workstation had no ESP-IDF to flash a current build. 1278 checks passed and 802 failed. About 790 failures are the frame source MAC not being the one named in \cmd{STATION\_CONFIGURE}, explained by the stale build. Two things stand out: in 4 of 11 cycles the unsigned soak accepted about 17 requests and then refused all 2383 others with \cmd{resource\_limit} while \cmd{radio\_failed} rose by the same number (heap stayed healthy; a later configure cleared it), and one of 50 resets ended in a boot panic (illegal instruction in \cmd{app\_main}, 0.39\,s after boot). The heap showed no leak (lowest 49\,736 octets). Nothing else was heard on the air.
|
||||
|
||||
\textbf{Quick run 2026-11-25 on the spare, current build \cmd{ce18a39}.} 217 passed, 0 failed, 1 warning (one frame from the board with a bad CRC). The MAC failures are gone. One test bug was fixed on the way: the check ``refused requests put nothing on the radio'' counted frames heard from other stations; it now counts only the station's own transmissions. The wedge and the boot panic were not reproduced in 8 minutes and need the full overnight run.
|
||||
|
||||
\section*{Revision history}
|
||||
Revision 1, 2026-11-25: first version, written with the move of the overnight test to the spare board.
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user