Lab 7.2 — DUC/DDC Frequency Translation¶
Goal¶
Model digital upconversion and downconversion in a TX/RX chain and verify that the target signal moves to the expected frequency at each stage.
The lab answers the practical question:
How do TX digital offset, RF LO frequencies and RX DDC shift determine where the signal appears in the final baseband?
Executable files¶
| Environment | File | Output |
|---|---|---|
| Python | blocks/block_07_tx_rx_chains/python/lab_7_2_duc_ddc_frequency_translation.py |
FFT figures + metrics JSON in docs/assets |
Run from the repository root:
python blocks/block_07_tx_rx_chains/python/lab_7_2_duc_ddc_frequency_translation.py
Generated artifacts:
docs/assets/lab72_duc_ddc_tx_spectrum.png
docs/assets/lab72_duc_ddc_rx_spectrum.png
docs/assets/lab72_duc_ddc_frequency_plan.png
docs/assets/lab72_duc_ddc_metrics.json
Processing chain¶
flowchart LR
BB[Baseband tone] --> DUC[DUC mixer]
DUC --> RFPLAN[RF frequency plan]
RFPLAN --> RX[Receiver baseband]
RX --> DDC[DDC mixer]
DDC --> OUT[Near-DC output]
Frequency equations¶
TX RF tone:
f_rf = f_tx_lo + f_tx_offset
Receiver observed baseband offset:
f_rx_obs = f_rf - f_rx_lo
After DDC:
f_out = f_rx_obs + f_ddc_shift
Correct DDC choice:
f_ddc_shift = -f_rx_obs
Example¶
| Parameter | Value |
|---|---|
| TX LO | 915 MHz |
| TX digital offset | +100 kHz |
| RX LO | 915 MHz |
| RX observed offset | +100 kHz |
| DDC shift | -100 kHz |
| Final output offset | 0 Hz |
Practical procedure¶
- Generate a complex tone at baseband.
- Apply DUC shift.
- Interpret the result through the RF frequency plan.
- Generate a receiver IQ signal at the observed offset.
- Apply DDC shift.
- Plot FFT before and after DDC.
- Estimate output peak frequency.
- Verify that the output peak is close to DC.
Expected plots¶
- TX baseband spectrum;
- after DUC spectrum;
- RX observed spectrum;
- after DDC spectrum;
- frequency error summary.
Metrics generated by the script¶
| Metric | Meaning |
|---|---|
tx_rf_hz |
RF frequency implied by TX LO and DUC shift |
rx_observed_offset_hz |
expected receiver baseband offset |
ddc_shift_hz |
digital shift applied in RX DDC |
rx_peak_hz |
measured peak before DDC |
final_peak_hz |
measured peak after DDC |
final_frequency_error_hz |
final peak minus expected final frequency |
snr_db |
rough SNR estimate after DDC |
Common sign mistakes¶
| Mistake | Symptom | Fix |
|---|---|---|
| DDC sign is wrong | signal moves farther from DC | use negative observed offset |
| TX/RX LO relation ignored | expected peak is wrong | compute TX_LO + offset - RX_LO |
| real mixer used instead of complex mixer | image appears | use complex IQ mixing |
| sample rate mismatch | peak appears at wrong FFT bin | check metadata sample rate |
| IQ conjugation | spectrum mirrored | check I/Q ordering and sign convention |
What to expect¶
TX LO: 915.000000 MHz
RX LO: 915.000000 MHz
TX DUC shift: 100000.000 Hz
TX RF frequency: 915100000.000 Hz
RX observed offset: 100000.000 Hz
DDC shift: -100000.000 Hz
RX peak: 100012.207 Hz
Final peak after DDC: 0.000 Hz
Final frequency error: 0.000 Hz
SNR estimate after DDC: 78.94 dB
- The frequency plan is pure arithmetic:
915.000 + 0.100 − 915.000 = +0.100 MHzobserved, so a DDC shift of −100 kHz brings the tone to 0 Hz. - The "RX peak 100 012 Hz" is bin quantization (12 Hz), and after the DDC the tone lands exactly on bin 0. A real link would add the oscillator offsets of both boards, which is what the CFO estimators of Block 8 remove.
Exercises¶
- Flip the sign of the DDC shift. Where does the tone land, and would you notice the mistake if you only looked at the spectrum shape?
- Set the RX LO to 915.030 MHz. Compute the observed offset and the DDC shift you need, then check.
- On real hardware the two LOs differ by about 0.3 ppm (see Lab 11.30). How many hertz of residual offset does that leave at 915 MHz after the DDC?
Answers (checked by running the lab script)
- With a DDC shift of +100 kHz the tone lands at +200 kHz (measured 199 988 Hz) instead of 0 Hz. The spectrum shape is identical, so only knowing where the tone should be reveals the mistake; the script's own error line stays small because it compares against the shift you configured.
- Observed offset
915.000 + 0.100 − 915.030 = +0.070 MHz, so the DDC shift is −70 kHz; the run puts the tone at 0 Hz (RX peak 69 983 Hz before the DDC, bin quantization). 0.3·10⁻⁶ × 915 MHz ≈ 275 Hz. The DDC removes the planned offset, not the unknown one: this residual is what the CFO estimators of Block 8 measure.
Report checklist¶
- State TX LO and RX LO.
- State TX digital offset.
- Compute RX observed offset.
- Select DDC shift.
- Plot FFT before DDC.
- Plot FFT after DDC.
- Estimate output frequency error.
- Explain any residual offset.
Engineering conclusion template¶
The TX/RX frequency plan predicts an RX observed offset of ____ Hz.
Using DDC shift ____ Hz, the final output peak is ____ Hz.
The residual frequency error is ____ Hz and is mainly caused by ______.