Update and calibration work packages
CONFIDENTIAL. 27 Nov 2026. Register rows: D22 (umbrella), D24 (WP1), D25 (WP2), D26 (WP3), D23 (WP4). Owners and dates: founders decide. The drive firmware starts fresh (~/orbit/firmware is the old Orbit smart-knob project). Main chip is STM32G474 today, final choice open (D2).
Order: agree the flash map first (WP1 + WP4 together), then WP2, then WP3. WP2 can start on a dev board in parallel once the CAN driver works.
WP1: Two-stage bootloader (D24)
- Scope: stage 1 = MCUboot (or equivalent) on the drive MCU: verifies the signed image, keeps two slots (A/B), swaps, rolls back if the new image is not confirmed. Stage 2 = our update app (WP2) that receives images over CAN.
- Deliverables: flash map (bootloader, slot A, slot B or scratch, NVM calibration area from WP4); signing keys and a signing step in the build; confirm-after-self-test; anti-rollback counter; hardware watchdog.
- Feature: automatic reboot. No power cycle or button, ever: the drive jumps to its bootloader by software reset on request (WP2, UDS 0x10/0x11), resets itself after an update, and the watchdog resets a hung image.
- Done when: a signed image installs and boots; a corrupted or unsigned image is refused; an image that fails its self-test rolls back by itself; power cut at any point during an update leaves a bootable drive.
WP2: UDS over CAN, ISO-TP (D25)
- Scope: ISO-TP (ISO 15765-2) on classic CAN and CAN FD; UDS (ISO 14229) server in the drive.
- Services: session control 0x10, ECU reset 0x11, read/write data by identifier 0x22/0x2E, security access 0x27, routine control 0x31 (erase, check signature, self-test), download 0x34/0x36/0x37, read fault codes 0x19, tester present 0x3E. Physical addressing per drive, functional addressing for broadcast.
- Deliverables: data-identifier list (serial, hardware rev, bootloader and app versions, image hash, health counters); fault-code list; a PC test script (e.g. python-udsoncan) that flashes and reads one drive.
- Done when: one drive is flashed over CAN FD from the PC with no manual step; every service answers per ISO 14229; a wrong security key is refused.
WP3: Devicetree and the central-board update module (D26)
- Scope: describe every drive in the robot as a devicetree node and flash all of them from one connection.
- Deliverables: devicetree binding (e.g.
compatible = "apsis,drive",reg= CAN node ID, expected hardware rev and image);dhandleresolution on the central board (Linux or Zephyr); update planner: discover nodes, check identity, flash (broadcast one image to identical drives, each verifies its hash), confirm versions; refuse to flash a joint that is holding load (safe state, torque off); mapping to the robot's ROS 2 joint names. - Done when: a bench with 3+ drives updates with one command; a drive with the wrong hardware rev is skipped and reported; pulling power from one drive mid-update leaves it recoverable and the others updated.
WP4: Calibration in NVM (D23)
- Scope: calibration lives in its own NVM area that firmware updates never touch.
- Deliverables: record format (versioned, CRC, two copies with a sequence counter so a power cut mid-write cannot corrupt it); factory area write-protected, user settings separate; read/write over UDS (WP2), writes behind security access; end-of-line test writes it (E1); migration rule when the record version changes.
- Contents: encoder offset and linearity table, phase R/L/flux, current-sensor offsets and gains, Kt and cogging maps, temperature-sensor calibration, friction and observer parameters (D9), serial number, test-record hash.
- Done when: calibration survives 100 firmware updates and random power cuts during writes; a replacement drive arrives calibrated (E2).