FPGA & CPLD motion control guide: DDA interpolation, jitter-free step pulses, encoder capture, and lessons from XTELL plotter and print-control boards.
An 8-bit or 32-bit MCU easily drives a single-axis stage or low-speed 3-axis stepper mechanism. In XTELL's microscope motorized stage project, an ATMEGA32U4 running 3CNC firmware with A4988/HR4988E stepper drivers handled smooth precision positioning within modest step rates and simple kinematic profiles.
Trouble starts when step frequencies climb into hundreds of kilohertz, four to eight axes must stay tightly synchronized along curved paths, or printheads and laser triggers have to fire at exact spatial intervals without a single microsecond of software interrupt jitter. When one timer ISR waits on USB, Ethernet, or another axis interrupt, motors whine, trajectories drift, and print lines misalign.
Choosing the right control split prevents both over-engineering simple stages and under-powering industrial equipment:
| Control Architecture | Step / Trigger Jitter | Multi-Axis Sync & I/O | Safety Interlock Response | Best Application Fit |
|---|---|---|---|---|
| MCU Timer + ISR | Microsecond-scale (varies with IRQ load) | 2–3 axes at modest pulse rates | Software/interrupt dependent | Low-cost stages, simple 3-axis CNC or dispensers |
| Host MPU/MCU + FPGA/CPLD Co-Processor | Single FPGA clock cycle (<20–50 ns) | 4–16+ axes, synchronized print/laser triggers | Pure combinational hardware gating (<100 ns) | Plotters, industrial printers, laser cutters, multi-axis automation |
| SoC FPGA (ARM + Programmable Logic) | Single FPGA clock cycle | High-speed closed-loop + Ethernet/EtherCAT host | Hardware fabric safety + rich Linux UI | High-axis-count robotics and vision-guided motion |
Instead of firing a CPU interrupt for every step pulse, an FPGA runs a Digital Differential Analyzer (DDA) or phase accumulator per axis in parallel. At every fixed tick (for example 100 kHz or 1 MHz), each axis adds a 32-bit frequency word to its accumulator; whenever the accumulator overflows, hardware outputs a glitch-free STEP pulse of fixed width with zero CPU intervention.
Because every axis shares the exact same FPGA clock, linear interpolation across X/Y/Z/E axes stays phase-locked down to tens of nanoseconds—and printhead firing pulses or laser PWM gates can lock directly onto axis step counters.
Parsing Gerber files, G-code, or raster image slices belongs on a host processor or embedded Linux board, not inside hard real-time pulse generation. In XTELL's Allwinner R528 control board, Tina-Linux handled HTTP photo upload, WebSocket control, and G-code dispatch over high-speed serial interfaces. In our FPGA-based plotter control system, Gerber graphic processing fed an FPGA motion engine across multiple hardware iterations so host OS jitter never reached the motors.
With a lookahead motion FIFO inside the FPGA (storing segment duration, initial velocity, acceleration delta, and axis step ratios), the host only needs to keep the queue topped up every few milliseconds while the FPGA executes smooth trapezoidal or S-curve profiles autonomously.
Closed-loop servo and stepper systems with high-resolution encoders can generate millions of quadrature edges per second—far beyond GPIO interrupt rates on a normal MCU. In an FPGA, a 3-stage synchronizer and majority-vote glitch filter clean noisy A/B/Z lines before a synchronous state machine updates 32-bit signed position counters on all 4× edges without dropping a single count.
Never rely solely on a CPU loop to stop a fast gantry when a limit switch trips or an E-stop button is pressed. Gate the STEP, motor driver enable, and laser/actuator power outputs through pure combinational logic (or a single-cycle safety state machine) inside the FPGA or CPLD so a crashed host processor cannot keep driving an axis into a mechanical hard stop.
In XTELL's printer control hardware system, EPM240 and EPM570 CPLDs across the 38_MB_V4 main control board and 38_MD3 driver board implemented deterministic print timing and hardware signal coordination across v1.3 and v1.4 PCB revisions.
This illustrative module shows how a single FPGA clock drives deterministic step pulses with programmable frequency and fixed pulse width (adapt bit widths and direction setup/hold timing to your stepper or servo drive datasheet):
// Illustrative synchronous DDA step pulse generator
module step_axis #(
parameter W = 32
)(
input wire clk,
input wire rst_n,
input wire enable,
input wire estop_n,
input wire [W-1:0] freq_word, // step rate = freq_word * clk / 2^W
output reg step_out
);
reg [W-1:0] phase_acc;
reg [7:0] pulse_cnt;
wire [W:0] next_phase = {1'b0, phase_acc} + {1'b0, freq_word};
wire overflow = next_phase[W];
always @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
phase_acc <= 0;
pulse_cnt <= 0;
step_out <= 1'b0;
end else if (!enable || !estop_n) begin
pulse_cnt <= 0;
step_out <= 1'b0; // hardware-gated E-stop
end else begin
phase_acc <= next_phase[W-1:0];
if (pulse_cnt > 0) begin
pulse_cnt <= pulse_cnt - 1'b1;
step_out <= 1'b1;
end else if (overflow) begin
pulse_cnt <= 8'd20; // minimum driver STEP high time
step_out <= 1'b1;
end else begin
step_out <= 1'b0;
end
end
end
endmodule
Successful motion equipment depends on getting three layers right together: clean driver/encoder isolation on the PCB, deterministic CPLD or FPGA pulse/safety logic, and smooth trajectory planning on the host MCU or Linux board. XTELL delivers complete FPGA and CPLD design, motion hardware and PCB engineering, and embedded firmware under one engineering team.
Explore our related articles on FPGA and processor interfaces, FPGA timing constraints and timing closure, and FPGA configuration and safe field updates, or send your axis count and trajectory requirements via our contact page.
Any system needing four or more tightly interpolated axes, sub-microsecond step/print/laser synchronization, pulse rates above ~100–200 kHz per axis, or deterministic hardware E-stop/limit gating benefits immediately from offloading pulse generation and encoder capture to an FPGA or CPLD.
Yes. Separating trajectory parsing (G-code, Gerber, or raster slicing on an MCU or Linux SoC) from real-time pulse generation (DDA accumulators and motion FIFO inside the FPGA) gives you both rich software tooling and cycle-accurate hardware timing.
Yes. XTELL designs multi-revision motion mainboards, stepper/servo driver isolation stages, CPLD/FPGA Verilog logic, and host firmware/software as one integrated delivery.
Contact us for customized solutions and quotes