A single-file Verilog RTL module implementing a datasheet-accurate SPI Master interface between the 12-bit, 8-channel ADC128S022 and the DE0‑Nano (powered by Intel Altera). The design streams 12-bit MSB-first samples into FPGA logic with runtime sampling-rate control and 5 ADC acquisition modes.
| Spec | Value |
|---|---|
System Clock (clk) |
50 MHz |
SPI Clock (sclk) |
3.125 MHz |
| PLL Usage | ❌ Not used; sclk not derived from PLL or external PLL |
| Clock Source | Pure RTL divider, No PLL, No PLL Phase alignment, No jitter compensation from PLL |
| SPI Frame Size | 16 sclk cycles per SPI frame |
| Valid ADC Data Window | Bits 4–15 (12-bit) |
| Sample Capture | DOUT latched on sclk rising edge |
| DIN Update | DIN driven on sclk falling edge |
| ADC Command Sampling | ADC samples DIN internally on 3rd sclk falling edge after CS goes LOW |
| Data Width | 12 bits |
| Latency | Command accepted from 3rd edge, data read in same 16-cycle frame |
| Modes Implemented | idle, single, continuous, single_continuous, continuous_oneshot |
| Bit order | MSB-first (SPI command and data) |
| Data latency | 1 SPI frame delay (inherent ADC behavior) |
- The ADC128S022 returns conversion result one full SPI frame later because of its internal pipelined conversion mechanism.
- DIN command in frame N → 12-bit result appears on DOUT in frame N+1 (next 16-clock frame).
- This latency is internal to the ADC chip and not implemented as a pipeline inside RTL, but must be considered when interpreting hardware output.
- ✅ Datasheet-accurate SPI Master timing for ADC128S022
- ✅ Controllable sampling rate via
SAMPLES - ✅ 5 ADC modes for flexible acquisition control
- ✅ Multi-channel SCAN + ANY channel combination supported
- ✅ Behavioral + gate-level verified, with FPGA bring-up tested
- 📦 Next version supports internal M9K memory writes for sample storage
- Continuous and Single-Continuous modes validated in hardware using Signal Tap.
- Single and One-Shot modes could not be debug-triggered reliably in Signal Tap Logic Analyzer due to trigger constraints, but both modes are fully verified in behavioral and gate simulation. It can still be tested in Mixed Signal Oscilloscope.
root/
├── adc_interface.v # RTL: SPI Master + ADC control (ONLY file implemented)
├── adc_interface_tb.v # Verilog testbench (stimulus + mode coverage)
├── constraints/
│ ├── pin_constraints.qsf # Board pin mapping
│ └── adc_timing.sdc # 50 MHz system timing constraints
├── synthesis/
│ └── resource_report.txt # LE, register, and memory usage (to be added)
├── results/
│ ├── rtl_waveform.png # Behavioral sim result
│ ├── gate_waveform.png # Gate-level result
│ └── fpga_capture.png # Signal Tap capture for streaming modes
└── README.md (this)
| Stage | Status |
|---|---|
| Behavioral Simulation | ✅ All 5 modes verified |
| Gate-Level Simulation | ✅ Timing preserved after synthesis |
| FPGA Validation | ✅ Live data streaming proven |
| Signal Tap Analysis | ⚠ Single/One-Shot trigger limitation |
CS_nasserted LOW → SPI frame beginsDINupdated on every sclk falling edge- ADC samples command at 3rd falling edge (internal to ADC)
DOUTcaptured on sclk rising edge- 16 clocks total, 12-bit valid data at bits 4–15
CS_Nde-asserted HIGH → frame complete
- FPGA Bring-up → Using Quartus Prime Lite Edition (18.1)
- Simulation → Tested on ModelSim‑Intel FPGA Starter Edition
- RTL -> Bitstream flow → Quartus synthesis, place-and-route, timing closure @ 50 MHz
- Debug → Continuously monitored using Signal Tap logic triggers
A robust, protocol-compliant FPGA acquisition system demonstrating strong command of:
- ✅ Datasheet-driven RTL design
- ✅ SPI framing and edge-accurate sampling
- ✅ Multi-mode ADC control
- ✅ Clock-domain debugging without PLL dependency