Prototyping with MCLP, and designing for RF data converters
How to prototype a weighing product with the MCLP core, and how the same converter chain looks on an RFSoC: aliasing, clock jitter, converter alignment, bit widths, the DAC side, the board and testing.
Two of my designs sit at opposite ends of data conversion. MCLP, the load-cell core from this series, reads each converter at 4800 samples per second and puts out a weight at 50 Hz. My 8-channel RFSoC SDR moves 491.52 million complex samples per second on every channel.
The two designs look unrelated, but they use the same chain. An analog front end feeds a converter. A decimating filter follows, then more filtering and correction, and then a stream to software. On AMD's Zynq UltraScale+ RFSoC, the RF Data Converter is the converter in that chain, and the signal is a radio band instead of a load cell.
The same receive chain at 4800 samples/s and at GSPS.
Prototyping with the MCLP core
The core is a packaged Vivado IP, mclp:ip:mclp_core:2.0, with two parameters. The first is the number of converters, from 1 to 64. The second is USE_NN, which includes the inference engine. To use the core, connect these ports:
- Connect
s_axito an AXI4-Lite master. The registers and the model memories take a 64 KB window. - Connect
m_axis_raw, a 64-bit stream, to an AXI DMA write channel. This port is optional. Iftreadystays low, the core drops raw records, and the weight path keeps running. - Connect
aclkandaresetnto the AXI clock and its reset. - Connect
clk_spi,clk_dspandclk_lockedto the 20 MHz and 50 MHz outputs of an MMCM and to itslockedoutput. The core derives the SPI timing from the 20 MHz clock, so that frequency is fixed. Reset the MMCM from the AXI reset, so thatclk_lockedis low wheneveraresetnis low. - Connect
irqto the interrupt controller, and thespi_*andadc_sync_nports to the AD7190 pins.
The clock-domain crossings inside the core carry their own constraints. The pins only need the false paths in the constraint file of the repository.
The quickest start is the ZC702 reference design with the ADC card from part 2. The v2.0.0 release has the packaged core and prebuilt Linux boot files for an SD card. On a new board, three commands check the system from the inside out:
sudo mclp status # ID 4D4C0508, clocks locked, sequencer streaming
sudo mclp bist # loopback BIST through the whole capture path
sudo mclp selftest # per channel: open wire, missing reference, offset and noise
The BIST replaces the converters with an emulator inside the FPGA. A pass means that the FPGA, the DMA and the software work before any analog part is involved. The self-test then checks the card, the cables and the load cells.
Calibration comes last, in three steps:
- Measure the offsets with nothing on the scale.
- Put a test weight over each cell in turn to get the corner trims.
- Set the span from the mass of the test weight.
If the build includes the inference engine, mclp nn shows the loaded model, its CRC-32 and the last correction.
Other boards need a few changes:
- On another Zynq-7000 board, set the part and the board preset in the project script, and regenerate the processor configuration. Put the 12 converter signals in a bank whose voltage matches the digital supply of the converters.
- On a Zynq UltraScale+ MPSoC, replace the processor block and remap its ports. Its HP I/O banks stop at 1.8 V. So the converter signals go on HD banks, which support 3.3 V, or through level translators.
- On an FPGA without a hard processor, drive the registers from MicroBlaze or from a host bridge such as UART or PCIe. Point the DMA at a memory controller.
- An FMC carrier with VADJ fixed at 1.8 V or 2.5 V needs level translators on the card.
Software reads the channel count from the ID register of the core. Thus a design with a different number of channels runs the same software. The core is open hardware under the CERN-OHL-S v2, with the software under the GPL-3.0. A commercial license is also available.
Filtering before the rate drops
When a converter samples at a rate fs, every frequency folds onto the band between 0 and fs/2. You must filter out anything that would land on the wanted signal before it folds.
In MCLP, most of that filtering is digital. The AD7190 is a sigma-delta converter. Inside the chip, it samples much faster than its output rate of 4800 samples/s and filters digitally. So the analog filter in front only has to stop radio pickup and noise near the internal sampling rate. A 100 Ω resistor and a 100 nF capacitor do that.
Later, the CIC filter of the core drops the rate from 4800 to 600 Hz. Its nulls sit at the multiples of 600 Hz, where noise would fold in.
An RF-sampling ADC has no such filter inside. It samples everything that reaches its input within its analog bandwidth. Thus the band-pass filter in front decides what folds into the wanted band.
Direct RF sampling uses this folding on purpose. A signal above fs/2, in the second or third Nyquist zone, folds down into the first zone without an analog mixer. This works as long as the filter keeps out everything else that would fold onto the same place. The choice of sample rate becomes frequency planning. The wanted band, its harmonics and the spurs of the converter must land away from each other.
The digital side looks like MCLP again. Each RF-ADC on the RFSoC has a digital down-converter. It mixes the band to baseband with a 48-bit NCO and decimates it. Gen 3 and DFE devices decimate by 1x to 40x. The decimation filters keep 80% of the Nyquist bandwidth with 89 dB of stop-band attenuation. Thus they remove everything outside the kept band before the lower rate can fold it in.
Clock jitter
If the sampling instant moves by a time σ, the converter samples the signal at the wrong point on its slope. That error shows up as noise. For a full-scale sine at frequency f, clock jitter alone limits the signal-to-noise ratio to:
SNR_jitter = -20 log10(2π f σ)
In MCLP, the final filter passes up to about 12 Hz. At 12 Hz, even 1 ns of jitter limits the SNR to 142 dB, far below the other noise sources in the system. The converters share one oscillator to stay synchronized, and its jitter doesn't affect the result.
At 1 GHz, 100 fs of rms jitter limits the SNR to 64 dB. An ideal 14-bit converter reaches 6.02 × 14 + 1.76 = 86 dB. So at that frequency, the clock sets the noise floor, not the converter. To stay below the noise of the converter at 1 GHz, the jitter must be under about 8 fs rms. In an RF design, the clock source, its PLL and its routing on the board are part of the analog signal path.
Keeping converters aligned
The corner trims in MCLP only work if the core measures all load cells at the same moment. So the converters share one clock and one SYNC line.
On the RFSoC, the converters are in groups called tiles. Each tile has its own clocking and its own FIFO into the FPGA fabric. Thus each tile can run at its own sample rate and data width. The latency is fixed within a tile but not between tiles. The FIFOs cross from the converter clock to the fabric clock, and the latency through such a FIFO can change from one start-up to the next. Beamforming, phased arrays and MIMO need every channel aligned to the sample, across tiles and sometimes across chips.
AMD's Multi-Tile Synchronization solves this. An analog SYSREF in the converter clock domain and a PL SYSREF in the fabric clock domain give every tile a common time reference. The driver measures the latency of each tile against them. It adds delay until all tiles match.
With a target latency set, the total latency is also the same after every start-up. The SYSREF frequency must divide evenly into every fabric clock involved. This ties the clock plan to the sample-rate plan.
Bit widths and headroom
In MCLP, every stage has a known width:
| Stage | Width | Why |
|---|---|---|
| ADC code | 24 | The converter |
| CIC | 33, keep 32 | 3 stages × log2(8) = 9 bits of growth |
| Gain, offset, trim | 32 | Q2.30 multiply, saturating |
| Sum of 64 | 40 | Exact, with an overload flag |
| FIR | 64 | Full precision |
| Weight | 32 | Shifted by the channel count, then limited |
Two rules from that table also apply to RF designs. First, saturate instead of wrapping, and report the saturation. A wrapped sample is a large error that looks like normal data. Second, keep the bits that decimation adds. An average of white noise over R samples improves the SNR by about 10 log10(R) dB. For the CIC's R = 8, that is about 9 dB, and a truncation that comes too early throws it away.
RF signals add a third rule: leave room for peaks. The peak of a sine is 3 dB above its rms level. A signal made of many carriers has peaks well above that. The RF-ADC delivers 14 bits, MSB-aligned in a 16-bit path. The gain in front of it is set so that the peaks don't clip. For this, Gen 3 and DFE devices have a digital step attenuator on each RF-ADC.
The DAC side
MCLP has no DAC. The load-cell excitation is a DC voltage. A radio also transmits, and the transmit chain mirrors the receive chain. The RF-DAC interpolates by 1x to 40x on Gen 3 and DFE devices, with a further 2x after the mixer. An NCO mixes the signal up to its carrier.
A DAC holds each sample for a full sample period. This has two effects. The output level rolls off as sin(x)/x across the band. Also, copies of the signal appear around every multiple of the sample rate. The RF-DAC has an inverse sinc filter to flatten the roll-off. An analog filter after the DAC removes the copies, or it selects one of them as the output. On the receive side, direct RF sampling uses a higher Nyquist zone in the same way.
The board
The ADC card in part 2 has no controlled impedance. Its fastest signals are a 4.9 MHz clock and the SPI lines, so the traces behave as plain wires. The hard part on that board is microvolts. It needs symmetric analog pairs, small temperature differences and digital lines that stay away from analog lines.
On an RF board, every RF trace is a transmission line with a controlled impedance. Baluns or matched amplifiers drive the converter inputs differentially, and the differential pairs are length-matched. The sample clock gets its own isolated routing. Noise on the analog supplies of a converter shows up as spurs in its output, so each supply gets its own filtering.
On both boards, every trace runs over an unbroken return path. On the ADC card, the return path keeps millivolt signals quiet. On an RF board, the trace impedance depends on it.
Testing the whole path
For MCLP, I used three methods:
- I matched my CIC and FIR against AMD's cores bit for bit.
- I put an AD7190 emulator inside the FPGA, so that the whole path can run from a known pattern.
- I ran the shipped software against the RTL in co-simulation, as part 3 shows.
On an RFSoC, the same approach works with one change. The RF Data Converter is a hard block. A co-simulation of the logic around it needs a model at its AXI4-Stream ports, and only hardware can test the analog side. On hardware, a cable from an RF-DAC output to an RF-ADC input sends a known waveform through the whole chain.
In my RFSoC SDR, I captured I/Q from Vivado ILA exports and from packet captures of the link traffic. I cross-correlated the I/Q against a CAZAC reference waveform to check sample alignment and data integrity. This is the same check as the loopback BIST in MCLP. A known signal goes through the whole path. Where the path is digital, the comparison is bit for bit. Where it is analog, the comparison is statistical.
The RFSoC figures here come from AMD's RF Data Converter product guide (PG269) and the RFSoC data sheet (DS889).