Project_Detail
All_Projects

DecBGAN-legacy

A simple Inmarsat BGAN decoder

View on GitHub
README.md

BGAN Forward-Link Decoder

End-to-end Inmarsat BGAN F80T4.5X-8B forward-link decoder. Converts 8-bit/16-bit stereo IQ WAV recordings from an SDR into descrambled, FEC-corrected payload data, printable strings, and Wireshark-ready PCAP.

Bearer: F80T4.5X-8B — 16-QAM, 151.2 kBd, 80 ms TDMA frames, 8 FEC blocks per frame, 10 turbo coding levels (L3 through H6).

Quick Start

# 1. Build (requires MSYS2 mingw64)
pwsh build.ps1

# 2. Copy the built .exe + .dll files into release/bin/
#    (demod.exe, uwsync.exe, bgan_decode.exe, strings.exe, libfftw3f-3.dll, etc.)

# 3. Run from the release/ folder:
cd release
decode.bat "C:\path\to\recording.wav"

Or double-click release\bgan_gui.pyw for a full graphical interface with constellation plot, progress bars, and PCAP export.

Signal Chain

8/16-bit IQ WAV
  → Carrier derotation (bulk frequency offset removal)
  → RRC matched filter (β = 0.25, ~25 dB adjacent carrier rejection)
  → Oerder–Meyr feedforward symbol-timing recovery
  → Unit-amplitude normalisation
  → 40-bit differential UW frame sync (14 levels: L1–L8, RE, H1–H6)
  → 2nd-order frame-timing PLL + auto re-sync after 30 lost frames
  → Per-block pilot-aided linear phase detrend (11 pilots/block)
  → 16-QAM soft-LLR max-log demap
  → Turbo BCJR decode — 2 × 16-state SRCC, max-log-MAP, Annex C.1 interleaver
  → Re-encode parity check (agreement threshold 0.58)
  → PN LFSR descramble (1+X+X¹⁵, reset per block)
  → Payload bytes → strings → PCAP

Project Structure

BGAN/
├── build.ps1                 # MSYS2 mingw64 build script
├── .gitignore
├── README.md
├── src/                      # C++ decoder source (20 files)
│   ├── demod.cpp             # RRC filter + timing recovery
│   ├── uwsync.cpp            # Unique Word correlator
│   ├── bgan_decode.cpp       # Frame PLL + turbo decode + descramble
│   ├── analyze.cpp           # Spectrum / cyclostationary analysis
│   ├── diag.cpp              # Carrier offset / M4 SNR metric
│   ├── channel.cpp           # Frequency shift + decimate
│   ├── turbo.hpp             # 16-state max-log-MAP BCJR turbo codec
│   ├── tables.hpp            # ETSI Annex C.1/C.2 table loader
│   ├── qam16.hpp             # 16-QAM modulate / soft-LLR demap
│   ├── scrambler.hpp         # PN LFSR scrambler
│   ├── dsp.hpp               # FIR, RRC, NCO primitives
│   ├── iqfile.hpp            # 8/16-bit stereo WAV reader
│   └── ...                   # analysis/diagnostic tools
├── release/                  # Self-contained runtime package
│   ├── bgan_gui.pyw          # Tkinter GUI
│   ├── decode.bat            # CLI auto pipeline (single UW)
│   ├── sweep.bat             # CLI full-sweep (all UW positions)
│   ├── bin/                  # Scripts (mkpcap.py, pickuw.ps1, pickalluw.ps1)
│   ├── annex/                # ETSI turbo interleaver tables (C1 + C2, 532 .TXT)
│   ├── README.md             # User quick-start guide
│   └── CHANGELOG.md          # Change history
├── docs/                     # ETSI spec PDFs + original annex .zip downloads
└── tools/                    # Utility scripts

Prerequisites

  • MSYS2 with mingw-w64-x86_64-gcc and mingw-w64-x86_64-fftw
  • PowerShell for the build script
  • Python 3 for the GUI and PCAP generator

Build

pwsh build.ps1

Compiles all targets with -O3 -march=native -std=c++17. bgan_decode.exe links against OpenMP for parallel block decoding. Copy the resulting .exe and the required .dll files (libfftw3f-3.dll, libgomp-1.dll, libstdc++-6.dll, libgcc_s_seh-1.dll, libwinpthread-1.dll) into release/bin/.

Performance

Decode time for a 10-second recording on an i7-13700K: ~2.1 seconds. The optimized two-phase turbo decoder uses a fast 4-iteration probe before escalating to 12 iterations only if the parity-agreement threshold passes. B0's level is inherited for B1–B7, eliminating brute-force level search on 7 of 8 blocks per frame. OpenMP parallelism across frames + -march=native AVX2 auto-vectorization handle the BCJR inner loops.

Decoded Recordings

Successfully decoded captures include ICMP, TCP/TLS, DNS, MQTT, SSH, SIP/VoIP, Inmarsat certificate chains, and Splunk keep-alive traffic from real satellite signals at ~1533 MHz L-band.

PCAP Output

mkpcap.py extracts raw IPv4 packets from the decoded payload using SNDCP-aware relaxed header scanning. Writes standard .pcap with DLT 101 (LINKTYPE_RAW) — opens directly in Wireshark with full protocol dissection.

FEC Levels

Level Info bits Code Rate Notes
L3 2000 0.334 Most robust — control signalling
L2 2320 0.388
L1 2664 0.445
RE 3000 0.501 Reference level
H1 3440 0.575 User data
H2 3840 0.642
H3 4224 0.706
H4 4640 0.775
H5 4920 0.822
H6 5120 0.856 Max throughput

Diagnostics

Tool Purpose
analyze.exe PSD + cyclostationary analysis
diag.exe Carrier offset + M4 SNR metric
channel.exe Frequency shift + lowpass + decimate
maghist.exe Magnitude histogram (verify 16-QAM)
framescan.exe Blind frame periodicity detection
chain_test.exe Full-chain AWGN simulation (build validation)

Attribution

ETSI TS 102 744-2-1 V1.1.1 (2015-10) — Family SL Satellite Radio Interface, Physical Layer. Annex C.1/C.2 turbo interleaver and channel mapping tables used under licence from the standard.

License

Research / educational use only.