# Firmware release notes

What changed in each firmware release, from the release notes in the firmware repository, up to the release this site describes.

## V107 (2026-08-26)

Spectral BLDC firmware **V107** — application image for flashing via the Spectral bootloader.

#### CAN bus
- Fixed `IN_DATA_PACK_PD` writing the commanded speed into `Feedforward_speed` instead of `Velocity_setpoint` — PD mode's KD (velocity-damping) term was being evaluated against a stale/zero setpoint, so it silently ignored the commanded speed.
- Added a generic mask+value settings command (`IN_SETTINGS`) for CAN-unreachable boolean settings, starting with idle-mode brake/coast selection.

#### Usability
- Idle mode can now be set to brake (driver stays enabled, phases held shorted via a zero-voltage PWM vector) or coast (Hi-Z, previous/default behavior), via `IN_SETTINGS` over CAN or `#Brake <0|1>` over UART.

#### Calibration
- Fixed `#Cal` spuriously failing with "Commutation/alignment check failed!" on some individual motor units. The pre-check that confirms the motor responds to a current command was driving a fixed voltage at the raw (uncalibrated) encoder angle; whether that produced torque depended on each unit's random magnet-to-encoder mounting angle. It now retries once at a 90-degree angle bias before failing.

#### Assets
- `spectral-bldc-firmware-V107.bin` — application firmware image (flash at `0x08003000`, target STM32F103CB).
- `firmware.json` — manifest with version, size, and SHA-256 for download verification by the web flasher.

#### Integrity
- SHA-256: `2ca1f2e3ad3ee7848cf47d8733b084be2daa87fc2e49f954dd41c76405d48ada`
- Size: 95404 bytes

Built from commit `2e7febc` on `Bootloader_main`.

## V106 (2026-07-06)

Spectral BLDC firmware **V106** — application image for flashing via the Spectral bootloader.

**CAN bus**
- The controller now drains up to 8 CAN messages per pass instead of just 1, so short bursts (multiple commands sent back-to-back, or a busy multi-node bus) no longer silently drop messages once the 3-deep hardware FIFO fills.
- A CAN peripheral that fails to initialize no longer bricks the board — UART stays fully usable, only the CAN bus is skipped.

**Safety**
- Added a hardware watchdog (100ms). If the control loop ever stops running, the board resets instead of leaving the motor driven at a stale duty cycle.
- Fixed a bug where `Torque_mode` could silently overwrite your commanded Iq setpoint when clamping to the current limit — reading it back after clamping now shows what you actually asked for, and raising the current limit afterward immediately restores the original commanded torque instead of requiring the command to be resent.
- Fixed undefined behavior in a serial-protocol integer conversion (`fourBytesToInt`).
- Synced default configuration values that had drifted between two locations in the code, so a fresh `#Default` and a freshly-flashed board's built-in defaults now agree.

**EEPROM / configuration integrity**
- Added CRC validation over the saved configuration, split into two independent halves: calibration data (resistance, inductance, Kt/KV, angle offset, current-loop gains, etc.) and settings (PID tuning, limits, watchdog config, CAN ID, etc.).
- This means a corrupted save (e.g. from a power loss mid-write) is detected and safely defaulted instead of silently running with garbage values — and critically, a future firmware update that only adds a new setting can no longer wipe your calibration, since the two are validated independently.
- Boards upgrading from older, pre-CRC firmware keep their existing calibration automatically — no need to recalibrate after this update.
- A few unused slots were reserved in the calibration block for upcoming features (e.g. magnet alignment), so those can be added later without another migration.

**Performance**
- PWM output no longer re-resolves which timer/channel it's writing to on every single call (it was doing this 4x per control tick) — resolved once and cached, freeing up ISR headroom.
- Velocity calculation switched from a floating-point divide to an integer multiply.

**Usability**
- New `#Help` command — prints a summary of the available commands.
- Serial now responds with `"Unknown command"` for unrecognized input instead of silently ignoring it.
- Calibration now prints progress during the angle-offset search (previously up to ~40 seconds of silence that could look like the board had hung).
- `#Info` now always reports live ISR execution time, useful for checking control-loop headroom on the bench.
- Fixed a leftover calibration-failure message that incorrectly suggested swapping motor phases — that failure mode no longer exists (reversed wiring has been auto-detected/compensated in software since V105); the message now accurately describes what actually happened (a commutation/current-response check, not a wiring-direction problem).

**Assets**
- `spectral-bldc-firmware-V106.bin` — application firmware image (flash at 0x08003000, target STM32F103CB).
- `firmware.json` — manifest with version, size, and SHA-256 for download verification by the web flasher.

**Integrity**
- SHA-256: `edb06ca112a7d24b0581e0b157a4524928067a46f8dc850ce22df8128092a758`
- Size: 94908 bytes

Built from commit `e1f8611` on `Bootloader_main`.

## V105 (2026-07-05)

Spectral BLDC firmware **V105** — reversed-wiring auto-calibration

`#Cal` now auto-detects reversed motor phase wiring during the open-loop spin and compensates it in software as a phase B<->C reflection, instead of failing and telling you to physically swap phases. Angle-offset calibration is now found automatically as part of `#Cal` itself (deterministic rotor-lock + verify + symmetry-sweep), so the standalone `#Calangle` command has been removed. `#Info` now reports the true firmware version instead of a stale EEPROM value. Existing calibrated units are unaffected and do not need `#Default`.

**Assets**
- `spectral-bldc-firmware-V105.bin` — application firmware image (flash at 0x08003000, target STM32F103CB).
- `firmware.json` — manifest with version, size, and SHA-256 for download verification by the web flasher.

**Integrity**
- SHA-256: `0bd80ea038b8497fca8ab6a613b083d28e3473b360fa152b512b8ab0304dedb5`
- Size: 91732 bytes

Built from commit `b7dded3` on `Bootloader_main`. Includes reversed-wiring auto-calibration (`commutation_dir` detection + phase B<->C reflection) and deterministic rotor-lock angle-offset calibration.

## V104 (2026-06-19)

Spectral BLDC firmware **V104** — bootloader build.

#### Assets
- `spectral-bldc-firmware-V104.bin` — firmware image (90,968 bytes).
- `firmware.json` — manifest with version, size, and SHA-256.

#### Integrity
- SHA-256: `76d70a6091218d74021eeef55c31d39f19fe97f68e2b236169f84c708518a360`
- Size: 90968 bytes

Built from commit 20765c9 on `Bootloader_main`. Includes CAN Vlim command and bootloader support.

## v101 (2025-09-29)

Some small fixes added based on STEPFOC code that is a clone of this code.

1. Added theta_offset calib.
2. Fixed some issues related to gripper mode where it vibrates

NOTE added another entry to EEPROM memory. Loading this code to update your previous code you will need to run #Default to 
load that new entry in EEPROM!

## v100 (2024-03-27)

Software version 100
