Skip to content
Open-source Zephyr RTOS firmware

Your stepperseen as a smart servo

Doppelstep turns a two-phase stepper motor and a small STM32 motor-control board into a DYNAMIXEL XM430-W350 on the bus: ROS 2, DynamixelSDK and DYNAMIXEL Wizard talk to it unchanged. Closed-loop microstepping current control at 20 kHz, a signed bootloader, and the whole firmware tested on a PC before it reaches the hardware.

  • Zephyr RTOS 4.5
    drivers & devicetree
  • DYNAMIXEL
    Protocol 2.0
  • Runs on a PC
    simulated motor
  • Apache-2.0
    open source
Isometric scene: DYNAMIXEL Protocol 2.0 packets from a ROS 2 host reach a controller board running Doppelstep on Zephyr RTOS; three half-bridges drive a stepper motor with a servo horn through two phase currents 90 degrees apart.
The problem

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.

  • Protocol 2.0
  • Control Table
  • ros2_control

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.

  • Microstepping
  • 20 kHz
  • Protection in the ISR

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.

  • native_sim
  • Software-in-the-loop
  • GitHub Actions
What you get

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.

91automated tests per CI run
20 kHzcurrent control loop
75.5 KiBapplication flash
18.6 KiBapplication RAM

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.