Adapters
Better ScooterFlasher talks to hardware exclusively through OpenOCD. Install a
system OpenOCD (openocd on PATH) — check with scooterflasher doctor.
Voltage warning: all documented targets in this project use 3.3V SWD signaling. Do not connect a 5V-signaling adapter/probe directly; use a level shifter or a 3.3V-native adapter. Better ScooterFlasher does not detect or adjust target voltage — verify your wiring against the scooter's documentation before connecting.
Every probe/backup/plan/flash/verify/restore command accepts
the same adapter flags: --adapter, --adapter-serial, --clock-khz,
--gpio-chip, --gpio-swdio, --gpio-swclk, --gpio-reset,
--custom-interface-cfg. Unset flags fall back to the values in
settings.json (see scooterflasher.config.settings.Settings).
--adapter stlink
Uses OpenOCD's stock interface/stlink.cfg. This was the original's only supported
adapter. Implemented and covered by tests against a fake subprocess;
not hardware-verified — see support-matrix.md.
Permissions on Linux: add a udev rule granting your user access to the
ST-Link's USB device (distribution-dependent; OpenOCD's own udev rules
package usually covers this), or run as a user in the appropriate group
(often plugdev).
--adapter cmsis-dap / --adapter jlink
Use OpenOCD's stock interface/cmsis-dap.cfg / interface/jlink.cfg.
Same permission considerations as ST-Link. Not hardware-verified.
--adapter raspberrypi-gpio
Bit-banged SWD through the Raspberry Pi's native GPIO header via OpenOCD's
linuxgpiod driver — no external probe needed. Ported from
better-scooterflasher-fork commit 10e16e2. Defaults (all overridable via
flags):
| Setting | Default | Flag |
|---|---|---|
| GPIO chip | 0 (/dev/gpiochip0) | --gpio-chip |
| SWDIO | GPIO22 | --gpio-swdio |
| SWCLK | GPIO23 | --gpio-swclk |
| SRST | not wired (reset_config none) | --gpio-reset |
Wiring (BCM numbering)
| Signal | Raspberry Pi GPIO |
|---|---|
| SWDIO | GPIO22 (default; --gpio-swdio to change) |
| SWCLK | GPIO23 (default; --gpio-swclk to change) |
| GND | any GND pin |
| SRST | optional; pass --gpio-reset <pin> if wired, otherwise OpenOCD uses a software reset |
Permissions
linuxgpiod needs access to /dev/gpiochipN. Either run as root, or add
your user to the gpio group (sudo usermod -aG gpio $USER, then log out
and back in) and ensure udev grants that group access to /dev/gpiochip*
(commonly already the case on Raspberry Pi OS; verify with ls -l /dev/gpiochip0).
Barely hardware-verified — unit-tested against a fake subprocess
(checking the exact generated -c/-f OpenOCD commands), with one informal
report of a working ESC flash on a real scooter.
--adapter custom
Pass --custom-interface-cfg /path/to/your.cfg for any OpenOCD interface
configuration not covered above (e.g. a different GPIO pin mapping needing
extra Tcl beyond what --gpio-* flags cover, or a probe with no stock
config).
Clock speed
--clock-khz maps to OpenOCD's adapter speed <kHz>. Leave unset to use
OpenOCD's/the interface config's default. Higher speeds may be unreliable
over long or unshielded wiring — if you see intermittent connection or
verification failures, try lowering it before assuming a hardware fault.