Перейти к содержанию

Lab 8.20 — CSS chirp waveform and symbol mapping

Goal

Build the signal-level foundation used by chirp spread spectrum (CSS) systems:

  • generate a complex baseband upchirp;
  • map an integer symbol to a cyclic chirp shift;
  • inspect instantaneous frequency and a time-frequency view;
  • dechirp the received symbol with a conjugate reference chirp;
  • verify that the symbol becomes a single FFT peak.

This lab intentionally implements a generic educational CSS waveform. It is not yet a complete LoRa-compatible packet PHY: preamble, header, whitening, interleaving, coding and CRC are outside this step. The complete LoRa-compatible PHY (packet framing, hard/soft decoding validated against recorded SX1262 IQ, and time-of-arrival/TDoA positioning with an FPGA path) is developed in the companion project zynq-lora-phy.

Key relations

For spreading factor SF and bandwidth BW:

N  = 2^SF
Ts = 2^SF / BW

With the default SF=7 and BW=125 kHz, one symbol contains 128 chips and lasts 1.024 ms.

Processing chain

flowchart LR
    IDX[symbol index] --> SHIFT[cyclic chirp shift]
    REF[reference upchirp] --> SHIFT
    SHIFT --> TX[CSS symbol]
    TX --> MUL[multiply by conjugate upchirp]
    REF --> CONJ[conjugate]
    CONJ --> MUL
    MUL --> FFT[FFT]
    FFT --> PEAK[peak bin]

Run

python blocks/block_08_modulation_and_synchronization/python/lab_8_20_css_waveform.py

Generated artifacts

docs/assets/lab820_css_upchirp_frequency.png
docs/assets/lab820_css_symbol_spectrogram.png
docs/assets/lab820_css_dechirped_fft.png
docs/assets/lab820_css_metrics.json

What to verify

  • the complex envelope remains constant within numerical precision;
  • the upchirp sweeps through the configured bandwidth;
  • the cyclic shift changes the encoded symbol without changing envelope power;
  • dechirping concentrates the symbol energy into one FFT bin;
  • the detected bin matches the configured symbol index in the noiseless case.

Engineering questions

  1. Why is a constant-envelope waveform attractive for a nonlinear or power-limited transmitter?
  2. What changes when the sample rate is higher than the signal bandwidth?
  3. Why does dechirping convert a chirp into a tone?
  4. Which blocks map naturally to FPGA: chirp NCO, complex multiplier, FFT or peak detector?

What to expect

With SF = 7, BW = 125 kHz: 128 chips per symbol, 1.024 ms per symbol, constant-envelope error at floating-point precision (2e-16). Symbol 37 dechirps to FFT bin 37, while the raw upchirp peaks at bin 0. In this noiseless case the peak-to-second ratio (192 dB) only reflects numerical precision; Lab 8.21 shows what noise does to it.

Exercises

  1. Change SF to 9. How many chips and how many milliseconds per symbol? How many bits does one symbol carry?
  2. Encode symbol 127 and symbol 0. Where do they land after dechirping, and why do neighbouring symbols sit on neighbouring bins?
  3. Multiply the received chirp by a small frequency offset (a quarter of a bin). What happens to the peak bin and to its height?
Answers (checked by running the lab script)
  1. 2^9 = 512 chips, 512 / 125 kHz = 4.096 ms per symbol, 9 bits per symbol. Each step of SF doubles the symbol time and adds one bit: the bit rate falls and the sensitivity rises.
  2. Symbol 0 dechirps to bin 0 and symbol 127 to bin 127. A CSS symbol is the base chirp cyclically shifted by its value; after multiplying by the conjugate base chirp, a shift of m chips becomes a tone at m bins, so neighbouring symbols are neighbouring frequencies.
  3. A quarter-bin offset leaves the peak in the same bin (37) but lowers it by 0.91 dB, and the neighbouring bin rises to 9.5 dB below the peak: the tone now sits between bins (scalloping, as in Lab 3.1). At half a bin the two bins would be equal, which is the limit Lab 8.21 measures.

Report checklist

  • Record SF, BW, sample rate and symbol duration.
  • Include the instantaneous-frequency plot.
  • Include the time-frequency plot.
  • Include the dechirped FFT and detected bin.
  • State clearly that this is CSS signal processing, not yet a complete LoRa packet implementation.