S1 firmware
The S1 firmware is open source (GPL-3.0), written in C++ against ST’s HAL and the STM32duino core, and built with PlatformIO. It is flashed through the SWD header with an ST-Link.
Which version is running?
Section titled “Which version is running?”Tercio Control shows the firmware and protocol version on the motor’s Diagnostics tab. In Python: print(motor.info()).
What you need
Section titled “What you need”- An ST-Link (V2, V3 or a clone) or any SWD probe that PlatformIO or STM32CubeProgrammer supports.
- Five jumper wires for the SWD header (J3): 3.3 V, SWDIO, SWCLK, NRST, GND.
- PlatformIO (VS Code extension or the
piocommand line). - The source: Kerol-Dev/Tercio-s1.
DirectoryTercio-s1/Firmware
- platformio.ini platform and core pinned to tested versions
Directorysrc
Directoryapp/ axis state machine, parameters, bus node, procedures
- …
Directoryboard/ pins, clock, hardware revision
- …
Directorycontrol/ planner, position controller, encoder tracking
- …
Directorydrivers/ CAN-FD, TMC2209, step generator, flash storage, inputs
- …
Directoryencoder/ AS5600, AS5048A
- …
- protocol/Protocol.h the CAN protocol v2 contract
Directorytest/ host unit tests
- …
DirectoryLibraries/ Python and Arduino host libraries
- …
DirectoryWeb_Server/ Tercio Control
- …
Update the firmware
Section titled “Update the firmware”-
Power the S1 from its supply as usual. Do not power it from the probe.
-
Connect the probe to J3: 3.3 V to pin 1 (voltage sense), SWDIO to 2, SWCLK to 3, NRST to 4, GND to 5.
-
Build and flash from the
Firmwarefolder:Terminal window pio run -e tercio_s1 -t uploadOr flash the built
.pio/build/tercio_s1/firmware.binwith STM32CubeProgrammer at address0x08000000. -
The S1 restarts into the new firmware. Check the version in Tercio Control.
To run the unit tests for the planner, controller, encoder tracking, parameters and protocol codec on your computer:
pio test -e nativeRecovery
Section titled “Recovery”If the probe cannot connect, for example because a firmware keeps the chip busy or resets it:
- Fit a jumper on J6 pins 1–2 (BOOT0 to 3.3 V).
- Power-cycle the S1. It now starts ST’s ROM bootloader instead of the firmware, and the probe connects.
- Flash as above, or erase the chip with STM32CubeProgrammer (Full chip erase).
- Remove the jumper and power-cycle.