QC
QuantaControl

Technology

FPGA Feedback Controller

A complete closed-loop feedback control system implemented on a Red Pitaya (Xilinx Zynq) FPGA. Combining lock-in-style signal generation, CIC decimation filtering, and real-time PID control at 125 MHz.

Architecture Overview

Signal Gen3-tone DDS+DAC14-bit OUTSMA CableADC14-bit INCIC Filter6-stageScaler64b → 14bPIDKp + KiOutput MUXCH1 / CH2Web UIScope + Control-Closed-Loop Feedback Controller — FPGA Signal Chain125 MHz125 MSPSR=125 → 1 MSPSFPGA (Zynq-7010/7020)

The system operates as a closed loop: a multi-tone disturbance is generated by DDS (Direct Digital Synthesis), combined with PID feedback (subtracted), and output through the 14-bit DAC. The signal physically loops back through an SMA cable to the 14-bit ADC, naturally acquiring real-world noise.

After acquisition, a 6-stage CIC decimation filter reduces the 125 MSPS sample rate to 1 MSPS, followed by a scaler that normalizes the 64-bit CIC output back to 14-bit range. The PI controller then processes the error signal and closes the feedback loop.

Signal Generation

Multi-Tone DDS

Three independently configurable sine wave generators using Direct Digital Synthesis with 32-bit phase accumulators and a 1024-entry BRAM lookup table.

0.5 Hz
Slow drift simulation
Phase inc: 17
330 Hz
Mechanical vibration
Phase inc: 11,337
1200 Hz
Acoustic noise
Phase inc: 41,227

Phase increment formula: phase_inc = freq × 2³² / 125e6

CIC Decimation Filter

Specifications

Stages
6
Decimation Factor
125
Input Rate
125 MSPS
Output Rate
1 MSPS
Internal Width
64-bit
Bit Growth
14 + 6×ceil(log₂(125)) = 56 bits

Design Notes

  • 6 integrator stages run at the full clock rate (125 MHz)
  • 6 comb stages run at the decimated rate (1 MHz)
  • Scaler normalizes CIC gain of 125&sup6; = 3.814 × 10¹²
  • Fixed-point: (din × 302231) >>> 60

PID Controller

A fixed-point PI controller operating in Q16.16 format. The proportional term provides immediate response, while the integrator eliminates steady-state error with anti-windup clamping.

P Term

p_out = (din × kp) >>> 16

Direct proportional path with Q16.16 scaling

I Term

integrator += din × ki

48-bit accumulator, clamped to ±8191 « 16

Output: 14-bit signed, saturated to ±8192. Integrator resets on rst_n deassertion.

Register Map

All registers are accessible via AXI4-Lite at base address 0x40900000. The Rust backend memory-maps these registers through /dev/mem for real-time web control.

OffsetRegisterDescriptionAccess
0x00Control[0] Enable [1] RST PID [2] Closed Loop [3] CIC EnableR/W
0x04KpQ16.16 proportional gainR/W
0x08KiQ16.16 integral gainR/W
0x0CSetpoint14-bit signed setpointR/W
0x10Sig Gen 1Q16.16 gain for 0.5 Hz toneR/W
0x14Sig Gen 2Q16.16 gain for 330 Hz toneR/W
0x18Sig Gen 3Q16.16 gain for 1200 Hz toneR/W
0x20MUX CH1Output source select (0-5)R/W
0x24MUX CH2Output source select (0-5)R/W
0x100TestReturns 0x12345678RO

Output MUX Selection

Two independent 6-way multiplexers allow routing any internal signal to the oscilloscope channels for monitoring and debugging.

ValueSourceDescription
0ADC Channel ARaw 14-bit ADC input
1ADC Channel BRaw 14-bit ADC input
2DisturbanceSignal generator output (pre-feedback)
3PID OutputFeedback compensation signal
4DAC OutputPhysical DAC output (disturbance - feedback)
5CIC FilteredDecimated and scaled error signal

Software Stack

Backend

Rust + Axum HTTP server running on the Zynq ARM Cortex-A9.

  • • Memory-mapped I/O via /dev/mem
  • • REST API for scope & control
  • • Mock mode for development

Frontend

Vue 3 + TypeScript SPA with real-time visualization.

  • • uPlot for 16k-sample waveforms
  • • 20 FPS scope refresh rate
  • • Allan deviation analysis

FPGA

SystemVerilog on Xilinx Zynq-7010/7020 (Red Pitaya).

  • • Vivado 2020.1 synthesis
  • • cocotb simulation testbench
  • • AXI4-Lite register interface