A smart-servo joint from a stepper motor
Robot arms such as OpenMANIPULATOR-X are built from smart servos that a ROS 2 host drives over DYNAMIXEL Protocol 2.0. A two-phase stepper motor is a common, low-cost alternative with a high holding torque, but on its own it speaks no protocol and needs a current controller that runs tens of thousands of times per second. The firmware has to close that gap on one small microcontroller (Cortex-M4, 128 KiB of flash, 32 KiB of RAM), stay safe when something goes wrong, update in the field, and be testable without risking the hardware.
The host expects a servo
Doppelstep emulates the complete Control Table of an XM430-W350 (model 1020) and maps it onto the motor. An integration test runs the ros2_control loop with the official DynamixelSDK at 100 Hz against the firmware.
A stepper needs a fast, safe current loop
Stepper-C closes the phase current loop in a 20 kHz zero-latency interrupt. Overcurrent, bus voltage and shared-leg faults switch the outputs off inside that interrupt, independent of any task.
Hardware is slow and costly to test on
The same firmware runs on a PC with a physical model of the motor and the power stage. 91 automated tests run on every CI build in a pinned Docker image.
One repository, from the timer register to ROS 2
Three Zephyr drivers, an application that owns the threads, an out-of-tree board, a bootloader, a simulated motor, a bench GUI and a reproducible environment: a complete firmware product that you can build on.
Real Zephyr drivers
A power-stage driver class, the motor behind Zephyr's stepper and stepper_ctrl APIs, and the servo as a child node of its UART. The devicetree selects the hardware.
Simulated motor
The plant model of Stepper-Lab with power stage values from ngspice, on the board or on the PC, so motion, protocol and ROS 2 work before a motor is connected.
Secure firmware update
MCUboot checks an RSA-2048 signature at every start and accepts new firmware over the DYNAMIXEL bus itself. The GUI verifies the result by its SHA-256 hash.
Bench GUI
Motion with live plots and CSV recording, the whole Control Table, the SIL test scenarios on the real board with an HTML report, and the firmware update.
Portable by design
Only one backend file per MCU family touches registers. A fixed-point backend covers cores without an FPU; the next family is already analysed.
Reproducible environment
Pinned versions, a Docker image published for CI and GitHub Codespaces, a Dev Container, and the same VS Code tasks on Windows and Linux.
Quick start¶
Quick start
See it move in a few minutes, without hardware¶
All you need is Docker and Git. The first run downloads the toolchain and Zephyr, so it takes a while; after that, the tests take about half a minute. The same firmware that runs on the board runs here as a Linux program, with a simulated stepper motor behind it.
git clone https://github.com/SystemFromScratch/sfs-doppelstep.git doppelstep
cd doppelstep
docker compose build # toolchain image
docker compose run --rm zephyr bash scripts/west-init.sh # Zephyr and the libraries
docker compose run --rm zephyr bash scripts/run-tests.sh # firmware + SIL and integration tests
Then start the simulated servo and move it from your PC, the way a robot controller would:
docker compose run --rm zephyr west build -b native_sim/native/64 -s app -d build-native
docker compose run --rm -p 5555:5555 zephyr python3 tools/sim/run_native.py run --tcp 5555
python tools/sim/dxl_smoke_test.py --tcp localhost:5555 # second terminal: ping, torque, move
No Docker at hand? Open the repository in GitHub Codespaces: the environment image is ready, nothing is built at the start (Development environment).
Find your way¶
| I want to… | Read |
|---|---|
| Understand what Doppelstep is, in plain words | Introduction |
| See which technologies and libraries it is built on, and why | Technology stack |
| Build it, run it on a PC, flash the board | Getting started |
| Wire the board and the motor, bring it up safely | Hardware and bring-up |
| Connect ROS 2, DynamixelSDK or DYNAMIXEL Wizard | DYNAMIXEL emulation |
| Change the motor, the limits, the ID or the baud rate | Configuration |
| Read the code: layers, threads, the path of a command | Architecture |
| Port it to another microcontroller | Porting to a new MCU family |
| Run and extend the tests | Tests and CI |
| Get the whole manual as a PDF | Doppelstep.pdf, or build it: python tools/docs/build_manual.py (how) |
SystemFromScratch®
Part of an open-source embedded portfolio
Doppelstep is developed by Anton Vynohradov under SystemFromScratch®: firmware and embedded Linux for connected products, secure, MISRA-compliant and ready for the EU Cyber Resilience Act. It shows on one real product how the company works: drivers, bootloader, control, protocol, tests and documentation.
SystemFromScratch® is a registered trademark. DYNAMIXEL and ROBOTIS are trademarks of ROBOTIS Co., Ltd.; STM32 is a registered trademark of STMicroelectronics International N.V. Doppelstep is not affiliated with or endorsed by them.