Skip to the content
2 layers77.5 × 57.5 mmCNC FPGA Driver PCB, the printed circuit board in 3D

CNC FPGA Driver PCB

AmZu1212/CNC-FPGA3

FPGA-driven CNC / pen-plotter control system built around the AMD/Xilinx Zynq-7000 ZedBoard. The machine uses a ballpoint pen as its toolhead and draws 2D paths on paper by coordinating X/Y motion and pen lift on the Z axis.

Size
77.5 × 57.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
21
Nets
19
Pads
121
Tracks, vias
144, 0
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
28 May 2025
Updated
26 Apr 2026

Overview

CNC FPGA Driver PCB is an open-source printed circuit board by AmZu1212, from the AmZu1212/CNC-FPGA repository on GitHub. It is a 2-layer board of 77.5 × 57.5 mm with 21 parts on 19 nets, routed with 144 tracks and 0 vias.

It belongs with the fPGA and programmable logic and robots and motor control boards and the FPGA and CPLD boards of this library.

README

README.md

Top Banner

The FPGA Powered CNC Machine Project!

Authors: Amir Zuabi, Alexey Vassiliev Project Instructor: Oz Shmueli

Tech Stack: Verilog HDL, Embedded C, AMD Vitis + Vivado 2024.2

FPGA-driven CNC / pen-plotter control system built around the AMD/Xilinx Zynq-7000 ZedBoard. The machine uses a ballpoint pen as its toolhead and draws 2D paths on paper by coordinating X/Y motion and pen lift on the Z axis.

The project combines:

  • real-time motion control in programmable logic
  • SD-card file execution from embedded C software
  • a custom PS/PL handshake for streaming toolpath data
  • synchronized X/Y/Z stepping and homing behavior
Machine photo

Project Extras


Gallery

The Finished Machine

Machine photo

PCB / Electronics

Unsoldered PCBUnsoldered PCB

The Zedboard (Board Platform with PS/PL)

Machine photo

System Overview

system overview

What This Project Does

This project implements a complete CNC-style execution pipeline:

  1. A RUN.G file is placed on an SD card
  2. The Zynq PS mounts the SD card and reads the G-code
  3. Embedded C software filters and converts supported motion commands
  4. Motion data is written into AXI GPIO registers
  5. The FPGA consumes commands and executes motion in hardware
  6. The machine supports homing, start, cancel, return, and resumed runs
machien workflow

This is done using:

  • Verilog RTL
  • Vivado block design integration
  • AXI register interfaces
  • Embedded C firmware
  • Vitis deployment flow

Why It Is Technically Interesting

This project required work across several domains:

  • Digital design Custom Verilog modules for command handling, motion coordination, handshaking, and driver control.

  • Embedded systems C firmware for SD card access, G-code parsing, register writes, modal state handling, and PS/PL synchronization.

  • System integration Vivado block design, AXI GPIO mapping, platform export, Vitis application flow, FPGA programming, and serial debugging.

  • Motion control Coordinated X/Y/Z movement, homing, safe Z raises, speed handling, cancellation, and return-to-home logic.

  • Debugging and validation Timing-sensitive PS/PL handshakes, startup behavior, stale register hazards, parsing corner cases, and hardware execution issues.


Architecture

PL Responsibilities

The programmable logic is responsible for deterministic motion execution:

  • parser-side command sequencing
  • motion coordination across X/Y/Z
  • speed / timing translation into step generation
  • homing and return behavior
  • interaction with external stepper control logic

Key RTL modules include:

  • GCODE_Parser
  • XYZ_Axis_Coordinator
  • DriverController

PS Responsibilities

The processing system is responsible for file-driven command preparation:

  • mounting the SD card
  • opening RUN.G
  • filtering G-code to supported motion commands (only G0/G1 are currently supported)
  • converting units into machine format
  • writing payload and handshake values into registers
pl ps responsibilities

Supported G-code Behavior

The current software parser focuses on the motion subset needed for the machine workflow.

Supported behavior:

  • accepts G0 and G1
  • ignores unsupported non-motion lines
  • ignores comments
  • preserves modal values for omitted X, Y, Z, and F
  • converts:
    • X/Y/Z: mm -> microns
    • F: mm/min -> mm/s
  • clamps motion values to the machine work area

Expected input file:

  • SD card filename: RUN.G

Repository Structure

  • Zedboard-CNC/ Vivado hardware project, RTL, block design, and generated hardware artifacts.

  • Vitis-Classic/ Vitis Classic workspace and platform/application projects.

  • Vitis3/ Vitis Classic workspace and platform/application projects. (the project is programmed to the board from here)

  • Documentation/ Sample G-code files, hex files, reference material, project assets, etc.


