Skip to content
Open-source embedded library

Any motor as a DYNAMIXEL X430in portable C

The X430 emulator turns DYNAMIXEL Protocol 2.0 packets into the X430 Control Table and into hook calls for your motor, so DynamixelSDK and DYNAMIXEL Wizard drive a stepper or a BLDC unchanged, with no heap, no RTOS and code that passes MISRA C:2012.

  • No heap
    No RTOS
  • MISRA C:2012
    0 violations
  • 100 % line &
    branch coverage
  • Apache-2.0
    open source
Isometric scene: a host adapter sends Protocol 2.0 packets over the bus to a controller board; the X430 emulator chip answers and drives a stepper motor through its power stage
The problem

Your own actuator, the DYNAMIXEL tools you already use

A robot arm built around a stepper or a BLDC driver needs a host protocol. Writing one means a host driver, a ROS 2 plugin and a configuration tool of your own. Answering as a DYNAMIXEL X430 instead gives you DynamixelSDK, DYNAMIXEL Wizard and dynamixel_hardware_interface — if the device behaves like an X430 down to the rules of its Control Table, inside the RAM and flash of a small MCU.

Behaves like the X430

All 17 X430 models with Control Tables generated from YAML and checked against the e-Manual; every instruction a host uses, Indirect Address, Bus Watchdog, shutdown, backup. 52 checks with the official DynamixelSDK pass end to end.

  • Protocol 2.0
  • Fast Sync Read
  • Indirect Address

Tight embedded budgets

384 B of RAM per device and 1,664 B per bus on Cortex-M4, 10,119 B of flash at -Os including the model table; no allocation, no globals, no OS.

  • Static memory
  • Bare metal & RTOS

Built for review and certification

Zero MISRA C:2012 violations, a documented deviation register, 100 % line and branch coverage, bounded execution time and static analysis in CI.

  • MISRA C
  • Cppcheck
  • CodeQL
What you get

One library from the serial bytes to your motor

24 public functions in three parts — the bus that decodes the line, the devices that hold the Control Tables, and an optional simulator — one model per build, optional instructions selected with Kconfig or plain definitions.

24public functions
384 BRAM per device (Cortex-M4)
424 Bworst-case stack (Cortex-M4)
0MISRA C:2012 violations

Quick start

One joint on one serial line

The application gives the bus a byte writer and feeds it the received bytes; the device calls a hook for every accepted register write, and the motor loop keeps the live registers current. Everything runs in the main loop (or one RX thread).

#include "x430.h"

static struct x430_bus bus;
static struct x430_device joint;

static int uart_write(void* context, const uint8_t* data, size_t length)
{
    (void)context;
    return board_uart_write(data, length); /* 0 on success */
}

static uint8_t on_write(struct x430_device* device, uint16_t address, uint8_t size,
                        int32_t value, void* user_data)
{
    uint8_t result = DXL2_ERR_NONE;

    (void)device;
    (void)size;
    (void)user_data;
    if (address == X430_ADDR_TORQUE_ENABLE)
    {
        if (!motor_enable(value != 0))
        {
            result = DXL2_ERR_RESULT_FAIL; /* the host sees Result Fail */
        }
    }
    else if (address == X430_ADDR_GOAL_POSITION)
    {
        motor_move_to(value);
    }
    else
    {
        /* other registers are only stored */
    }
    return result;
}

static const struct x430_hooks hooks = {.write = on_write};

int main(void)
{
    const struct x430_bus_config bus_config = {.write = uart_write};
    const struct x430_device_config joint_config = {.id = 1U, .hooks = &hooks};

    board_init();
    if ((x430_bus_init(&bus, &bus_config) != X430_OK) ||
        (x430_device_init(&joint, &joint_config) != X430_OK) ||
        (x430_bus_attach(&bus, &joint) != X430_OK))
    {
        for (;;)
        {
        }
    }
    for (;;)
    {
        uint8_t bytes[64];
        const size_t count = board_uart_read(bytes, sizeof(bytes));

        (void)x430_bus_receive(&bus, bytes, count); /* parse, check, hooks, answer */
        if (board_tick_1ms())
        {
            (void)x430_bus_lock(&bus); /* live values from the motor */
            (void)x430_device_set(&joint, X430_ADDR_PRESENT_POSITION, motor_position());
            (void)x430_device_set(&joint, X430_ADDR_MOVING, motor_moving() ? 1 : 0);
            (void)x430_bus_unlock(&bus);
            (void)x430_bus_poll(&bus); /* Bus Watchdog */
        }
    }
}

The board_… and motor_… functions stand for your UART and motor code; the Integration Guide shows the RTOS layout, persistent storage and the port (lock, clock, delay).

Find your way

If you want to… Read
Understand what the library does and does not do Introduction
Build it, run the tests, add it to your project Getting Started
Understand the modules, contexts, states and memory How It Works
Set up devices and react to the host Using the Library
Know exactly what an X430 host sees X430 Emulation
Choose the model and the build options Configuration
Connect it to a UART, an RTOS and flash Integration Guide
Look up a function API Reference
Read everything offline or print it PDF user manual
SystemFromScratch®

Part of an open-source embedded portfolio

The X430 emulator is developed by Anton Vynohradov under SystemFromScratch® — secure embedded systems and compliance-ready engineering, from concept to certification-ready product.

SystemFromScratch® is a registered trademark. DYNAMIXEL and ROBOTIS are trademarks of ROBOTIS Co., Ltd.; this independent implementation is not affiliated with or endorsed by ROBOTIS.