ad9226_cyclone5_w5500
Driving the W5500 Straight from an FPGA — No MCU Required: An AD9226 High-Speed Data Acquisition System
요약
이 프로젝트는 AD9226 12-bit ADC로 디지털화한 신호를 Cyclone V FPGA가 수집하고, WIZnet W5500을 통해 UDP로 PC에 스트리밍하는 데이터 수집(DAQ) 파이프라인입니다. 주목할 점은 MCU도, 소프트웨어 TCP/IP 스택도 없이 작은 RTL 상태머신이 W5500의 하드웨어 TCP/IP 스택을 직접 구동한다는 것입니다. 네트워크 처리를 칩 외부로 분리해, FPGA는 데이터 경로 설계에만 집중할 수 있습니다.
개요
FPGA로 계측 시스템을 만들 때 가장 까다로운 부분 중 하나는 네트워크 연결입니다. TCP/IP 스택을 FPGA fabric에 직접 구현하면 상당한 로직 자원을 소모하고, 검증 부담도 커집니다. 그렇다고 별도 MCU를 붙이면 시스템이 복잡해지고 데이터 경로에 병목이 생깁니다.
이 프로젝트는 그 사이의 실용적인 해법을 제시합니다. 고속 ADC 데이터를 FPGA가 수집하되, 네트워크 전송은 W5500이라는 하드웨어 TCP/IP 칩에 위임하는 구조입니다. 대상 독자는 고속 센서·계측 데이터를 PC로 보내야 하는 FPGA 개발자와 계측 엔지니어입니다.
이 프로젝트는 harout의 concurrent-data-capture를 기반으로 AD9226 + Cyclone V + W5500 조합에 맞게 재구성되었습니다.
→ 원본 저장소: https://github.com/GasilinDV/ad9226_cyclone5_w5500 → 기반 프로젝트: https://github.com/harout/concurrent-data-capture
아키텍처
전체 데이터 경로는 아날로그 신호에서 시작해 PC의 UDP 수신으로 끝납니다. FPGA 내부는 동기화 → 패킹 → 버퍼링 → 네트워크 전송의 네 단계 모듈로 명확히 분리되어 있습니다.
- 수집: ADC 12-bit 샘플을 시스템 클럭에 동기화 후, 여러 샘플을 48-bit 워드로 묶어 패킹
- 버퍼링: FIFO가 수집 속도와 전송 속도의 차이를 흡수 (
full/empty신호로 제어) - 전송:
wiznet5500모듈이 일정 주기(LENGTH_UDP단위)마다 W5500에 SEND 명령을 발행
기술 특징
이 설계의 강점은 모듈 분리와 명확한 흐름 제어에 있습니다. 각 기능이 독립 모듈로 나뉘어 있어 개별 검증과 재사용이 쉽습니다.
- 모듈 분리 설계: 동기화(
adc_data_sync), 패킹(ad9226_data), 버퍼링(fifo), 네트워크(wiznet5500)를 독립 구성 - 샘플 패킹: 12-bit 샘플 4개를 48-bit 워드로 묶어 SPI 전송 오버헤드를 줄임
- FIFO 백프레셔:
fifo_full·ethernet_available신호로 과수신을 방지 - 검증 체계: ModelSim 기반 통합 testbench와 ADC·FIFO·W5500 인터페이스 모듈별 개별 testbench 제공
- 언어: 전체 SystemVerilog(RTL) 기반, Tcl 시뮬레이션 스크립트 동봉
Where WIZnet Fits — W5500 적용 구조
이 프로젝트의 핵심은 W5500을 하드웨어 TCP/IP 오프로딩 엔진으로 실제 활용한다는 점입니다. FPGA는 네트워크 스택을 전혀 구현하지 않고, SPI로 W5500의 레지스터와 TX 버퍼만 직접 제어합니다. 실제로 wiznet5500 모듈 주석에도 "여기서 실제로 쓰는 기능은 UDP 패킷 전송뿐"이라고 명시되어 있습니다.
초기화 시퀀스에서 FPGA는 W5500을 UDP 통신이 가능한 상태로 완전히 구성합니다.
| 설정 항목 | 값 / 동작 |
|---|---|
| Socket 0 모드 | UDP 모드 (Sn_MR = 0x02) |
| MAC 주소 | 00:16:36:DE:58:F6 |
| 소스 IP / 게이트웨이 / 서브넷 | 192.168.0.12 / 192.168.0.8 / 255.255.255.0 |
| 소스 포트 | 5000 |
| 목적지 IP / 포트 | 192.168.0.108 / 5000 |
| TX 버퍼 | 16 KB 할당 |
| PHY | 100 Mbps Full-Duplex |
| 전송 시퀀스 | OPEN → TX 버퍼 push → SEND |
여기서 중요한 것은 역할 분담입니다. FPGA는 단지 SPI로 레지스터 명령과 데이터를 보낼 뿐이고, UDP·IP·Ethernet 프레이밍, 체크섬 계산, 실제 전송은 모두 W5500 하드웨어가 전담합니다. FPGA fabric에 네트워크 스택을 올렸다면 소모됐을 로직 자원이 그대로 절약되는 셈입니다.
- 기존 구조의 부담: FPGA가 TCP/IP를 fabric에 구현 → 로직 자원 대량 소모, 검증 복잡
- W5500 적용 구조: SPI로 분리된 하드웨어 스택에 위임 → FPGA RTL은 작은 상태머신으로 단순화
- 기대 효과: fabric 자원 절감, 설계·검증 난이도 감소, 표준 이더넷으로 PC 직결
비즈니스 가치
W5500을 활용한 이 구조는 FPGA 기반 계측·수집 시스템에 직접적인 가치를 제공합니다.
- 외부 고객 가치: 네트워크 스택 구현 부담 없이 고속 DAQ 결과를 표준 UDP로 PC에 전송. 전용 인터페이스 카드나 별도 MCU가 불필요
- 내부 기술 인사이트: W5500이 MCU뿐 아니라 FPGA의 네트워크 오프로딩 솔루션으로도 유효함을 보여주는 레퍼런스. HDL에서 W5500 레지스터를 직접 제어하는 사례는 FPGA 생태계 확산 포인트
실제 적용 시나리오는 다음과 같습니다.
- 산업 계측: 진동·전류·압력 센서의 고속 샘플을 실시간 수집·전송
- 과학 실험 장비: 오실로스코프형 신호 캡처 후 PC 분석 파이프라인 연동
- 음향·초음파 모니터링: 고샘플레이트 신호를 네트워크로 스트리밍
- 고속 센서 어레이: 다채널 ADC 데이터를 표준 이더넷으로 집약
한계 및 개선 방향
이 프로젝트는 FPGA에서 W5500을 직접 구동하는 간결하고 검증 가능한 레퍼런스라는 점에서 가치가 큽니다. 다만 실사용 확장 시 고려할 개선 기회가 있습니다.
현재 한계
- 처리량 상한: SPI 쓰기 속도와 100 Mbps PHY가 지속 전송률을 제한. AD9226의 풀 샘플레이트를 그대로 전송하기는 어려움 (코드도 "버퍼 채우는 속도가 전송보다 느려야 한다"고 전제)
- UDP 신뢰성: 재전송·순서보장·흐름제어 없음 → 패킷 손실 시 샘플 유실 가능
- 고정 구성: IP·MAC·포트가 RTL에 하드코딩 → 배포 환경 변경 시 재합성 필요
- 단일 소켓: Socket 0만 사용
개선 방향
- 다중 소켓 활용: W5500의 8개 소켓을 활용해 제어 채널과 데이터 채널 분리
- 구성 외부화: 스위치·플래시 등으로 네트워크 파라미터를 런타임 설정
- 상위 대역폭 요구 시: 기가비트급 처리량이 필요하면 WIZnet의 상위 라인업 검토
- 신뢰성 보강: 시퀀스 번호·재요청 등 경량 애플리케이션 레이어 추가 고려
FAQ
Q. FPGA에서 W5500을 제어하기 어렵나요? A. SPI 마스터 상태머신만 구현하면 됩니다. 이 프로젝트처럼 레지스터 주소와 명령을 상수로 정의하고 순서대로 발행하는 방식으로, 비교적 단순한 RTL로 구현 가능합니다.
Q. MCU를 쓰지 않는 게 어떤 장점이 있나요? A. 데이터 경로에서 MCU 개입이 사라져 지연·병목이 줄고, 시스템이 단순해집니다. FPGA가 ADC부터 네트워크까지 단일 클럭 도메인에서 일관되게 처리할 수 있습니다.
Q. 왜 TCP가 아니라 UDP를 사용하나요? A. 고속 스트리밍에서는 약간의 손실보다 낮은 지연과 단순한 흐름이 중요한 경우가 많습니다. W5500은 UDP 모드에서 헤더·체크섬을 하드웨어로 처리하므로 FPGA 부담이 최소화됩니다.
Q. 처리량이 부족하면 어떻게 하나요? A. SPI 클럭을 높이거나, 샘플 패킹 효율을 개선하거나, 더 높은 대역폭이 필요할 경우 상위 컨트롤러 검토가 가능합니다.
Q. 다른 FPGA로 이식할 수 있나요? A. 핵심 로직이 SystemVerilog 표준 RTL이라 이식성이 좋습니다. 핀 매핑과 클럭 설정을 대상 FPGA에 맞게 조정하면 됩니다.
Summary
This project builds a data acquisition (DAQ) pipeline. A Cyclone V FPGA captures signals digitized by an AD9226 12-bit ADC, then streams them to a PC over UDP through a WIZnet W5500. What stands out is that a small RTL state machine drives the W5500's hardware TCP/IP stack directly — with no MCU and no software TCP/IP stack. By offloading networking to an external chip, the FPGA can focus entirely on the data path.
Overview
When you build a measurement system on an FPGA, network connectivity is one of the trickiest parts. Implementing a TCP/IP stack inside the FPGA fabric consumes significant logic resources and adds a heavy verification burden. Adding a separate MCU instead makes the system more complex and introduces a bottleneck in the data path.
This project offers a practical answer in between. The FPGA captures the high-speed ADC data, while networking is delegated to the W5500, a hardware TCP/IP chip. The intended readers are FPGA developers and measurement engineers who need to push high-speed sensor data to a PC.
This project is built on harout's concurrent-data-capture, adapted for the AD9226 + Cyclone V + W5500 combination.
→ Source repository: https://github.com/GasilinDV/ad9226_cyclone5_w5500 → Base project: https://github.com/harout/concurrent-data-capture
Architecture
The full data path starts at an analog signal and ends at a UDP receiver on the PC. Inside the FPGA, the design splits cleanly into four module stages: synchronization → packing → buffering → network transmission.
- Capture: The design synchronizes the 12-bit ADC samples to the system clock, then packs several samples into a 48-bit word.
- Buffering: A FIFO absorbs the difference between capture rate and transmission rate, controlled by
full/emptyflags. - Transmission: The
wiznet5500module issues a SEND command to the W5500 at a fixed interval (in units ofLENGTH_UDP).
Technical Highlights
The strength of this design lies in clean module separation and clear flow control. Each function sits in its own module, which makes individual verification and reuse straightforward.
- Modular design: Synchronization (
adc_data_sync), packing (ad9226_data), buffering (fifo), and networking (wiznet5500) are kept independent. - Sample packing: The design packs four 12-bit samples into one 48-bit word, reducing SPI transfer overhead.
- FIFO backpressure: The
fifo_fullandethernet_availablesignals prevent overruns. - Verification: The project ships a ModelSim integration testbench plus per-module testbenches for the ADC, FIFO, and W5500 interface.
- Language: The whole design is SystemVerilog (RTL), with bundled Tcl simulation scripts.
Where WIZnet Fits
The heart of this project is that it uses the W5500 as a true hardware TCP/IP offload engine. The FPGA implements no network stack at all. It only drives the W5500's registers and TX buffer directly over SPI. The wiznet5500 module even notes in its comments that the only function actually used here is UDP packet transmission.
During initialization, the FPGA fully configures the W5500 for UDP communication.
| Setting | Value / Action |
|---|---|
| Socket 0 mode | UDP mode (Sn_MR = 0x02) |
| MAC address | 00:16:36:DE:58:F6 |
| Source IP / Gateway / Subnet | 192.168.0.12 / 192.168.0.8 / 255.255.255.0 |
| Source port | 5000 |
| Destination IP / port | 192.168.0.108 / 5000 |
| TX buffer | 16 KB allocated |
| PHY | 100 Mbps Full-Duplex |
| Send sequence | OPEN → push to TX buffer → SEND |
The key point is the division of labor. The FPGA only sends register commands and data over SPI. The W5500 hardware handles all UDP, IP, and Ethernet framing, checksum calculation, and the actual transmission. This saves exactly the fabric logic resources a soft network stack would have consumed.
- Burden of the conventional approach: The FPGA implements TCP/IP in fabric, consuming heavy logic resources and complicating verification.
- W5500 approach: Delegate to a hardware stack separated over SPI, so the FPGA RTL shrinks to a small state machine.
- Expected benefits: Lower fabric usage, reduced design and verification effort, and a direct PC connection over standard Ethernet.
Business Value
This W5500-based structure delivers direct value to FPGA-based measurement and acquisition systems.
- External customer value: Stream high-speed DAQ results to a PC over standard UDP, with no burden of implementing a network stack. No dedicated interface card or separate MCU is required.
- Internal technical insight: This is a reference showing that the W5500 works as a network offload solution for FPGAs, not only MCUs. Driving W5500 registers directly from HDL is a strong point for expansion into the FPGA ecosystem.
Real-world application scenarios include the following.
- Industrial measurement: Capture and stream high-speed samples from vibration, current, or pressure sensors in real time.
- Scientific instruments: Capture oscilloscope-style signals and feed a PC analysis pipeline.
- Acoustic / ultrasonic monitoring: Stream high-sample-rate signals over the network.
- High-speed sensor arrays: Aggregate multi-channel ADC data over standard Ethernet.
Limitations and Future Improvements
This project is valuable as a concise, verifiable reference for driving the W5500 directly from an FPGA. That said, several improvement opportunities are worth considering when scaling it for production.
Current limitations
- Throughput ceiling: SPI write speed and the 100 Mbps PHY limit the sustained transfer rate. Streaming the AD9226's full sample rate as-is is difficult. The code itself assumes the buffer fills more slowly than it drains.
- UDP reliability: There is no retransmission, ordering, or flow control, so packet loss can drop samples.
- Fixed configuration: IP, MAC, and ports are hardcoded in RTL, so changing the deployment environment requires re-synthesis.
- Single socket: Only Socket 0 is used.
Future improvements
- Use multiple sockets: Leverage the W5500's eight sockets to separate control and data channels.
- Externalize configuration: Set network parameters at runtime via switches, flash, or similar.
- For higher bandwidth needs: If gigabit-class throughput is required, consider WIZnet's higher-tier lineup.
- Strengthen reliability: Consider a lightweight application layer with sequence numbers or re-request logic.
FAQ
Q. Is it hard to control the W5500 from an FPGA? A. You only need to implement an SPI master state machine. As in this project, you define register addresses and commands as constants and issue them in sequence — a relatively simple RTL approach.
Q. What is the advantage of not using an MCU? A. Removing the MCU from the data path reduces latency and bottlenecks and simplifies the system. The FPGA handles everything from ADC to network within a single clock domain.
Q. Why use UDP instead of TCP? A. In high-speed streaming, low latency and simple flow often matter more than avoiding minor loss. In UDP mode, the W5500 handles headers and checksums in hardware, minimizing the load on the FPGA.
Q. What if throughput is insufficient? A. You can raise the SPI clock, improve sample packing efficiency, or consider a higher-bandwidth controller if you need more.
Q. Can this be ported to other FPGAs? A. The core logic is standard SystemVerilog RTL, so portability is good. You adjust pin mapping and clock settings to match the target FPGA.