How To Run

Vivado

Use Vivado when you need to:

  • inspect or edit the block design
  • modify RTL
  • regenerate the bitstream
  • export hardware for Vitis (vitis needs an .xsa file, also, when exporting hardware, dont forget to include bitstream. without it yo ucannot program the PL side of things.)

Vitis Classic

For normal use, the project should be launched directly from the existing Vitis Classic setup.

Step-by-step
  1. Connect the board to the PC.
  2. Connect the USB cable used for JTAG/programming.
  3. Connect the USB cable used for UART/serial output.
  4. Open the Vitis Classic workspace/project directory (Please note: open Vitis Classic, and not Vitis Unified).
step1
  1. Open the existing application project.
  2. Make sure the board is powered.
  3. Launch the application on hardware.(right click the project application, and press "launch on hardware")
step2
  1. Open the serial terminal if you want runtime prints.
com port prints

For the normal checked-in working flow, no rebuild is required just to run the design if the workspace is already in a valid state.

Serial Terminal

When using runtime prints:

  • use the board UART COM port
  • standard settings are typically:
    • 115200
    • 8-N-1
    • no flow control

Wiring Guide

Required Board Connections

  • Zedboard power (i.e the included board power adapter)
  • JTAG/programming USB
  • UART USB
  • SD card inserted (a micro-sd to SD adapter can be used and is recommended)

Motion / Driver Wiring

wiring

The diagram above shows one complete motor assembly using the PMOD top A cluster, an A4988 driver, a Nema 17 stepper motor, a limit switch, and a 12V-to-3.3V step-down supply. The same wiring pattern is reused for each axis.

Additional connections from the driver assembly:

  • A4988 2B, 2A, 1A, 1B connect to the Nema 17 motor phases.
  • A4988 VM is powered from the 12V supply.
  • A4988 logic VDD is powered from the step-down 3.3V output.
  • All grounds must be common between the ZedBoard, step-down converter, driver, and power supply.
  • A 100 uF capacitor is placed across the motor supply near the A4988 driver.
  • The PCB is designed for a 12V, 3A DC input supply.
  • This can be provided either by a suitable wall power adapter or by a portable battery/power-bank setup, as used in this project, as long as it can reliably supply 12V at 3A.

The remaining PMOD clusters use the same signal order:

  • PMOD A: X axis
  • PMOD B: Z axis
  • PMOD C: Y axis

The table below shows the shared signal order for all three PMOD motor clusters.

Pin #PMOD Pin NameSignal DefinitionA4988 / External Connection
1JA1 / JB1 / JC2_PDIRA4988 DIR
2JA2 / JB2 / JC1_NSTEPA4988 STEP
3JA3 / JB3 / JC1_PRSTA4988 RST
4JA4 / JB4 / JC2_NLSSLimit switch signal
5GND / GND / GNDLS-Limit switch return
6VCC / VCC / VCCLS+Limit switch V+
7JA7 / JB7 / JC3_PENA4988 EN
8JA8 / JB8 / JC3_NMS1A4988 MS1
9JA9 / JB9 / JC4_PMS2A4988 MS2
10JA10 / JB10 / JC4_NMS3A4988 MS3
11GND / GND / GNDGNDA4988 GND / common ground
12VCC / VCC / VCCSLPA4988 SLP / 3.3V logic rail

PS / PL Register Interface

The software and hardware communicate through AXI GPIO-backed registers.

The interface uses a small request/acknowledge handshake between the Processing System (PS) and Programmable Logic (PL). The PL raises MOUNT_REQ when it wants the PS to open and prepare a job. The PS answers with MOUNT_OK or MOUNT_FAIL. After that, the PL requests the next motion entry by changing REQ. The PS writes X, Y, Z, SPEED, and LAST_LINE, then updates ACK to the same phase only after the data is ready. Matching REQ and ACK tells the PL that the next motion command is valid and can be executed.

DirectionRegister NamePurpose
PS → PLXNext command X position written by the C application.
PS → PLYNext command Y position written by the C application.
PS → PLZNext command Z position written by the C application.
PS → PLSPEEDSpeed value associated with the current motion command.
PS → PLACKPhase acknowledge register. Updated only after the new command data is valid.
PS → PLMOUNT_OKIndicates that the PS mounted the SD card and opened the job successfully.
PS → PLMOUNT_FAILIndicates that the PS could not mount or open the requested job.
PS → PLLAST_LINEMarks that the currently served motion command is the final valid line in the file.
PL → PSREQPhase request register used by the PL to ask for the next motion command.
PL → PSMOUNT_REQSession request bit used by the PL to tell the PS to mount and prepare a file.

