-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathM17_spec.tex
3289 lines (2630 loc) · 137 KB
/
M17_spec.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% if you need a document suitable for printing/binding, remove the ",oneside" from the following line.
\documentclass[a4paper,11pt,oneside]{book}
\usepackage[centering,margin=2.5cm]{geometry}
\usepackage[export]{adjustbox}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{PTSerif}
\usepackage{parskip}
\usepackage{tabularx}
\usepackage{tabularray}
\usepackage{multirow}
\usepackage{float}
\usepackage{nicematrix}
\NiceMatrixOptions{cell-space-top-limit=4pt, cell-space-bottom-limit=4pt}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows.meta}
\tikzstyle{textonly} = [rectangle,
minimum width=1cm,
minimum height=1cm,
text centered,
draw=white]
\tikzstyle{whrectround} = [rectangle, rounded corners,
minimum width=1cm,
minimum height=1cm,
text centered,
text width=2cm,
draw=black]
\usepackage{amstext}
\usepackage{array,calc}
\newcolumntype{L}{>{$}l<{$}}
\usepackage{graphicx}
\renewcommand{\arraystretch}{1.5}
\usepackage{listings}
\usepackage{xcolor}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{codestyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=codestyle}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{20}
\usepackage{longtable,booktabs}
\makeatletter
\renewcommand{\frontmatter}{\cleardoublepage\@mainmatterfalse}
\renewcommand{\mainmatter}{\cleardoublepage\@mainmattertrue}
\makeatother
\usepackage[pdftex,
pdfauthor={Wojciech Kaczmarski SP5WWP et al.},
pdftitle={M17 Protocol Specification},
pdfsubject={Protocol specification of the Amateur Radio digital mode commonly called M17},
pdfkeywords={m17, amateur radio, ham radio, digital, digital radio, codec 2, open source, specification},
]{hyperref}
%opening
\title{M17 Protocol Specification}
\author{Wojciech Kaczmarski SP5WWP et al.}
\begin{document}
\begin{titlepage}
\raggedleft
\includegraphics[width=0.7\linewidth,right]{img/m17_logo_shadow}
\vspace*{\baselineskip}
{\Large Wojciech Kaczmarski SP5WWP et al.} \\
\vspace*{0.167\textheight}
\textbf{\LARGE M17 Protocol Specification} \\
\today
\vfill
{\large Version 1.4}
\vfill
\LaTeX version compiled by Steve Miller KC1AWV
\end{titlepage}
\frontmatter
\tableofcontents
\listoftables
\listoffigures
\chapter{Licenses}
\paragraph{M17 Protocol Specification}
Copyright \copyright{} 2023-2024 M17 Project. \\
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License'' or at the following web page: \href{https://www.gnu.org/licenses/fdl-1.3.en.html}{https://www.gnu.org/licenses/fdl-1.3.en.html}
\paragraph{M17 Project Software}
Copyright (C) 2024 M17 Project \\
Software included in the M17 Protocol Specification is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\chapter{Introduction}
M17 is an RF protocol that is:
\begin{itemize}
\item
Completely open: open specification, open source code, open source hardware, open algorithms. Anyone must be able to build an M17 radio and interoperate with other M17 radios without having to pay anyone else for the right to do so.
\item
Optimized for amateur radio use.
\item
Simple to understand and implement.
\item
Capable of doing the things hams expect their digital protocols to do:
\begin{itemize}
\item
Voice (eg: DMR, D-Star, etc)
\item
Point to point data (eg: Packet, D-Star, etc)
\item
Broadcast telemetry (eg: APRS, etc)
\item
Extensible, so more capabilities can be added over time.
\end{itemize}
\end{itemize}
To do this, the M17 protocol is broken down into three protocol layers,
like a network:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
Physical Layer: How to encode 1s and 0s into RF\@. Specifies RF modulation, symbol rates, bits per symbol, etc.
\item
Data Link Layer: How to packetize those 1s and 0s into usable data. Packet vs Stream modes, headers, addressing, etc.
\item
Application Layer: Accomplishing activities. Voice and data streams, control packets, beacons, etc.
\end{enumerate}
This document attempts to document these layers.
\chapter{Glossary}
\textbf{Common terms used in M17}
\paragraph{BER}
Bit Error Rate
\paragraph{ECC}
Error Correcting Code
\paragraph{FEC}
Forward Error Correction
\paragraph{Frame}
The individual components of a stream, each of which contains payload data interleaved with frame signalling.
\paragraph{Link Setup Frame (LSF)}
The first data frame of any transmission. It contains full link information data.
\paragraph{LICH}
Link Information Channel. The LICH carries all information of an M17 link. The first frame of a transmission contains full link setup data, and subsequent frames each contain one sixth of this data, so that late-joiners can obtain the full link setup data information\@.
\paragraph{Packet}
A single burst of data transmitted in packet mode.
\paragraph{Superframe}
A set of six consecutive frames which collectively contain full LICH
data are grouped into a superframe.
\mainmatter
\chapter{Physical Layer}
This section describes the M17 standard radio physical layer suitable
for use where a transmission bandwidth of 9 kHz is permitted.
\section{4-level Frequency-shift Keying Modulation (4FSK)}
The M17 standard uses 4FSK at 4800 symbols/s (9600 bits/s) with a deviation index h=1/3 for transmission in a 9 kHz channel bandwidth. Minimum channel spacing is 12.5 kHz.
\section{Dibit, Symbol, and Frequency-shift}
Each of the 4-level frequency-shifts can be represented by dibits (2-bit values) or symbols, as shown in Table 1 below.
In the case of dibits, the most significant bit is sent first. When four dibits are grouped into a byte, the most significant dibit of the byte
is sent first. For example, the four dibits contained in the byte \texttt{0xB4} (0b 10 11 01 00) would be sent as the symbols (-1, -3, +3, +1).
\begin{table}[H]
\centering
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{Dibit} & \multirow{2}{*}{Symbol} & \multirow{2}{*}{Deviation} \\
MSB & LSB & & \\
\hline
0 & 1 & +3 & +2.4 kHz \\
0 & 0 & +1 & +0.8 kHz \\
1 & 0 & -1 & -0.8 kHz \\
1 & 1 & -3 & -2.4 kHz \\
\hline
\end{tabular}
\caption{Dibit symbol mapping to 4FSK deviation}
\end{table}
\section{4FSK Generation}
\begin{center}
\begin{figure}[H]
\begin{tikzpicture}[node distance=2cm]
\node (in) [textonly] {Dibit Input};
\node (sym) [whrectround, right of=in, xshift=1cm] {Dibit to Symbol};
\node (up) [whrectround, right of=sym, xshift=1cm] {Upsampler};
\node (rrc) [whrectround, right of=up, xshift=1cm] {RRC Filter};
\node (fm) [whrectround, right of=rrc, xshift=1cm] {Frequency Modulation};
\node (out) [textonly, right of=fm, xshift=1cm] {4FSK Output};
\draw [-latex](in) -- (sym);
\draw [-latex](sym) -- (up);
\draw [-latex](up) -- (rrc);
\draw [-latex](rrc) -- (fm);
\draw [-latex](fm) -- (out);
\end{tikzpicture}
\caption{4FSK Generation}
\end{figure}
\end{center}
Dibits are converted to symbols. The symbol stream is upsampled to a series of impulses which pass through a root-raised-cosine (alpha=0.5) shaping filter before frequency modulation at the transmitter and again after frequency demodulation at the receiver.
Upsampling by a factor of 10 is recommended (48000 samples/s).
The root-raised-cosine filter should span at least 8 symbols (81 taps at the recommended upsample rate).
\section{Transmission}
A complete transmission shall consist of a Preamble, a Synchronization Burst, Payload, and an End of Transmission marker.
\begin{table}[H]
\centering
\begin{tabular}{cccc}
\hline
\multicolumn{1}{|c|}{PREAMBLE} & \multicolumn{1}{c|}{SYNC BURST} & \multicolumn{1}{c|}{PAYLOAD} & \multicolumn{1}{c|}{EoT} \\ \hline
\begin{tabular}[c]{@{}c@{}}40ms\\ (192 symbols)\end{tabular} & \begin{tabular}[c]{@{}c@{}}16 bits\\ (8 symbols)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Multiples of 2 bits\\ (multiples of 1 symbol)\end{tabular} & \begin{tabular}[c]{@{}c@{}}40ms\\ (192 symbols)\end{tabular}
\end{tabular}
\caption{Physical Layer Transmission}
\end{table}
Transmissions may include more than one synchronization burst followed by a payload.
\begin{table}[H]
\centering
\begin{tblr}{|l|l|l|[dashed]l|[dashed]l|l|l|}
\hline
PREAMBLE & SYNC BURST & PAYLOAD & ••• & SYNC BURST & PAYLOAD & EoT \\ \hline
\end{tblr}
\caption{Physical Layer Transmission with Multiple Synchronization Bursts}
\end{table}
\subsection{Preamble}
Every transmission shall start with a preamble, which shall consist of 40 ms (192 symbols) of alternating outer symbols (+3, -3) or (-3, +3), see \autoref{sec:sync_burst} for details. To ensure a zero crossing prior to a synchronization burst, the last symbol transmitted within the preamble shall be opposite the first symbol transmitted in the synchronization burst.
\subsection{Synchronization Burst (Sync Burst)}
A sync burst of 16 bits (8 symbols) shall be sent immediately after the preamble. The sync burst is constructed using only outer symbols, with codings based on \href{https://en.wikipedia.org/wiki/Barker_code}{Barker codes}. Properly chosen sync burst coding assists in symbol clocking and alignment. Different sync burst codes may also be used by the Data Link Layer to identify the type of payload to follow.
\subsection{Payload}
Payload shall be transmitted in multiples of 2 bits (1 symbol).
\subsection{Randomizer}
To avoid transmitting long sequences of constant symbols (e.g.~+3, +3, +3, \ldots), a simple randomizing algorithm is used. At the transmitter, all payload bits shall be XORed with a pseudorandom predefined sequence before being converted to symbols. At the receiver, the randomized payload symbols are converted to bits and are again passed through the same XOR algorithm to obtain the original payload bits.
The pseudorandom sequence is composed of the 46 bytes (368 bits) found in the appendix Randomizer Sequence.
Before each bit of payload is converted to symbols for transmission, it is XORed with a bit from the pseudorandom sequence. The first payload bit is XORed with most significant bit (bit 7) of sequence byte 0 \texttt{(0$\times$D6)}, second payload bit with bit 6 of sequence byte 0, continuing to the eighth payload bit and bit 0 of sequence byte 0. The ninth payload bit is XORed with bit 7 of sequence byte 1 \texttt{(0$\times$B5)}, tenth payload bit with bit 6 of sequence byte 1, etc.
When payload bits have XORed through sequence byte 45 \texttt{(0$\times$C3)}, the pseudorandom sequence is restarted at sequence byte 0 \texttt{(0$\times$D6)}.
On the receive side, symbols are converted to randomized payload bits. Each randomized payload bit is converted back to a payload bit by once
again XORing each randomized bit with the corresponding pseudorandom sequence bit.
\subsection{End of Transmission marker (EoT)}
Every transmission ends with a distinct symbol stream, which shall consist of 40 ms (192 symbols) of a repeating \texttt{(0$\times$55)} \texttt{(0$\times$5D)} (+3, +3, +3, +3, +3, +3, -3, +3) pattern.
\subsection{Carrier-sense Multiple Access (CSMA)}
CSMA may be used to minimize collisions on a shared radio frequency by having the sender ensure the frequency is clear before transmitting. Higher layers (Data Link and Application) may require the use of CSMA, and may specify parameters other than the defaults.
\href{https://en.wikipedia.org/wiki/Carrier-sense_multiple_access}{P-persistent} access is used with a default probability of p = 0.25 and default slot time of 40 ms.
\section{Physical Layer Flow Summary}
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2cm]
\node (payload) [whrectround] {Payload};
\node (rand) [whrectround, below of=payload] {Randomizer};
\node (sync) [whrectround, below of=rand] {prepend SYNC BURST};
\node (pre) [whrectround, left of=sync, xshift=-2cm] {Preamble};
\node (eot) [whrectround, right of=sync, xshift=2cm] {EoT};
\node (cd) [whrectround, below of=sync] {chunk dibit};
\node (dtos) [whrectround, below of=cd] {dibit to symbol};
\node (up) [whrectround, below of=dtos] {upsampler};
\node (rrc) [whrectround, below of=up] {rrc filter};
\node (fm) [whrectround, below of=rrc] {frequency modulation};
\node (fsk) [whrectround, below of=fm] {4FSK RF};
\draw [-latex](payload) -- (rand);
\draw [-latex](rand) -- (sync);
\draw [-latex](sync) -- (cd);
\draw [-latex](pre) -- (cd);
\draw [-latex](eot) -- (cd);
\draw [-latex](cd) -- (dtos);
\draw [-latex](dtos) -- (up);
\draw [-latex](up) -- (rrc);
\draw [-latex](rrc) -- (fm);
\draw [-latex](fm) -- (fsk);
\end{tikzpicture}
\caption{Physical Layer Flow}
\end{figure}
\chapter{Data Link Layer}
\section{Frame}
A Frame shall be composed of a frame type specific Synchronization Burst (Sync Burst) followed by 368 bits (184 symbols) of Payload. The combination of Sync Burst plus Payload results in a constant 384 bit (192 symbol) Frame. At the M17 data rate of 4800 symbols/s (9600 bits/s), each Frame is exactly 40ms in duration.
There are four frame types each with their own specific Sync Burst: Link Setup Frames (LSF), Bit Error Rate Test (BERT) Frames, Stream Frames, and Packet Frames.
\begin{table}[H]
\centering
\begin{tabular}{cc}
\hline
\multicolumn{1}{|c|}{SYNC BURST} & \multicolumn{1}{c|}{PAYLOAD} \\ \hline
\begin{tabular}[c]{@{}c@{}}16 bits\\ (8 symbols)\end{tabular} & \begin{tabular}[c]{@{}c@{}}368 bits\\ (184 symbols)\end{tabular}
\end{tabular}
\caption{Frame}
\end{table}
\section{Forward Error Correction (FEC)}
The Data Link Layer Contents of a specific frame are modified using various Error Correction Code (ECC) methods. Applying these codes at the transmitter allows the receiver to correct some amount of induced errors in a Forward Error Correction (FEC) process. It is this ECC/FEC data that is inserted into the Payload portion of the Frame. The exact ECC/FEC techniques used vary by frame type.
Applying ECC/FEC may be a multi-step process. To distinguish data bits at the various stages of the process, Bit Types are defined as shown in the following table. It is important to note that not all ECC/FEC processes utilize both Type 2 and Type 3 bits. Prior to decoding Data Link Layer contents, a receiver would need to convert incoming bits from Type 4 back to Type 1 bits, which may also include conversion through Type 3 and/or Type 2 bits. The exact ECC/FEC methods and Bit Types
utilized will be indicated for each frame type.
\begin{table}[H]
\centering
\begin{tblr}{ll}
\hline
Type & Description \\
\hline
Type 1 & Data link layer content bits \\
Type 2 & Bits after appropriate encoding \\
Type 3 & Bits after puncturing \\
Type 4 & Interleaved (re-ordered) bits \\
\hline[2px]
\end{tblr}
\caption{Bit Types}
\end{table}
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2cm]
\node (cont) [whrectround] {Data Link Layer Contents};
\node (ecc) [whrectround, right of=cont, xshift=2.5cm] {ECC/FEC Encode};
\node (payload) [whrectround, right of=ecc, xshift=2.5cm] {Payload};
\draw [-latex](cont) -- node [midway, above] {Type 1 bits} (ecc);
\draw [-latex](ecc) -- node [midway, above] {Type 4 bits} (payload);
\end{tikzpicture}
\caption{Transmit Contents to Payload}
\end{figure}
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2cm]
\node (payload) [whrectround] {Payload};
\node (ecc) [whrectround, right of=payload, xshift=2.5cm] {ECC/FEC Decode};
\node (cont) [whrectround, right of=ecc, xshift=2.5cm] {Data Link Layer Contents};
\draw [-latex](payload) -- node [midway, above] {Type 4 bits} (ecc);
\draw [-latex](ecc) -- node [midway, above] {Type 1 bits} (cont);
\end{tikzpicture}
\caption{Receive Payload to Contents}
\end{figure}
\section{Modes}
The Data Link layer shall operate in one of three modes during a Transmission.
\begin{itemize}
\item
Stream Mode
Data are sent in a continuous stream for an indefinite amount of time, with no break in physical layer output, until the stream ends. e.g.~voice data, bulk data transfers, etc. Stream Mode shall start with an LSF and is followed by one or more Stream Frames.
\item
Packet Mode
Data are sent in small bursts, up to 823 bytes at a time, after which the physical layer stops sending data. e.g.~messages, beacons, etc. Packet Mode shall start with an LSF and is followed by one to 33 Packet Frames.
\item
BERT Mode
PRBS9 is used to fill frames with a deterministic bit sequence. Frames are sent in a continuous sequence. Bert Mode shall start with a BERT frame, and is followed by one or more BERT Frames.
\end{itemize}
\begin{quote}
NOTE As is the convention with other networking protocols, all values and data structures are encoded in big endian byte order.
\end{quote}
\section{Synchronization Burst (Sync Burst)}
\label{sec:sync_burst}
All frames shall be preceded by 16 bits (8 symbols) of
Sync Burst. The Sync Burst definition straddles both the Physical Layer and the Data Link Layer.
Only LSF and BERT Sync Bursts may immediately follow the Preamble, and each requires a different Preamble symbol pattern as shown in the table below.
During a Transmission, only one LSF Sync Burst may be present, and if present, it shall immediately follow the Preamble.
BERT Sync Bursts, if present, may only follow the Preamble or other BERT frames.
Multiple Stream or Packet Sync Bursts may be present during a Transmission, depending on the mode.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lccX},
}
\hline
Frame Type & Preamble & Sync Burst Bytes & Sync Burst Symbols \\
\hline
LSF & +3, -3 & 0x55 0xF7 & +3, +3, +3, +3, -3, -3, +3, -3 \\
BERT & -3, +3 & 0xDF 0x55 & -3, +3, -3, -3, +3, +3, +3, +3 \\
Stream & None & 0xFF 0x5D & -3, -3, -3, -3, +3, +3, -3, +3 \\
Packet & None & 0x75 0xFF & +3, -3, +3, +3, -3, -3, -3, -3 \\
\hline[2px]
\end{tblr}
\caption{Frame Specific Sync Bursts}
\end{table}
\section{Link Setup Frame (LSF)}
The LSF is the initial frame for both Stream and Packet Modes and contains information needed to establish a link.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lcX},
}
\hline
Field & Length & Description \\
\hline
DST & 48 bits & Destination address - Encoded callsign or a special number (eg. a group) \\
SRC & 48 bits & Source address - Encoded callsign of the originator or a special number (eg. a group) \\
TYPE & 16 bits & Information about the incoming data stream \\
META & 112 bits & Metadata field, suitable for cryptographic metadata like IVs or single-use numbers, or non-crypto metadata like the sender's GNSS position. \\
CRC & 16 bits & CRC for the link setup data \\
\hline[2pt]
\end{tblr}
\caption{Link Setup Frame Contents}
\end{table}
Total: 240 Type 1 bits
\subsection{LSF DST and SRC}
Destination and source addresses may be encoded amateur radio callsigns, or special numbers. See the Address Encoding Appendix for details.
\subsection{LSF TYPE} \label{lsftype}
The TYPE field contains information about the frames to follow LSF. The Packet/Stream indicator bit determines which mode (Packet or Stream) will be used during the transmission. The remaining field meanings are defined by the specific mode and application.
\begin{table}[H]
\centering
\small
\begin{NiceTabular}{|W{c}{4em}|[tikz=very thick]W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|}
\hline
\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\
\Hline[tikz=very thick]
0 &
\multicolumn{4}{c}{\textit{Reserved}} &
\parbox{3em}{\centering Signed Stream} &
\multicolumn{3}{c}{Channel Access Number\ldots} \\
\hline
1 &
\ldots &
\multicolumn{2}{c}{\parbox{6em}{\centering Encryption Subtype}} &
\multicolumn{2}{c}{\parbox{6em}{\centering Encryption Type}} &
\multicolumn{2}{c}{\parbox{6em}{\centering Data Type}} &
\parbox{3em}{\centering Packet/ Stream} \\
\hline
\end{NiceTabular}
\normalsize
\caption{LSF TYPE layout}
\end{table}
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lX},
}
\hline
Value & Mode \\
\hline
0 & Packet mode \\
1 & Stream mode \\
\hline[2px]
\end{tblr}
\caption{Packet/Stream indicator}
\end{table}
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lX},
}
\hline
Value & Content \\
\hline
$00_2$ & Reserved \\
$01_2$ & Data \\
$10_2$ & Voice \\
$11_2$ & Voice+Data \\
\hline[2px]
\end{tblr}
\caption{Data type}
\end{table}
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lX},
}
\hline
Value & Encryption \\
\hline
$00_2$ & None \\
$01_2$ & Scrambler \\
$10_2$ & AES \\
$11_2$ & Other/reserved \\
\hline[2px]
\end{tblr}
\caption{Encryption type}
\end{table}
For the encryption subtype, meaning of values depends on encryption type.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lXX},
}
\hline
Value & Scrambler & AES \\
\hline
$00_2$ & 8-bit & 128-bit \\
$01_2$ & 16-bit & 192-bit \\
$10_2$ & 24-bit & 256-bit \\
$11_2$ & reserved & reserved \\
\hline[2px]
\end{tblr}
\caption{Key lengths for encryption subtypes}
\end{table}
\subsection{LSF META}
The LSF META field is defined by the specific application.
\subsection{LSF CRC}
M17 uses a non-standard version of 16-bit CRC with polynomial $x^{16} + x^{14} + x^{12} + x^{11} + x^8 + x^5 + x^4 + x^2 + 1$ or \texttt{0$\times$5935} and initial value of \texttt{0$\times$FFFF}. This polynomial allows for detecting all errors up to hamming distance of 5 with payloads up to 241 bits, which is less than the amount of data in each frame.
As M17's native bit order is most significant bit first, neither the input nor the output of the CRC algorithm gets reflected.
The CRC field enables verification of the other 28 bytes forming the LSF: 6-byte DST, 6-byte SRC, 2-byte TYPE, and 14-byte META fields. Data integrity of an LSF frame is established by computing the CRC of the first 28 bytes and storing the resulting checksum in the trailing 2-byte CRC field, which can be compared by a recipient after repeating the same checksum process. Alternatively, a CRC computed over the entire 30-byte LSF frame, including a valid CRC field, will always equal zero.
The test vectors in the following table are calculated by feeding the given message to the CRC algorithm.
\begin{table}[H]
\centering
\begin{tblr}{ll}
\hline
Message & CRC Output \\
\hline
(empty string) & 0xFFFF \\
ASCII string ``A'' & 0x206E \\
ASCII string ``123456789'' & 0x772B \\
Bytes 0x00 to 0xFF & 0x1C31 \\
\hline[2px]
\end{tblr}
\caption{CRC Test Vectors}
\end{table}
\subsection{LSF Contents ECC/FEC}
The 240 Type 1 bits of the Link Setup Frame Contents along with 4 flush bits are convolutionally coded using a rate 1/2 coder with constraint K=5. 244 bits total are encoded resulting in 488 Type 2 bits.
Type 3 bits are computed by $P_1$ puncturing the Type 2 bits, resulting in 368 Type 3 bits.
Interleaving the Type 3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer.
Within the Physical Layer, the 368 Type 4 bits are randomized and combined with the 16-bit LSF Sync Burst, which results in a complete frame of 384 bits (384 bits / 9600bps = 40 ms).
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2cm]
\tikzstyle{sub} = [draw,rectangle,fill=black!20]
\node (dl) [sub] {
\begin{tikzpicture}
\node (dll) [rectangle,inner ysep=0cm] {Data Link Layer};
\node (cont) [rectangle,draw,fill=white,yshift=-1cm] {Contents};
\node (add) [rectangle,draw,below of=cont,fill=white] {add 4 flush bits};
\node (conv) [rectangle,draw,below of=add,fill=white,yshift=1cm] {convolutional encoder};
\node (p1) [rectangle,draw,below of=conv,fill=white] {$P_1$ puncturer};
\node (int) [rectangle,draw,below of=p1,fill=white] {interleaver};
\draw [-latex](cont) -- node [midway,fill=black!20] {240 Type 1 bits} (add);
\draw [-latex](add) -- (conv);
\draw [-latex](conv) -- node [midway,fill=black!20] {488 Type 2 bits} (p1);
\draw [-latex](p1) -- node [midway,fill=black!20] {368 Type 3 bits} (int);
\end{tikzpicture}
};
\node (pl) [sub,below of=dl,yshift=-6cm] {
\begin{tikzpicture}
\node (pll) [rectangle,inner ysep=0cm] {Physical Layer};
\node (rand) [rectangle,draw,below of=pll,fill=white,yshift=1cm] {randomizer};
\node (pre) [rectangle,draw,below of=rand,fill=white,yshift=1cm] {prepend LSF Sync Burst};
\node (con) [rectangle,draw,below of=pre,fill=white] {Physical Layer Continues...};
\draw [-latex](rand) -- (pre);
\draw [-latex](pre) -- node [midway,fill=black!20] {384-bit Frame} (con);
\end{tikzpicture}
};
\draw [-latex](dl) -- node [midway,fill=white] {368 Type 4 bits} (pl);
\end{tikzpicture}
\caption{LSF Construction}
\end{figure}
\section{Stream Mode}
In Stream Mode, an \emph{indefinite} amount of data is sent continuously
without breaks in the physical layer. Stream Mode shall always start
with an LSF that has the LSF TYPE Packet/Stream indicator bit set to 1
(Stream Mode). Other valid LSF TYPE parameters are selected per
application.
Following the LSF, one or more Stream Frames may be sent.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={|c|X[c]|X[c]|X[c]|X[c]|[dashed]c|[dashed]X[c]|X[c]|c|},
rows={m},
hlines,
}
PREAMBLE & LSF SYNC BURST & LSF FRAME & STREAM SYNC BURST & STREAM FRAME & ••• & STREAM SYNC BURST & STREAM FRAME & EoT \\
\end{tblr}
\caption{Stream Mode}
\end{table}
\subsection{Stream Frames}
Stream Frames are composed of frame signalling information contained within the Link Information Channel (LICH) combined with Stream Contents. Both the LICH and Stream Contents utilize different ECC/FEC mechanisms, and are combined at the bit level in a Frame Combiner.
\paragraph{Link Information Channel (LICH)}
The LICH allows for late listening and independent decoding to check destination address if the LSF for the current transmission was missed.
Each Stream Frame contains a 48-bit Link Information Channel (LICH). Each LICH within a Stream Frame includes a 40-bit chunk of the 240-bit LSF frame that was used to establish the stream. A 3-bit modulo 6 counter (LICH\_CNT) is used to indicate which chunk of the LSF is present in the current Stream Frame. LICH\_CNT starts at 0, increments to 5, then wraps back to 0.
\begin{table}[H]
\centering
\small
\begin{NiceTabular}{|W{c}{4em}|[tikz=very thick]W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|}[hvlines]
\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\
\Hline[tikz=very thick]
0 & \Block{3-8}{40-bit chunk of full LSF Contents (Type 1 bits)} \\
\ldots & \\
4 & \\
5 & \multicolumn{3}{c}{LICH\_CNT} & \multicolumn{5}{c}{\textit{Reserved}} \\
\end{NiceTabular}
\normalsize
\caption{Link Information Channel Contents}
\end{table}
Total: 48 bits
The 40-bit chunks start from the beginning of the LSF.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lX},
}
\hline
LICH\_CNT & LSF bits \\
\hline
0 & 0:39 \\
1 & 40:79 \\
2 & 80:119 \\
3 & 120:159 \\
4 & 160:199 \\
5 & 200:239 \\
\hline[2px]
\end{tblr}
\caption{LICH\_CNT and LSF bits}
\end{table}
\paragraph{LICH Contents ECC/FEC}
The 48-bit LICH Contents is partitioned into 4 12-bit parts and encoded using Golay (24, 12) code. This produces 96 encoded Type 2 bits that are fed into the Frame Combiner.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lcX},
}
\hline
Field & Length & Description \\
\hline
FN & 16 bits & Frame Number \\
STREAM & 128 bits & Stream data, can contain arbitrary data \\
\hline[2px]
\end{tblr}
\caption{Stream Contents}
\end{table}
Total: 144 Type 1 bits
The Frame Number (FN) starts from 0 and increments every frame to a maximum of \texttt{0$\times$7fff} where it will then wrap back to 0. The most significant bit in the FN is used for transmission end signaling. When transmitting the last frame, it shall be set to 1 (one), and 0 (zero) in all other frames.
Stream data (STREAM) is obtained by extracting 128 bits at a time from the continuous stream of application layer data. If the last frame will contain less than 128 bits of valid data, the remaining bits should be set to zero. The stream may end at the frame boundary.
\begin{table}[H]
\centering
\begin{tblr}{
colspec={llXX},
}
\hline
Mode & Codec 2 rate & Frame t + 0 & Frame t + 1... \\
\hline
Voice & 3200 & 128 bits encoded speech & 128 bits encoded speech \\
Voice + Data & 1600 & 64 bits encoded speech + 64 bits arbitrary data & 64 bits encoded speech + 64 bits arbitrary data \\
\hline[2px]
\end{tblr}
\caption{STREAM Payload Examples}
\end{table}
\paragraph{Stream Contents ECC/FEC}
The 144 Type 1 bits of Stream Contents along with 4 flush bits are convolutionally coded using a rate 1/2 coder with constraint K=5. 148 bits total are encoded resulting in 296 Type 2 bits.
These bits are $P_2$ punctured to generate 272 Type 3 bits that are fed into the Frame Combiner.
\paragraph{Frame Combiner}
The 96 Type 2 bits of the ECC/FEC LICH Contents are concatenated with 272 Type 3 bits of the ECC/FEC Stream Contents resulting in 368 of combined Type 2/3 bits.
\begin{table}[H]
\centering
\begin{tblr}{lrl}
\hline
Field & Length & Description \\
\hline
LICH & 96 bits & ECC/FEC LICH Contents Type 2 bits \\
STREAM & 272 bits & ECC/FEC STREAM Contents Type 3 bits \\
\hline[2px]
\end{tblr}
\caption{LICH and Stream Combined}
\end{table}
Total: 368 Type 2/3 bits
Interleaving the Combined Type 2/3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer.
Within the Physical Layer, the 368 Type 4 bits are randomized and combined with the 16-bit Stream Sync Burst, which results in a complete frame of 384 bits (384 bits / 9600bps = 40 ms).
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2cm]
\tikzstyle{sub} = [draw,rectangle,fill=black!20]
\node (dl) [sub] {
\begin{tikzpicture}
\node (dl) [rectangle,fill=black!20] {Data Link Layer};
\node (ch128) [rectangle,draw,below of=dl,fill=white,yshift=1.5cm,xshift=3cm] {chunk 128 bits};
\node (pp) [rectangle,draw,below of=ch128,fill=white,yshift=1cm] {prepend frame number};
\node (add) [rectangle,draw,below of=pp,fill=white] {add 4 flush bits};
\node (conv) [rectangle,draw,below of=add,fill=white,yshift=1cm] {convolutional encoder};
\node (p2) [rectangle,draw,below of=conv,fill=white] {$P_2$ puncturer};
\node (fc) [rectangle,draw,below of=p2,fill=white,xshift=-3cm] {Frame Combiner};
\node (lc) [rectangle,draw,below of=dl,fill=white,yshift=-1cm,xshift=-3cm] {LSF Contents};
\node (ch40) [rectangle,draw,below of=lc,fill=white,yshift=1cm] {chunk 40 bits};
\node (al) [rectangle,draw,below of=ch40,fill=white] {add LICH counter};
\node (gl) [rectangle,draw,below of=al,fill=white,yshift=1cm] {Golay (24, 12)};
\node (il) [rectangle,draw,below of=fc,fill=white] {interleaver};
\draw [-latex](ch128) -- (pp);
\draw [-latex](pp) -- node [midway,fill=black!20] {144 Type 1 bits} (add);
\draw [-latex](add) -- (conv);
\draw [-latex](conv) -- node [midway,fill=black!20] {296 Type 2 bits} (p2);
\draw [-latex](p2) -- node [midway,fill=black!20] {272 Type 3 bits} (fc);
\draw [-latex](lc) -- (ch40);
\draw [-latex](ch40) -- node [midway,fill=black!20] {40 Type 1 bits} (al);
\draw [-latex](al) -- (gl);
\draw [-latex](gl) -- node [midway,fill=black!20] {96 Type 2 bits} (fc);
\draw [-latex](fc) -- node [midway,fill=black!20] {96 Type 2 bits + 272 Type 3 bits = 368 Type 2/3 bits} (il);
\end{tikzpicture}
};
\node (al) [sub,above of=dl,yshift=6cm] {
\begin{tikzpicture}
\node (ap) [rectangle,fill=black!20] {Application Layer};
\node (sd) [rectangle,draw,below of=ap,fill=white,yshift=1.5cm] {Stream Data};
\end{tikzpicture}
};
\draw [-latex](al) -- node [midway,fill=white] {Continuous data} (dl);
\node (pl) [sub,below of=dl,yshift=-8cm] {
\begin{tikzpicture}
\node (phy) [rectangle,fill=black!20] {Physical Layer};
\node (rand) [rectangle,draw,below of=phy,fill=white,yshift=1.5cm] {randomizer};
\node (pps) [rectangle,draw,below of=rand,fill=white,yshift=1cm] {prepend Stream Sync Burst};
\node (plc) [rectangle,draw,below of=pps,fill=white] {Physical Layer Continues...};
\draw [-latex](rand) -- (pps);
\draw [-latex](pps) -- node [midway,fill=black!20] {384-bit Frame} (plc);
\end{tikzpicture}
};
\draw [-latex](dl) -- node [midway,fill=white] {368 Type 4 bits} (pl);
\end{tikzpicture}
\caption{Stream Frame Construction}
\end{figure}
\subsection{Stream Superframes}
Stream Frames are grouped into Stream Superframes, which is the group of 6 frames that contain everything needed to rebuild the original LSF packet, so that the user who starts listening in the middle of a stream (late-joiner) is eventually able to reconstruct the LSF message and understand how to receive the in-progress stream.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{img/M17_stream}
\caption{Stream Superframes}
\label{fig:m17stream}
\end{figure}
\section{Packet Mode}
In Packet Mode, a Single Packet with up to 823 bytes of Application Packet Data along with an appended two byte CRC may be sent over the physical layer during one Transmission. The total number of bytes is 825 (33*25).
\begin{table}[H]
\centering
\begin{tblr}{
colspec={lX},
}
\hline
Bytes & Meaning \\
\hline
0..n-1 & Application Packet Data \\
n..n+1 & CRC \\
\hline[2px]
\end{tblr}
\caption{Single Packet}
\end{table}
n is the number of bytes of the Application Packet Data. The CRC calculation used here is the same as described for LSF CRC.
Packet Mode shall always start with an LSF that has the LSF TYPE Packet/Stream indicator bit set to 0 (Packet Mode). Following the LSF, 1 to 33 Packet Frames may be sent.
Packet Mode achieves a base throughput of 5 kbps, a net throughput of approximately 4.7 kbps for the largest data payload, and over 3 kbps for 100-byte payloads. Net throughput takes into account preamble and link setup overhead. (TODO: recompute this)
\begin{table}[H]
\centering
\begin{tblr}{
colspec={|c|X[c]|X[c]|X[c]|X[c]|[dashed]c|[dashed]X[c]|X[c]|c|},
rows={m},
hlines,
}
PREAMBLE & LSF Sync Burst & LSF Frame & Packet Sync Burst & Packet Frame & ••• & Packet Sync Burst & Packet Frame & EoT \\
\end{tblr}
\caption{Packet Mode}
\end{table}
\subsection{Packet Frames}
Packet Frames contain Packet Contents after ECC/FEC is applied.
\paragraph{Packet Contents}
\begin{table}[H]
\centering
\small
\begin{NiceTabular}{|W{c}{4em}|[tikz=very thick]W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|}[hvlines]
\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\
\Hline[tikz=very thick]
0 & \Block{3-8}{200-bit chunk of Single Packet} \\
\ldots & \\
24 & \\
25 &
\parbox{3em}{\centering End of Frame} &
\multicolumn{5}{c}{Packet Frame/Byte Counter} &
\Block[fill=gray]{1-2}{} & \\
\end{NiceTabular}
\normalsize
\caption{Packet Contents}
\end{table}
Total: 206 Type 1 bits
The packet metadata field contains the 1-bit End of Frame (EOF) indicator, and the 5-bit Packet Frame/Byte Counter. This is \textit{NOT} to be confused with the LSF's 112-bit metadata field.
Data starting with the first byte of the Packet Data, and ending with 2 computed and appended CRC bytes (big-endian) is split in groups of 25 bytes (chunks). The CRC value is calculated over the whole Packet Data, including the terminating null-byte in the case of text. Each Packet Frame payload contains up to a 25-byte chunk of the Data. If fewer than 25 bytes can be extracted from the Data (i.e.~for the last Packet Frame), the Data chunk is padded with zero bytes (after the terminating CRC) to reach 25 bytes total.
The Packet Frame Counter is reset to zero at the start of Packet Mode. For each Packet Frame where there is at least 1 byte remaining in the Packet Data after removing a 25-byte chunk, the EOF metadata bit is set to zero, the Packet Frame Counter value is inserted into the Packet Frame/Byte Counter metadata field, and the Packet Frame Counter is incremented afterwards.
When there are no bytes remaining in the Packet Data after removing a 25-byte (or less) chunk, the EOF bit is set to one, the Packet Byte Counter is set to the number of valid bytes present in the current frame (1 to 25) and both fields are concatenated into the Packet Frame/Byte Counter metadata field. This results in a minimum of 1 to a maximum of 33 Packet Frames per transmission. Packet Mode is ended with an End of Transmission frame.
\begin{table}[H]
\centering
\small
\begin{NiceTabular}{|W{c}{4em}|[tikz=very thick]W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|}[hvlines]
\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\
\Hline[tikz=very thick]
0 &
0 &
\multicolumn{5}{c}{Frame number, 0..31} &
\Block[fill=gray]{1-2}{} & \\
\end{NiceTabular}
\normalsize
\caption{Packet Metadata Field with EOF = 0}
\end{table}
\begin{table}[H]
\centering
\small
\begin{NiceTabular}{|W{c}{4em}|[tikz=very thick]W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|W{c}{3em}|}[hvlines]
\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\
\Hline[tikz=very thick]
0 &
1 &
\multicolumn{5}{c}{Number of bytes in frame, 1..25} &
\Block[fill=gray]{1-2}{} & \\
\end{NiceTabular}
\normalsize
\caption{Packet Metadata Field with EOF = 1}
\end{table}
\paragraph{Packet Contents ECC/FEC}
The 206 Type 1 bits of the Packet Contents along with 4 flush bits are convolutionally coded using a rate 1/2 coder with constraint K=5. 210 bits total are encoded resulting in 410 Type 2 bits.
These bits are $P_3$ punctured to generate 368 Type 3 bits.
Interleaving the Type 3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer.
Within the Physical Layer, the 368 Type 4 bits are randomized and combined with the 16-bit Packet Sync Burst, which results in a complete frame of 384 bits (384 bits / 9600bps = 40 ms).
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance=2cm]
\tikzstyle{sub} = [draw,rectangle,fill=black!20]
\node (dl) [sub] {
\begin{tikzpicture}
\node (dll) [rectangle,fill=black!20] {Data Link Layer};
\node (ch200) [rectangle,draw,below of=dl,fill=white,yshift=1.5cm] {chunk 200 bits};
\node (addm) [rectangle,draw,below of=ch200,fill=white,yshift=1cm] {add metadata};
\node (add4) [rectangle,draw,below of=addm,fill=white] {add 4 flush bits};
\node (conv) [rectangle,draw,below of=add4,fill=white,yshift=1cm] {convolutional encoder};
\node (p3) [rectangle,draw,below of=conv,fill=white] {$P_3$ puncturer};
\node (int) [rectangle,draw,below of=p3,fill=white] {interleaver};
\draw [-latex](ch200) -- (addm);
\draw [-latex](addm) -- node [midway,fill=black!20] {206 Type 1 bits} (add4);
\draw [-latex](add4) -- (conv);
\draw [-latex](conv) -- node [midway,fill=black!20] {420 Type 2 bits} (p3);
\draw [-latex](p3) -- node [midway,fill=black!20] {368 Type 3 bits} (int);
\end{tikzpicture}
};
\node (al) [sub,above of=dl,yshift=4cm] {
\begin{tikzpicture}
\node (ap) [rectangle,fill=black!20] {Application Layer};
\node (sd) [rectangle,draw,below of=ap,fill=white,yshift=1.5cm] {Packet Data};
\end{tikzpicture}
};
\draw [-latex](al) -- (dl);
\node (pl) [sub,below of=dl,yshift=-6cm] {