Docs and TODO after the MilCAN / NGVA notes (docs/design.adoc "What the military vehicles do"): Silent Watch, Blackout of our own devices, a hardware interlock; the Pi on 12 V only behind a HAT with an STM32C5 (power supervisor, watchdog, the Pi's CAN, 5.1 V / 5 A); the outputs' controller moves to that STM32C5 ("The controller on the Pi's HAT": requests from keypads, mcu-lvgl and maptool, Zephyr, 16 MB flash for MCUboot and a black box; native_sim on SocketCAN first). TODO: can.json curves, multiplexing and warning limits after candinista; the mcu-lvgl panel in the Garmin style; TPMS off the car's CAN; Android Auto with the Pi as the phone (AOA over USB-OTG); a universal STM32C5 board v1 with TCAN1043

This commit is contained in:
randy committed 2026-12-05 16:03:02 +01:00
1 parent cba14300b5
commit 462303eed6
2 files changed
+208 -14

No files matched your search

+124 -7
View File
@@ -381,10 +381,11 @@ communication is lost, a confirmation for dangerous circuits.
What it means for us:
* *maptool is the whole controller*: keypads, relay modules and lights
are I/O; the modes, timers, strobe, interlocks, conditions and LED
colours run in maptool — unless a device has its own firmware for that
function, which is outside our scope.
* *One controller*: keypads, relay modules and lights are I/O; the
modes, timers, strobe, interlocks, conditions and LED colours run in
one place — unless a device has its own firmware for that function,
which is outside our scope. Today that's maptool; it moves to the
STM32C5 on the Pi's HAT (below, "The controller on the Pi's HAT").
* *A binding* = an input (keypad node, key or encoder) + a mode + a
target: an output (a relay or light channel, SDO/RPDO) or a screen
function (zoom, the next profile, the next stop). Bindings live in the
@@ -397,9 +398,9 @@ What it means for us:
* *The LED colour on the screen*: a thin line in the key's LED colour
under the tile or screen key it drives — dim off, full on, blinking red
on a fault — so it's clear which key controls what.
* *Fail-safe*: a Hold output goes off when the keypad or maptool goes
silent; a relay node needs a heartbeat consumer on maptool and its own
safe state.
* *Fail-safe*: a Hold output goes off when the keypad or the controller
goes silent; a relay node consumes the controller's heartbeat and has
its own safe state.
* *Encoders*: a value (dimmer, volume), a changer (profiles, wrap) or a
parameter controller. The interim (Blink Marine style) keypad has 8
keys and 8 encoders: two move the map, one zooms, the rest are bound
@@ -424,6 +425,122 @@ ECUMaster, "How-to Set Up Keyboards with Encoders in PMU" (v1.0,
2026-01-09); ECUMaster USA, CAN keypads with the PMU16; HP Academy, PDM
control pad setup.
=== What the military vehicles do (MilCAN, NGVA; notes, 2026-12-05)
From a chat with Gemini, checked only partly — treat the details as
leads, not facts.
* *MilCAN* (the MilCAN working group, UK): *MilCAN A* on 29-bit
identifiers, J1939-like; *MilCAN B* on CANopen (11-bit). Used for the
vehicle electronics (vetronics: power, lights, panels, keypads), the
engine stays on its own J1939. *NGVA* (NATO Generic Vehicle
Architecture, STANAG 4754) puts Ethernet on top for data and video,
CAN/J1939 stays for the automotive side — close to our maptool + CANopen
split.
* *Connectors*: MIL-DTL-38999, 150–400 € a pair — not for us. Gemini's
"7-pin vetronics pinout" (V+, GND, CAN_H, CAN_L, wake, interlock,
shield) is not a standard we could find; the two extra signals are
still worth having: *a wake line* and *a hardware interlock*.
Dual CAN (A/B on both sides of the hull) is beyond what a car needs.
What we can borrow:
* *Silent Watch* — parked for days on battery: every node asleep at
microamps, woken by a key, the ignition / wake line or a CAN wake-up.
Node side: a transceiver with a wake input and INH (TCAN1043 wakes on
any bus activity, WUP; TJA1145 / TCAN1145 also by a selected frame —
partial networking); STM32 in Stop. For later: whether ESPHome and
our CANopen can sleep and wake that way is unknown, and the node PCBs
have to be designed around the chosen transceiver (its wake pin, INH
switching the regulator). maptool's side: a *Sleep* action
(all outputs to their safe state, nodes to NMT stopped / sleep, the
screen off) and what wakes what.
* *Blackout / camp mode* — only our own devices, one key: keypad LEDs to ~2 % in a dim red,
the screen to Night at its lowest, the auxiliary outside lights
(awning, work lights) off and *inhibited* (the door no longer turns the
awning light on) until it's left. A screen profile + a condition on
the outputs, not a new mechanism. The road lights are the car's own
and stay untouched (the military's blackout keeps dim blackout stop
lights too; on a public road it's not ours to switch).
* *Smart fuses (SSPC)*: nothing new — that's the PDM node (dingoPDM and
the like: high-side switches with current sense, trip on a short, reset
over CAN); its current and faults on the switch tiles and load shedding
by battery voltage are already in the virtual switch panel's TODO.
* *Hardware interlock*: a wire that drops the power outputs (winch,
inverter, heater) even with a hung MCU or a dead bus — a node's own
safe state, maptool only shows it.
*Powering the Pi and the ignition* — two ways:
. *The Pi on the bus*: a 6-pin Deutsch DT — 12 V, GND, CAN H, CAN L, IGN
and one spare (seen like that on another project); the Pi watches IGN
and shuts itself down cleanly a while after the ignition goes off.
. *The Pi on 12 V only* (the usual way, preferred): the car's CAN is
read by *our gateway node*, which tells "the car is running" from the
car's CAN data or from its own IGN input. The Pi then needs only power
(12 V, GND, possibly IGN — a separate connector, like
https://www.reddit.com/r/raspberry_pi/comments/1codbfw/raspberry_pi_for_automotive_applications_update/[r/raspberry_pi,
"Raspberry Pi for automotive applications"]) and can sit anywhere in
the car. A *HAT with an STM32C5* is its power supervisor: it turns the
Pi on when the car runs or when something on the network needs it
(a node, the tablet), asks it to shut down and cuts its power after,
and measures the power (voltage, current, the battery) — later more.
The HAT also carries the Pi's own CAN (a controller on SPI such as the
MCP2518FD + a transceiver, so maptool keeps its `can0`); the STM32C5
sits on the same bus as a node of its own and is the Pi's *watchdog*:
it consumes maptool's heartbeat and power-cycles a Pi that hung.
IGN (or the gateway's "running") is also the simplest wake signal for
the nodes.
The nodes' side (transceiver, wake pin, PROFET board) belongs in
home-gitops `docs/canopen-nodes.adoc`.
=== The controller on the Pi's HAT (decided 2026-12-05)
The outputs' logic leaves maptool for the *STM32C5 on the Pi's HAT*, the
way PDMs (ECUMaster PMU, MaxxECU) keep the keypad and output logic in
themselves rather than on the display.
* *One owner of every output.* The keypads, the `mcu-lvgl` panel and
maptool only send *requests* (toggle, on, off, a level); the controller
decides, drives the output nodes and sends the outputs' state in a TPDO
that everyone draws from. No two devices write to the same relay.
* *It works with the Pi off.* The HAT's STM32C5 runs whenever there are
12 V (it's the Pi's power supervisor and watchdog anyway), so the lights
and the pump work while the Pi boots (20–30 s), hangs or is off at camp.
* *The chip*: the same STM32C5A3CGT6 as the nodes (Cortex-M33, 144 MHz,
1 MB internal flash, two FDCANs, LQFP48) plus the board's 16 MB
external flash. An STM32H was considered and dropped: the controller is
a state machine for a few dozen outputs, an H7 draws far more while the
car stands (the HAT never sleeps fully, Silent Watch), needs a bigger
package and power design, and would be a second MCU family to keep. An
H5 only if the controller ever needs Ethernet.
* *Firmware*: plain Zephyr, not ESPHome (which can't use the external
flash yet). The external flash holds MCUboot's second slot (OTA over CAN
without squeezing the 1 MB), a *black box* — who switched what, faults,
heartbeats lost, the battery voltage — that maptool fetches when it
comes up, so the night at camp can be seen afterwards, the bindings and
scenes with their earlier versions (back to the last good one), and
per-circuit current and on-time statistics.
* *Conditions* come off the bus: speed from the GNSS node, the ignition
from the gateway, the sun computed on the chip; a geofence (the trip's
camp) is a point and a radius sent by maptool.
* *maptool stays* the UI (the switch tiles, `/keypad.html`,
`/sim.html`), the bindings' editor — `bindings.json` written to the
controller (SDO) and kept in its flash — and the screen's own keypad
actions (zoom, pan, menus), which it keeps reading off the bus. Today's
`outputs.rb` stays as the simulator and the reference the firmware is
checked against.
* *A single point of failure*, softened: every relay node has its own safe
state when the controller's heartbeat is lost, and a few key outputs
(the interior light) can have an input of their own on their node.
Order: maptool stays the controller until the firmware is done. First
the messages are fixed — requests, state, configuration as CANopen
objects — so that maptool uses them now and the STM32 later, with no
change to the other nodes.
== Typography
* Planning UI: the system sans; *National Park* (the router-carved