Typical Runtime Flow

  1. PS detects a mount request from the PL
  2. PS mounts the SD card and opens RUN.G
  3. PS preloads the first valid motion command
  4. PL acknowledges and advances through phase-based requests
  5. PS serves one motion at a time through AXI registers
  6. PL executes the path in hardware
  7. On cancel, the machine performs a controlled return-to-home sequence
machine flow

Current Status

The system demonstrates a working end-to-end CNC control path:

  • SD card file loading
  • C-based G-code parsing and conversion
  • PS/PL handshake and register streaming
  • hardware motion execution
  • homing, start, cancel, and restart behavior

This repository represents substantial work in:

  • FPGA design
  • embedded software
  • control logic
  • hardware/software integration
  • debugging of real machine behavior

Notes

  • RUN.G is the expected job filename on the SD card
  • some folders contain bring-up code and experiments in addition to the main working flow
  • platform regeneration may be required when hardware-visible interfaces change

Authors

A Project by Amir Zuabi & Alex Vassiliev

Bottom Banner

Parts

21
QtyValueFootprintReferences
4DuPont 1x4Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalStepperX, StepperY_1, StepperY_2, StepperZ
32x6 DuPont PMODConnector_PinHeader_2.54mm:PinHeader_2x06_P2.54mm_VerticalJA, JB, JC
3AxisConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalLimitSwitchX, LimitSwitchY, LimitSwitchZ
2A4988 Stepper DriverModule:Pololu_Breakout-16_15.2x20.3mmA4988 Y Axis Driver, A4988 Z Axis Driver
1+100[µF]-Capacitor_THT:C_Disc_D8.0mm_W2.5mm_P5.00mmC1
112V_Screw_TerminalTerminalBlock:TerminalBlock_MaiXu_MX126-5.0-02P_1x02_P5.00mm+ 12V -
1A4988 N Axis DriverModule:Pololu_Breakout-16_15.2x20.3mmA4988 X Axis Driver
1C2Capacitor_THT:C_Disc_D8.0mm_W2.5mm_P5.00mm+100[µF]-
1C3Capacitor_THT:C_Disc_D8.0mm_W2.5mm_P5.00mm+100[µF]-

The 17 most common of 21 parts.

Similar boards

  • 2 layers28.3 × 39.8 mmLevelShifter, the printed circuit board in 3D

    LevelShifter

    gusmanb/logicanalyzer

    24 channel, 100Msps logic analyzer hardware and software

    21 parts5.1kGPL-3.0
  • 2 layers171.2 × 72.9 mmAmiga gfxcard before pour, the printed circuit board in 3D

    Amiga gfxcard before pour

    mntmn/amiga2000-gfxcard

    MNT VA2000, an Open Source Amiga 2/3/4000 Graphics Card (Zorro II/III), written in Verilog

    21 parts1k
  • 2 layers93.9 × 46 mmRectifier, the printed circuit board in 3D

    Rectifier

    rene-dev/stmbl

    AC Servo Driver for STM32F4

    21 parts990GPL-3.0
  • 2 layers45.5 × 42.9 mmEsphome han reader, the printed circuit board in 3D

    Esphome han reader

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    21 parts915
  • 2 layers31.8 × 14.5 mmEsp prog, the printed circuit board in 3D

    Esp prog

    drandyhaas/KiCadRoutingTools

    A set of Python/Rust tools to aid routing in KiCad

    21 parts744MIT
  • 2 layers23.5 × 15.8 mmQuiverAttachPCB, the printed circuit board in 3D

    QuiverAttachPCB

    Arrow-air/project-quiver

    Project Quiver documentation, designs, and project artifacts.

    21 parts617CERN-OHL-S-2.0
  • 2 layers69.9 × 41.3 mmHeaterMeterLCD, the printed circuit board in 3D

    HeaterMeterLCD

    CapnBry/HeaterMeter

    HeaterMeter and LinkMeter Arduino BBQ Controller

    21 parts557MIT
  • 2 layers161.3 × 111.8 mmDoj, the printed circuit board in 3D

    Doj

    kelu124/echomods

    Open source ultrasound processing modules and building blocks

    21 parts463

Questions

How big is the CNC FPGA Driver PCB PCB?

It measures 77.5 × 57.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the CNC FPGA Driver PCB use?

21 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the CNC FPGA Driver PCB KiCad files?

From the AmZu1212/CNC-FPGA repository on GitHub, at the commit this page was made from: the board is CNC-FPGA Driver PCB/CNC-FPGA Driver PCB.kicad_pcb and its schematic CNC-FPGA Driver PCB/CNC-FPGA Driver PCB.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the CNC FPGA Driver PCB design in my own project?

Its repository states no licence, so its author keeps all rights: ask AmZu1212 before reusing the design.