A long, honest walkthrough of my DMR receiver: how a cheap dongle and a pile of GNU Radio blocks can find DMR bursts, read who is talking to whom, follow a Tier III control channel, and turn the voice bits back into speech you can actually hear.

It started with a mistake. I saw a signal on 148.8 MHz that looked like P25 on the waterfall, so I built a P25 decoder for it. I ran it, and the decoder kept printing… DMR repeater syncs. So it was never P25. It was DMR all along.
I’ve been a DMR user for a while as a ham. I know the user side well: talkgroups, timeslots, colour codes, hotspots. But I realised I had never really understood what happens inside the radio between the antenna and the speaker. The radio just does it, and the MMDVM firmware just does it, and I took all of it for granted.
So I wanted to see it with my own eyes. Not “trust me, DSD did it”, but actually watch the bursts being found, the error correction being peeled off, and the voice coming out at the end. That is what this receiver does. Every stage in it is a block you can open and poke with a scope.
This write-up is the story of how it works, written for the version of me that kept pressing PTT without ever wondering what the 4FSK actually looks like.
A warning before we start: I use some DSP and coding words here (matched filter, correlation, Golay, BPTC, vocoder…). I’ll explain each one the first time it shows up. You don’t need any maths to follow the story, but there are a few equations for those who like them.
mbe-neo.dll) for the AMBE+2 voice. Without it, everything still decodes, only the audio stays silent.The files:
There is also a simpler, faster sibling, dmr_rx.grc, which does the whole decoding inside one Python block. The hier version is the same decoder, split into stages so you can watch each one.
My personal rule for these GNU Radio projects is simple:
Put each operation in a stock block if one exists. Use an Embedded Python Block (EPB) only for what GNU Radio cannot do natively.
Every stock block’s output is a stream, and every stream can be dropped into a QT GUI sink. So the more of the receiver I build from stock blocks, the more of its insides I can watch.
For DMR, Python only gets the jobs stock blocks genuinely can’t do:
Here is the whole receiver on one page:
Grey boxes are the receiver’s stock blocks, blue boxes are stock blocks inside the hier block, and amber, purple and green ones are the three Python blocks. Solid arrows are streams (numbers flowing all the time, like an audio cable). Dashed red arrows are messages (one packet per event, like an e-mail: “here is a burst”, “here is a line of text”).
DMR is naturally a mix of both. The radio signal is continuous, but the information comes in 30 ms packets. Keep this picture in mind; the rest of the story walks through it step by step.
DMR is basically FM with four fixed frequency positions, called 4FSK. The carrier sits at +1944, +648, −648 or −1944 Hz for one symbol (208 µs), then jumps to the next one. Each position carries 2 bits. That’s 4,800 symbols per second, so 9,600 bit/s.
The transmitter rounds off each jump with a root-raised-cosine (RRC) filter (roll-off 0.2), which keeps the signal inside a 12.5 kHz channel.
Time is cut into 30 ms slices that alternate: slot 1, slot 2, slot 1, slot 2… Each slot is a completely separate conversation. That’s why one repeater carries two talkgroups at once.
Please note that a repeater transmits in both slots all the time, sending “idle” bursts when nothing is going on. A mobile only transmits in its own slot, so it’s on the air half the time.
| Part | Symbols | What it is |
|---|---|---|
| CACH | 12 | A small header from the repeater: which slot comes next, is the channel busy, plus pieces of a “Short LC” message |
| Payload, first half | 54 | 108 bits of voice or data |
| Sync (or EMB) | 24 | A fixed 48-bit pattern: “a burst is here, and it is this kind”. In most voice bursts it’s replaced by a small “EMB” field |
| Payload, second half | 54 | Another 108 bits |
The sync sits in the middle on purpose. The receiver measures the timing there, and both halves of the payload end up equally close to the spot where the timing is best known. Clever.
| Unknown | Where it comes from | Typical size |
|---|---|---|
| Where the bursts start | I switch on at a random moment | Anywhere |
| Symbol timing | Where the best sampling instant sits inside each 208 µs symbol | Any fraction of a symbol |
| Tuning error | The repeater’s crystal plus my dongle’s crystal | A few hundred Hz with a TCXO, several kHz without |
| Deviation | Every transmitter is set up a bit differently | ±5 % around 1944 Hz |
| Which slot is which | The repeater tells us, in the CACH | Has to be decoded |
| Which bursts are voice B–F | Five out of six voice bursts have no sync at all | Has to be worked out from timing |
My first attempt was the usual one: FM demod, then Symbol Sync for clock recovery, then a 4-level slicer, then search for the sync bits. It sort of works. It falls short in four places:
So my approach became: stock blocks for everything that runs on every sample (filtering, correlating), Python for everything that happens once per burst.
Blocks: RTL-SDR Source → Frequency Xlating FIR Filter → Low Pass Filter
Why these odd numbers? 960,000 = 4,800 × 200. Dividing by 4 and then by 5 lands on exactly 10 samples per symbol. One symbol is 10 samples, one burst is 1,440, one voice superframe is 17,280. No fractions, no resampling anywhere. That choice saves a lot of pain later.
Block: Quadrature Demod
This is the software version of an FM discriminator. For every sample it outputs how far the frequency is from the centre at that instant. I scaled it so that 648 Hz reads as 1.0, so the four DMR tones read +3, +1, −1, −3. Those are exactly the “symbol levels” the DMR standard (ETSI TS 102 361) talks about.
A tuning error shows up as every reading being shifted up or down by the same amount. I call that the offset. The framer measures and removes it later (Part 4), so a slightly mistuned dongle still decodes.
Block: FIR Filter with RRC taps. This is the first block inside the hier block.
The transmitter shaped each symbol with an RRC filter. Running the received signal through the same shape again does two nice things:
I call the output x. It’s 48,000 numbers per second, and every 10th one, if you pick the right ones, is a clean symbol.
Which ones are “the right ones” is exactly what I don’t know yet. That’s the next part.
Every burst with a sync carries one of a handful of known 24-symbol patterns. I use each one as a fingerprint, and at every one of the 48,000 samples per second I ask: “If a sync ended right now, how well would the last 24 symbols match?”
“The last 24 symbols” means 24 samples spaced exactly 10 apart, ending at the current sample. A FIR filter whose taps are zero except at every 10th position computes exactly that. That’s why this whole detector can be built from stock blocks (16 of them in total).
The match becomes a score I call rho, between −1 and +1. Written out, with $x_k$ the 24 symbol-spaced samples and $t_k$ the fingerprint (±3):
\[\rho = \frac{\sum_k t_k\, x_k}{\sqrt{\sum_k t_k^2}\;\sqrt{\sum_k x_k^2 - \tfrac{1}{24}\big(\sum_k x_k\big)^2}}\]In blocks:
FIR Filter per fingerprint does the top line.FIR Filters add up the same 24 samples ($\sum x$) and their squares ($\sum x^2$). A handful of Multiply, Multiply Const, Subtract, Add Const and a Transcendental (sqrt) turn those into the bottom line.| Property | How | Why it matters |
|---|---|---|
| Doesn’t care how strong the signal is | Dividing by the spread cancels the signal level | One threshold (0.8) works for the repeater next door and the one 50 km away |
| Doesn’t care about tuning error | Every fingerprint has as many +3 as −3, so a constant shift adds nothing | It locks before I’ve fixed my ppm |
| One fingerprint, two answers | DMR’s data sync is the voice sync with every symbol flipped | rho ≈ +1 means voice, rho ≈ −1 means data/control |
So 4 fingerprints cover 8 sync types:
| Fingerprint | rho → +1 | rho → −1 |
|---|---|---|
| BS | repeater voice | repeater data / control |
| MS | mobile voice | mobile data |
| DM1 | direct mode, slot 1 voice | slot 1 data |
| DM2 | direct mode, slot 2 voice | slot 2 data |
It’s the same normalised-correlation trick as the preamble detector in my AIS receiver, just four fingerprints instead of one.
The bottom of the picture shows rho from the BS fingerprint on a repeater with a voice call on slot 1 and control data on slot 2:
You can see this live: drop a QT GUI Time Sink on the rho_bs output inside the hier block. It’s honestly one of my favourite screens in the whole project.
Up to here, every block works on every sample without knowing anything about bursts. The framer (an EPB) is where the receiver starts thinking in bursts. It’s the heart of the whole thing, so this part is the longest.
| The framer looks for places where | rho | ≥ 0.8 and rho is the highest point around it. A sync gives a sharp peak, but its neighbours score high too, and I only want the top. |
The true symbol centre almost never falls exactly on a sample. So I fit a parabola through the peak and its two neighbours, and take the top of the curve. That gives the burst timing to a small fraction of a sample.
Like measuring a hill’s height at three spots along a path: you can tell roughly where the summit is, even if you never stood exactly on top.
A repeater sends a burst every 30 ms, exactly. So once I’ve seen a real sync, every later real sync must land a whole number of 30 ms steps after it. A “sync” that’s off the grid gets thrown away.
The rules I ended up with:
(Why all this fuss? See war story 3.)
I know what the 24 sync symbols should be: each exactly +3 or −3. I also have what they actually read. A straight-line fit through the 24 pairs,
\[y_k = g\, s_k + o\]gives two numbers for this one burst: the gain $g$ (how big a “3” really reads) and the offset $o$ (how far every reading is shifted). Then:
| deviation = $ | g | \times 1944$ Hz. |
Both show up in the status panel. The framer then refines the fit over the whole burst: it decides all 144 symbols with the first estimate and fits again with all of them, because 144 points are steadier than 24.
This is the “use the known part as a measuring stick” trick, and it’s why I don’t need a perfectly tuned dongle. A 1 kHz error just becomes an offset that gets measured and subtracted.
Knowing the timing to a fraction of a sample, the framer reads all 144 symbols at their exact centres. It interpolates between samples with a smooth curve (Catmull-Rom), then computes $(y - o)/g$, so every symbol comes out as a clean number near +3, +1, −1 or −3.
It doesn’t round them yet. +2.1 means “probably +3, but not sure”, and +2.9 means “definitely +3”. That confidence is kept and used later by the error correction and the vocoder. Rounding now would just throw information away.
Voice is sent in superframes of six bursts, A to F, on the same slot, 60 ms apart: 360 ms of speech in total. Only burst A has a sync. In B to F, the sync position carries a 16-bit “EMB” field instead (colour code plus a piece of the caller’s info). DMR does this to squeeze more control info into a call.
So my fingerprint detector sees voice only once every 360 ms. The framer handles it like this:
If burst A is lost completely, the framer doesn’t guess. The whole superframe is skipped: 360 ms of silence, never 360 ms of garbled noise. A real radio does the same.
| Message | When | What it carries |
|---|---|---|
burst |
Once per burst | 144 symbols plus where it is, which sync, voice or data, letter A–F, gain, offset |
cach |
Every 30 ms on the grid, even without a sync | The 12 CACH symbols |
progress |
After every chunk of samples | “Every burst up to position p has been sent” (the vocoder needs this, Part 6) |
reset |
When I retune | “Forget everything about this channel” |
tick |
Every 10 s | “Time to print the status panel” |
It also outputs one stream: the reading at each symbol centre, held at 8 kHz. That drives the symbol histogram on the screen, and it’s also the vocoder’s clock.
DMR protects nearly everything with error correction: extra, carefully chosen bits that let the receiver find and repair a few wrong ones. Different parts of a burst get different codes, depending on how important they are. The Layer 2 EPB takes them off one by one, like peeling an onion.
It uses each symbol’s confidence from Part 4. This “soft” decoding repairs noticeably more errors than working with plain 0s and 1s, because the decoder knows which bits are doubtful.
The 12 CACH symbols (24 bits) are only sent by a repeater:
| Burst type | What Layer 2 prints or learns |
|---|---|
| Voice LC header | CALL Group TG=… SRC=…: a call starts, plus emergency/encryption flags |
| Terminator with LC | END …: the call ended |
| PI header | The call is encrypted (algorithm, key ID) |
| CSBK | Tier III control: C_ALOHA, C_BCAST (site, neighbours, frequencies), channel grants |
| Data header | A data transfer (GPS, text…) with source and destination |
| Idle | Nothing, just counted |
The 216 payload bits are three AMBE+2 frames of 72 bits, 20 ms of speech each. Layer 2 puts the bits back in order (the standard interleaves them, so a noise burst hits several frames a little instead of one frame badly), then sends them to the vocoder as soft values, with the slot, the burst’s position in time, and the encryption flag.
Layer 2 doesn’t error-correct the voice itself. AMBE+2 has its own protection inside each 72-bit frame, and the vocoder handles that.
The EMB field is protected by a quadratic-residue (16,7) code (fixes up to 2 wrong bits). Bursts B, C, D and E each carry 32 bits of embedded LC, 128 bits together: the same talkgroup and source ID as the voice header, with Hamming (16,11) rows, column parity and a 5-bit checksum.
Why bother? The voice header only comes at the start of a call. If you tune in halfway, you missed it. The embedded LC repeats the caller info every 360 ms during the call, so the decoder can tell you who’s talking within half a second. That’s also why your radio shows the caller ID even when you key up late.
Layer 2 also remembers everything: offset and deviation, channel type, site and neighbours, colour codes, what each slot is doing, recent calls, and counters for what was decoded and rejected (and why). Every 10 s it prints it all as the status panel.
A Tier III network doesn’t put frequencies in its grants. It sends channel numbers (LPCN) to keep the messages short. Some sites broadcast the frequency for each number (C_BCAST “Chan_Freq”); when they do, Layer 2 learns it.
When they don’t, you can enter the network’s channel plan in the block’s properties:
\[f(n) = f_{\text{ref}} + (n - n_{\text{ref}}) \times 12.5\ \text{kHz}\]One known channel number, its frequency, and the step. On the network I listened to, I confirmed the plan from three independent points before trusting it. After that, every grant and neighbour line shows a real frequency in MHz.
AMBE+2 doesn’t send a sound wave; it sends a description of one. Every 20 ms: the pitch, how loud each frequency band is, and whether each band is voiced (a vowel) or unvoiced (a hiss). That’s 49 bits of parameters plus 23 bits of protection = 72 bits. The vocoder rebuilds 160 audio samples at 8 kHz from it.
That’s why DMR sounds a bit robotic, and why a few wrong bits make it warble instead of click.
I call mbelib-neo through ctypes, using its soft-decision function. It gets each bit’s confidence from the framer, so its own error correction can repair more frames than it could with hard 0s and 1s.
AMBE+2 sends some parameters as “the change since last frame”, so the decoder has memory. The block keeps one vocoder state per slot, and resets it when a new call starts (no voice on that slot for more than about 0.2 s). Otherwise the new talker would start with the last talker’s voice.
Encrypted calls are muted. Decoding them would just give loud noise. You get one “encrypted call: audio muted” line instead.
The obvious design is a queue: decode three frames, push 60 ms of audio, let the sound card pull it out. I tried that first and didn’t like it (war story 4):
So instead, each burst’s 60 ms of audio is written into a timeline at the moment it was on the air, plus a fixed delay $D$ (0.4 s by default). The burst’s sample position $p$ (at 48 kS/s), recorded by the framer, says exactly where:
\[\text{audio index} = \frac{p + D \times 48000}{6}\]The division by 6 is because six 48 kS/s samples make one 8 kHz audio sample. A pause stays a pause, a lost burst becomes 60 ms of silence, and nothing can drift, because audio time is tied to signal time.
The vocoder’s output must be a steady 8,000 samples per second, so it needs a clock: the framer’s 8 kHz symbol stream. The catch is that the framer, Layer 2 and the vocoder run in separate threads. A voice message can still be on its way through Layer 2 when the clock has already moved past the spot where its audio belongs.
So the block only plays audio up to the release point: the last progress mark from the framer, plus the delay. Beyond it, a burst might still be in transit. Before it, every burst is guaranteed to have arrived. (I learned this the hard way, war story 6.)
The receiver multiplies by the volume slider, a Rational Resampler goes ×6 to 48 kHz, and an Audio Sink plays it. You hear speech about 0.4 s after it was on the air. That’s the price of never stuttering.
Spectrum: a repeater is a flat-topped hump about 10 kHz wide that never switches off. A mobile in direct mode flickers on and off.
Symbol histogram:
| What you see | What it means |
|---|---|
| Four sharp, equal peaks at −3, −1, +1, +3 | Locked, clean signal |
| Four peaks, all shifted sideways | Tuning error. The framer removes it, but fix your ppm / fine_hz anyway |
| Peaks spread wide and merging | Weak signal or interference |
| One blob, no peaks | No DMR, or not locked yet |
Console: event lines as they happen. These are from a test run (on a synthetic recording):
[DMR 20:43:41] TS2 CC1 CALL Group TG=6001 SRC=423 (dev=1956Hz off=+130Hz)
[DMR 20:43:46] TS2 CC1 END Group TG=6001 SRC=423 (dev=1944Hz off=+132Hz)
TS2 is the timeslot (from the CACH), CC1 the colour code (from the slot type), then the talkgroup and radio ID, then this burst’s measured deviation and offset.
And every 10 s, the status panel:
DMR channel status 20:43:43 (running 1 s)
Frequency : 148.80000 MHz carrier offset +129 Hz ~+0.9 ppm deviation 1958 Hz
Channel type: repeater / base station (BS sync); Tier III CONTROL channel (TSCC)
Colour code : CC1 (84 bursts)
TS1 : idle
TS2 : voice Group TG=6001 SRC=423
Calls (last 5 min, newest first):
20:43:43 Group TG=6001 SRC=423 voice here on TS2
Decoder : bursts 154 (idle 81, voice superframes 12) rejected: slot-type 0, BPTC 0, CRC/RS 0, off-grid/unconfirmed sync 3
The last line is the health check. “Off-grid/unconfirmed sync 3” means three fake or unconfirmed syncs were caught by the rhythm check. A few is normal. Lots of BPTC or CRC rejections mean the signal is too weak, or there’s a second repeater on the same frequency (try setting the colour code).
| Moment | On the air | In the decoder | On my screen / speaker |
|---|---|---|---|
| 0 ms | Voice LC header bursts (data sync) | rho → −1, framer accepts, Layer 2 decodes slot type → BPTC → RS | CALL Group TG=… SRC=… |
| ≈ 60–120 ms | Burst A (voice sync) | rho → +1, framer cuts A and schedules B–F, fresh vocoder state | Panel: “voice …” |
| +60 … +300 ms | Bursts B–F (no sync) | Cut out blind, EMB decoded, embedded LC collected | (repeated CALL line suppressed) |
| ≈ 0.4–0.5 s | (still talking) | First speech reaches the release point | I hear the first syllable |
| Every 360 ms | Next A, B–F… | Next A expected; accepted at rho ≥ 0.5 if weak | Continuous speech |
| End | Terminator with LC | Layer 2 decodes it | END Group TG=…, call shown as “ended” |
Tuning in halfway through a call? The first two rows never happen, but within one superframe the embedded LC still tells you who’s talking, and the audio starts at the next burst A.
Things rarely work the first time. Here are the ones worth telling, because each one taught me something beyond DMR.
The very first one. I built a P25 decoder for a signal that looked like P25 on the waterfall, and its sync detector kept printing DMR repeater syncs instead. A 12.5 kHz 4FSK hump looks very much the same whichever standard sent it. Lesson: the waterfall can tell you the bandwidth, not the protocol. Let a sync detector decide.
In the first DMR version, if I set the offset correctly before pressing run, it locked immediately. If I slid the fine_hz slider onto the signal while running, it took ages to lock.
The culprit was GNU Radio’s Symbol Sync. While I was sliding across garbage, its timing loop kept “correcting” towards nonsense and wound itself up. When the real signal finally arrived, it first had to unwind. The fix was to throw away the loop completely and measure the timing directly from each sync word (Part 4). Every burst gets its own fresh measurement, so there’s nothing to catch up. Lesson: a feedback loop remembers its past, and that’s not always what you want.
With voice on the channel, I occasionally got “bursts” that decoded to nonsense, and audio clicks. AMBE+2 output is essentially random bits, and once in a while 48 of them match a sync pattern well enough to pass 0.8.
A higher threshold would also lose weak real bursts. The real fix was the 30 ms grid with two-sync confirmation (Part 4, step 3). A fake has to match the pattern and land on the grid, and that basically never happens. Lesson: when a signal has structure, use it as a second opinion.
My first voice output was a simple queue, and it stuttered: GNU Radio hands blocks chunks of wildly varying size, so the queue kept running empty and then overflowing. Placing audio on a timeline tied to the signal (Part 6) fixed it for good, and as a bonus, pauses and lost bursts are now reproduced faithfully.
Voice was decoding perfectly, yet the symbol histogram kept jumping between “four sharp peaks” and “scattered mess”. The decoding was fine; only the display was wrong.
When I changed the framer’s output to decimate by 6 (to make the 8 kHz stream), I forgot to convert the symbol phase into a position relative to the current chunk. So the histogram was sometimes sampling exactly at the symbol centres and sometimes somewhere in between, depending on how GNU Radio happened to chunk the data. One line fixed it. Lesson: “decodes fine” and “displays fine” are tested by different things.
Splitting the single block into a hier block brought its own surprises:
in, audio, sym and text. GRC didn’t like that at all, because those names clash with generated code. They’re now pad_in, pad_audio, pad_sym and pad_text.progress marks and the release point (Part 6) are for.pending list and processes newly scheduled bursts in the same call. The release-point check is what exposed this one. Lesson: a strict test catches bugs nobody was looking for.I first looked at three candidates: mbelib, mbelib-neo and “libopendmr”. I couldn’t find libopendmr anywhere, so that one is out. Classic mbelib works, but only with hard bits, and its output is about 3× louder (so the block scales it by 0.33). mbelib-neo 2.x has a soft-decision function, which is why it’s the one I recommend.
The hier version is about half as fast as the single block: 2.6× real time versus about 5×, on a 2-core test machine. The stock filter bank alone runs at about 200×. The three Python blocks share one interpreter lock and have to take turns. It’s still comfortably real time, but it’s the price of being able to watch every stage.
Hier version vs the single-block version, on two test streams (calls with header, CSBKs and data; and a Tier III control channel), at strong (20 dB) and weak (9 dB) signal levels:
Voice, end to end (text-to-speech → mbelib-neo’s AMBE+2 encoder → a DMR call → RF with noise → the compiled dmr_rx_hier flowgraph):
On the air, with the single-block version on my Windows laptop: it locked onto a Tait Tier III network, decoded the site, its neighbours and calls, and played the voice. It works well! The channel plan was confirmed from three independent points.
Honestly, not done yet: the hier version hasn’t run on my dongle on Windows. It gives line-for-line the same output as the single block on recordings, so I expect it to work, but expecting isn’t testing. That’s next on my list.
What the tests don’t cover: multipath in a moving car, two repeaters on the same frequency, or a dongle overloaded by a nearby pager. Real life will be a bit worse.
C:\Users\<you>\.grc_gnuradio\.dmr_freq: the repeater’s output frequency,ppm: your dongle’s correction (a TCXO dongle can stay at 0).[DMR] voice: mbelib-neo 2.x (soft decision) ...: voice will play,... OFF - no AMBE+2 vocoder: data decodes, audio stays silent. Put mbe-neo.dll next to the flowgraph, or set mbelib path in the decoder’s properties.fine_hz until they sit on ±1, ±3.A few notes:
PLEASE CHECK YOUR LOCAL RULES. Listening to amateur DMR is fine. Listening to commercial or public-safety networks is restricted in some countries, and passing on what you hear often is. This receiver deliberately does not try to decrypt anything.
| Try this | What you’ll learn |
|---|---|
A QT GUI Time Sink on rho_bs inside the hier block |
The fingerprint spikes live: −1 every 60 ms on a control slot, +1 every 360 ms during voice |
Time Sinks on all four rho_* outputs |
On a repeater only BS spikes; a direct-mode QSO lights up DM1 or DM2 |
| Sync threshold 0.6 | More “off-grid/unconfirmed” rejections: the rhythm check doing its job |
| Sync threshold 0.95 | Weak bursts missed; voice gaps come as whole superframes |
| A wrong colour code | Everything disappears. That’s how your radio ignores the neighbour repeater |
fine_hz at +1000, then +2500 |
The histogram shifts but decoding carries on, until the channel filter starts cutting the signal |
| Open the framer EPB in the editor | Every step in Part 4 is a short, commented piece of Python |
Record IQ with a File Sink, play it into both dmr_rx.grc and dmr_rx_hier.grc |
Side-by-side proof, on your own signals, that both give the same lines |
There’s a lot of room for improvement!