[
  {
    "path": ".github/FUNDING.yaml",
    "content": "---\ncustom: https://www.paypal.com/donate/?hosted_button_id=4HTHZCS8UYPU6\n"
  },
  {
    "path": ".github/workflows/generate_pdf.yml",
    "content": "name: Generate PDF\n\non:\n  # allows manual triggering\n  workflow_dispatch:\n  push:\n    branches:\n      - '**'\n  pull_request:\n    branches:\n      - '**'\n\njobs:\n\n  # runs on main branch pushes\n  build-and-deploy:\n    if: github.ref == 'refs/heads/main'\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n      pages: write\n      id-token: write\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@v4\n\n      - name: Build PDF\n        uses: xu-cheng/latex-action@v4\n        with:\n          root_file: M17_spec.tex\n\n      - name: Check PDF exists\n        run: |\n          if [ ! -f M17_spec.pdf ]; then\n            echo \"PDF was not generated!\" >&2\n            exit 1\n          fi\n      - name: Move PDF to public/\n        run: |\n          mkdir -p public\n          mv M17_spec.pdf public/\n\n      - name: Setup Pages\n        uses: actions/configure-pages@v4\n\n      - name: Upload PDF\n        uses: actions/upload-pages-artifact@v3\n        with:\n          path: public\n\n      - name: Deploy to Pages\n        uses: actions/deploy-pages@v4\n\n      - name: Post URL to Summary\n        run: echo \"🚀 [View the latest PDF](https://m17-project.github.io/M17_spec/M17_spec.pdf)\" >> $GITHUB_STEP_SUMMARY\n\n  # runs on PRs and non-main branch pushes\n  build-artifact-only:\n    if: github.ref != 'refs/heads/main'\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@v4\n\n      - name: Build PDF\n        uses: xu-cheng/latex-action@v4\n        with:\n          root_file: M17_spec.tex\n\n      - name: Check PDF exists\n        run: |\n          if [ ! -f M17_spec.pdf ]; then\n            echo \"PDF was not generated!\" >&2\n            exit 1\n          fi\n\n      - name: Upload PDF artifact for branch/PR\n        uses: actions/upload-artifact@v4\n        with:\n          name: M17_spec\n          path: M17_spec.pdf\n"
  },
  {
    "path": ".gitignore",
    "content": "*.acn\n*.acr\n*.alg\n*.aux\n*.bak\n*.bbl\n*.bcf\n*.blg\n*.brf\n*.bst\n*.dvi\n*.fdb_latexmk\n*.fls\n*.glg\n*.glo\n*.gls\n*.hst\n*.idx\n*.ilg\n*.ind\n*.ist\n*.lof\n*.log\n*.lol\n*.lot\n*.maf\n*.mtc\n*.mtc1\n*.nav\n*.nlo\n*.nls\n*.out\n*.pyg\n*.run.xml\n*.snm\n*.synctex.gz\n*.tex.backup\n*.tex~\n*.thm\n*.toc\n*.ver\n*.vrb\n*.xdy\n*.xml\n*blx.bib\n.bak \n.mtc\nbuild/\n_site/\n.sass-cache/\n.jekyll-cache/\n.jekyll-metadata\n# Ignore folders generated by Bundler\n.bundle/\nvendor/"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.\n"
  },
  {
    "path": "M17_spec.tex",
    "content": "% if you need a document suitable for printing/binding, remove the \",oneside\" from the following line.\n\\documentclass[a4paper,11pt,oneside]{book}\n\\usepackage[centering,margin=2.5cm]{geometry}\n\\usepackage[export]{adjustbox}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n\\usepackage{PTSerif}\n\\usepackage{parskip}\n\\usepackage{tabularx}\n\\usepackage{tabularray}\n\\usepackage{multirow}\n\\usepackage{float}\n\\usepackage{nicematrix}\n\\usepackage[tocentry, owncaptions]{vhistory}\n\\NiceMatrixOptions{cell-space-top-limit=4pt, cell-space-bottom-limit=4pt}\n\\usepackage{tikz}\n\\usetikzlibrary{shapes.geometric, arrows.meta}\n\\tikzstyle{textonly} = [rectangle,\nminimum width=1cm,\nminimum height=1cm,\ntext centered,\ndraw=white]\n\\tikzstyle{whrectround} = [rectangle, rounded corners,\nminimum width=1cm,\nminimum height=1cm,\ntext centered,\ntext width=2cm,\ndraw=black]\n\\usepackage{amstext}\n\\usepackage{array,calc}\n\\newcolumntype{L}{>{$}l<{$}}\n\\usepackage{graphicx}\n\\renewcommand{\\arraystretch}{1.5}\n\\usepackage{listings}\n\\usepackage{xcolor}\n\\definecolor{codegreen}{rgb}{0,0.6,0}\n\\definecolor{codegray}{rgb}{0.5,0.5,0.5}\n\\definecolor{codepurple}{rgb}{0.58,0,0.82}\n\\definecolor{backcolour}{rgb}{0.95,0.95,0.92}\n\\lstdefinestyle{codestyle}{\n\tbackgroundcolor=\\color{backcolour},\n\tcommentstyle=\\color{codegreen},\n\tkeywordstyle=\\color{magenta},\n\tnumberstyle=\\tiny\\color{codegray},\n\tstringstyle=\\color{codepurple},\n\tbasicstyle=\\ttfamily\\footnotesize,\n\tbreakatwhitespace=false,\n\tbreaklines=true,\n\tcaptionpos=b,\n\tkeepspaces=true,\n\tnumbers=left,\n\tnumbersep=5pt,\n\tshowspaces=false,\n\tshowstringspaces=false,\n\tshowtabs=false,\n\ttabsize=2\n}\n\\lstset{style=codestyle}\n\\usepackage{amsmath}\n\\setcounter{MaxMatrixCols}{20}\n\\usepackage{longtable,booktabs}\n\\makeatletter\n\\renewcommand{\\frontmatter}{\\cleardoublepage\\@mainmatterfalse}\n\\renewcommand{\\mainmatter}{\\cleardoublepage\\@mainmattertrue}\n\\makeatother\n\\usepackage[pdftex,\n\t\t\tpdfauthor={Wojciech Kaczmarski SP5WWP et al.},\n\t\t\tpdftitle={M17 Protocol Specification},\n\t\t\tpdfsubject={Protocol specification of the Amateur Radio digital mode commonly called M17},\n\t\t\tpdfkeywords={m17, amateur radio, ham radio, digital, digital radio, codec 2, open source, specification},\n\t\t\t]{hyperref}\n\n%opening\n\\title{M17 Protocol Specification}\n\\author{Wojciech Kaczmarski SP5WWP et al.}\n\n\\begin{document}\n\n\\begin{titlepage}\n\t\\raggedleft\n\t\\includegraphics[width=0.7\\linewidth,right]{img/m17_logo_shadow}\n\t\\vspace*{\\baselineskip}\n\t{\\Large Wojciech Kaczmarski SP5WWP et al.} \\\\\n\t\\vspace*{0.167\\textheight}\n\t\\textbf{\\LARGE M17 Protocol Specification} \\\\\n\t\\textbf{\\LARGE Part I - Air Interface} \\\\\n\t\\vfill\n\t{\\large Version \\vhCurrentVersion}\n\t\\vfill\n\t\\today\n\\end{titlepage}\n\n\\frontmatter\n\n\\tableofcontents\n\n\\listoftables\n\n\\listoffigures\n\n\\begin{versionhistory}\n\t\\renewcommand{\\vhversionname}{Rev}\n\t\\renewcommand \\vhAuthorColWidth{.3\\hsize}\n\t\\renewcommand \\vhChangeColWidth{1.7\\hsize}\n\t\\vhEntry{1.0.0}{08 Dec 2019}{SP5WWP|N6MTS}{Formal specification repository created.}\n\t\\vhEntry{1.1.0}{25 Jan 2021}{KC1AWV}{Initial \\LaTeX conversion from Sphinx.}\n\t\\vhEntry{1.2.0}{09 Sep 2024}{N7TAE|SP5WWP}{Removed Definitions and Control Packets sections, rewrote Callsign Encoding appendix using examples in C.}\n\t\\vhEntry{1.3.0}{17 Oct 2024}{N7TAE|SP5WWP}{Introduced new LSD data type to clarify and correct discussion around LICH, and LSF.}\n\t\\vhEntry{1.4.0}{01 Jan 2025}{SP5WWP}{Removed the KISS appendix and created a separate KISS specification document.}\n\t\\vhEntry{1.5.0}{11 Feb 2025}{N7TAE|VK7XT}{Rearranged the Data Link and Application Layer chapters for better flow, removed IP Network chapter and File Type appendix, added more details to Packet Mode, 3 new IP packets defined, and added new clarifying bit tables.}\n\t\\vhEntry{1.6.0}{08 Aug 2025}{SP5WWP}{Section 3.4 was moved to Part II.}\n\t\\vhEntry{2.0.0}{12 Aug 2025}{N7TAE|N7ADJ|SP5WWP}{GNSS Meta data changed extensively. Values are now metric, and a new param related to HDOP was added.}\n\t\\vhEntry{2.0.1}{23 Sep 2025}{K6OF}{Implement CCSDS A20.0-Y-4 style guide and clarify use of UTC.}\n\t\\vhEntry{2.0.2}{28 Sep 2025}{K0RET}{Fixed misspellings.}\n\t\\vhEntry{2.0.3}{09 Oct 2025}{SP5WWP}{Fixed Golay matrices display.}\n\t\\vhEntry{2.0.4}{21 Jan 2026}{SP5WWP}{Changed descriptive words in the Address Encoding Appendix.}\n\\end{versionhistory}\n\n\\chapter{Licenses}\n\n\\paragraph{M17 Protocol Specification}\n\nCopyright \\copyright{}  2023-2025  M17 Project. \\\\\n\nPermission 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}\n\n\\paragraph{M17 Project Software}\n\nCopyright (C) 2024  M17 Project \\\\\n\nSoftware 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.\n\nThis 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.\n\nYou 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.\n\n\\chapter{Introduction}\n\nM17 is an RF protocol that is:\n\n\\begin{itemize}\n\t\\item\n\tCompletely 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.\n\t\\item\n\tOptimized for amateur radio use.\n\t\\item\n\tSimple to understand and implement.\n\t\\item\n\tCapable of doing the things hams expect their digital protocols to do:\n\t\\begin{itemize}\n\t\t\\item\n\t\tVoice (eg: DMR, D-Star, etc)\n\t\t\\item\n\t\tPoint to point data (eg: Packet, D-Star, etc)\n\t\t\\item\n\t\tBroadcast telemetry (eg: APRS, etc)\n\t\t\\item\n\t\tExtensible, so more capabilities can be added over time.\n\t\\end{itemize}\n\\end{itemize}\n\nTo do this, the M17 protocol is broken down into three protocol layers,\nlike a network:\n\n\\begin{enumerate}\n\t\\def\\labelenumi{\\arabic{enumi}.}\n\t\\item\n\tPhysical Layer: How to encode 1s and 0s into RF\\@. Specifies RF modulation, symbol rates, bits per symbol, etc.\n\t\\item\n\tData Link Layer: How to packetize those 1s and 0s into usable data. Packet vs Stream modes, headers, addressing, etc.\n\t\\item\n\tApplication Layer: Accomplishing activities. Voice and data streams, control packets, beacons, etc.\n\\end{enumerate}\n\nThis document will introduce, define and discuss these layers in detail.\n\n\\chapter{Glossary}\n\n\\textbf{Common terms used in M17}\n\n\\paragraph{BER}\n\nBit Error Rate\n\n\\paragraph{ECC}\n\nError Correcting Code\n\n\\paragraph{FEC}\n\nForward Error Correction\n\n\\paragraph{Frame}\n\nThe individual components of a stream, each of which contains payload data interleaved with frame signalling.\n\n\\paragraph{Link Setup Data (LSD)}\n\nThe SRC and DST callsign address fields, TYPE field and the META data.\n\n\\paragraph{Link Setup Frame (LSF)}\n\nThe first data frame of any transmission. It contains an LSD and a CRC.\n\n\\paragraph{LICH}\n\nLink 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\\@.\n\n\\paragraph{Packet}\n\nA single burst of data transmitted in Packet Mode.\n\n\\paragraph{Superframe}\n\nA set of six consecutive frames in the stream mode which collectively contain full LSD are grouped into a superframe.\n\n\\mainmatter\n\\chapter{Physical Layer}\n\nThis section describes the M17 standard radio physical layer suitable\nfor use where a transmission bandwidth of 9 kHz is permitted.\n\n\\section{4-level Frequency-shift Keying Modulation}\n\nThe M17 standard uses 4-level Frequency-shift Keying Modulation (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.\n\n\\section{Dibit, Symbol, and Frequency-shift}\n\nEach of the 4-level frequency-shifts can be represented by dibits (2-bit values) or symbols, as shown in Table~\\ref{tab:dibit_symbol_mapping}.\n\nIn 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\nis sent first. For example, the four dibits contained in the byte \\texttt{0xB4} (\\texttt{10 11 01 00}) would be sent as the symbols (-1, -3, +3, +1).\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tabular}{|c|c|c|c|}\n\t\t\\hline\n\t\t\\multicolumn{2}{|c|}{Dibit} & \\multirow{2}{*}{Symbol} & \\multirow{2}{*}{Deviation} \\\\\n\t\tMSB & LSB &  &  \\\\\n\t\t\\hline\n\t\t0 & 1 & +3 & +2.4 kHz \\\\\n\t\t0 & 0 & +1 & +0.8 kHz \\\\\n\t\t1 & 0 & -1 & -0.8 kHz \\\\\n\t\t1 & 1 & -3 & -2.4 kHz \\\\\n\t\t\\hline\n\t\\end{tabular}\n\t\\caption{Dibit Symbol Mapping to 4FSK Deviation}\n\t\\label{tab:dibit_symbol_mapping}\n\\end{table}\n\n\\section{4FSK Generation}\n\n\\begin{center}\n\t\\begin{figure}[H]\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\node (in) [textonly] {Dibit Input};\n\t\t\\node (sym) [whrectround, right of=in, xshift=1cm] {Dibit to Symbol};\n\t\t\\node (up) [whrectround, right of=sym, xshift=1cm] {Upsampler};\n\t\t\\node (rrc) [whrectround, right of=up, xshift=1cm] {RRC Filter};\n\t\t\\node (fm) [whrectround, right of=rrc, xshift=1cm] {Frequency Modulation};\n\t\t\\node (out) [textonly, right of=fm, xshift=1cm] {4FSK Output};\n\n\t\t\\draw [-latex](in) -- (sym);\n\t\t\\draw [-latex](sym) -- (up);\n\t\t\\draw [-latex](up) -- (rrc);\n\t\t\\draw [-latex](rrc) -- (fm);\n\t\t\\draw [-latex](fm) -- (out);\n\t\\end{tikzpicture}\n\t\\caption{4FSK Generation}\n\t\\end{figure}\n\\end{center}\n\nDibits 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.\n\nUpsampling by a factor of 10 is recommended (48000 samples/s).\n\nThe root-raised-cosine filter should span at least 8 symbols (81 taps at the recommended upsample rate).\n\n\\section{Transmission}\n\nA complete transmission shall consist of a Preamble, a Synchronization Burst, Payload, and an End of Transmission marker.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={|c|c|c|c|},\n\t\trows={m},\n\t\thlines,\n\t}\n\t\tPREAMBLE & SYNC BURST & PAYLOAD & EoT \\\\\n\t\t384 bits & 16 bits & multiples of 2 bits & 384 bits \\\\\n\t\t192 symbols & 8 symbols & multiples of 1 symbol & 192 symbols \\\\\n\t\t40 ms & & & 40 ms \\\\\n\t\\end{tblr}\n\t\\caption{Physical Layer Transmission Structure}\n\\end{table}\n\nTransmissions may include more than one synchronization burst followed by a payload.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{|l|l|l|[dashed]l|[dashed]l|l|l|}\n\t\t\\hline\n\t\tPREAMBLE & SYNC BURST & PAYLOAD & ••• & SYNC BURST & PAYLOAD & EoT \\\\ \\hline\n\t\\end{tblr}\n\t\\caption{Physical Layer Transmission with Multiple Synchronization Bursts}\n\\end{table}\n\n\\subsection{Preamble}\n\nEvery 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.\n\n\\subsection{Synchronization Burst}\n\nA synchronization burst (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.\n\n\\subsection{Payload}\n\nPayload shall be transmitted in multiples of 2 bits (1 symbol).\n\n\\subsection{Randomizer}\n\nTo 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.\n\nThe pseudorandom sequence is composed of the 46 bytes (368 bits) found in the Randomizer appendix Table \\ref{tab:randomizer}.\n\nBefore 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.\n\nWhen 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)}.\n\nOn the receive side, symbols are converted to randomized payload bits. Each randomized payload bit is converted back to a payload bit by once\nagain XORing each randomized bit with the corresponding pseudorandom sequence bit.\n\n\\subsection{End of Transmission Marker}\n\nEvery transmission ends with an End of Transmission (EoT) marker, a distinct symbol stream, which shall consist of 40 ms (192 symbols) of a repeating \\texttt{0x555D} (+3, +3, +3, +3, +3, +3, -3, +3) pattern.\n\n\\subsection{Carrier-sense Multiple Access}\n\nCarrier-sense Multiple Access (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.\n\n\\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.\n\n\\section{Physical Layer Flow Summary}\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\node (payload) [whrectround] {Payload};\n\t\t\\node (rand) [whrectround, below of=payload] {Randomizer};\n\t\t\\node (sync) [whrectround, below of=rand] {prepend SYNC BURST};\n\t\t\\node (pre) [whrectround, left of=sync, xshift=-2cm] {Preamble};\n\t\t\\node (eot) [whrectround, right of=sync, xshift=2cm] {EoT};\n\t\t\\node (cd) [whrectround, below of=sync] {chunk dibit};\n\t\t\\node (dtos) [whrectround, below of=cd] {dibit to symbol};\n\t\t\\node (up) [whrectround, below of=dtos] {upsampler};\n\t\t\\node (rrc) [whrectround, below of=up] {rrc filter};\n\t\t\\node (fm) [whrectround, below of=rrc] {frequency modulation};\n\t\t\\node (fsk) [whrectround, below of=fm] {4FSK RF};\n\n\t\t\\draw [-latex](payload) -- (rand);\n\t\t\\draw [-latex](rand) -- (sync);\n\t\t\\draw [-latex](sync) -- (cd);\n\t\t\\draw [-latex](pre) -- (cd);\n\t\t\\draw [-latex](eot) -- (cd);\n\t\t\\draw [-latex](cd) -- (dtos);\n\t\t\\draw [-latex](dtos) -- (up);\n\t\t\\draw [-latex](up) -- (rrc);\n\t\t\\draw [-latex](rrc) -- (fm);\n\t\t\\draw [-latex](fm) -- (fsk);\n\t\\end{tikzpicture}\n\t\\caption{Physical Layer Flow}\n\\end{figure}\n\n\\chapter{Data Link Layer}\n\n\\section{Frame}\n\nA 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.\n\nThere 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.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={|c|c|},\n\t\trows={m},\n\t\thlines,\n\t}\n\t\tSYNC BURST & PAYLOAD \\\\\n\t\t16 bits & 368 bits \\\\\n\t\t8 symbols & 184 symbols \\\\\n\t\\end{tblr}\n\t\\caption{Frame Structure}\n\\end{table}\n\n\\section{Forward Error Correction}\n\nThe 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.\n\nApplying 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 Table~\\ref{tab:bit_types}. 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\nutilized will be indicated for each frame type.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{ll}\n\t\t\\hline\n\t\tType & Description \\\\\n\t\t\\hline\n\t\tType 1 & Data link layer content bits \\\\\n\t\tType 2 & Bits after appropriate encoding \\\\\n\t\tType 3 & Bits after puncturing. described in \\autoref{puncturing} \\\\\n\t\tType 4 & Interleaved (re-ordered) bits \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Bit Types}\n\t\\label{tab:bit_types}\n\\end{table}\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\node (cont) [whrectround] {Data Link Layer Contents};\n\t\t\\node (ecc) [whrectround, right of=cont, xshift=2.5cm] {ECC/FEC Encode};\n\t\t\\node (payload) [whrectround, right of=ecc, xshift=2.5cm] {Payload};\n\n\t\t\\draw [-latex](cont) -- node [midway, above] {Type 1 bits} (ecc);\n\t\t\\draw [-latex](ecc) -- node [midway, above] {Type 4 bits} (payload);\n\t\\end{tikzpicture}\n\t\\caption{Transmit Contents to Payload}\n\\end{figure}\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\node (payload) [whrectround] {Payload};\n\t\t\\node (ecc) [whrectround, right of=payload, xshift=2.5cm] {ECC/FEC Decode};\n\t\t\\node (cont) [whrectround, right of=ecc, xshift=2.5cm] {Data Link Layer Contents};\n\n\t\t\\draw [-latex](payload) -- node [midway, above] {Type 4 bits} (ecc);\n\t\t\\draw [-latex](ecc) -- node [midway, above] {Type 1 bits} (cont);\n\t\\end{tikzpicture}\n\t\\caption{Receive Payload to Contents}\n\\end{figure}\n\n\\section{Modes}\n\nThe Data Link layer shall operate in one of three modes during a Transmission.\n\n\\begin{itemize}\n\t\\item\n\tStream Mode\n    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.\n\t\\item\n\tPacket Mode\n\tData 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.\n\t\\item\n\tBERT Mode\n\tPRBS9 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.\n\\end{itemize}\n\n\\begin{quote}\n\tNOTE As is the convention with other networking protocols, all values and data structures are encoded in big endian byte order.\n\\end{quote}\n\n\\section{Synchronization Burst}\n\\label{sec:sync_burst}\n\nAll frames shall be preceded by 16 bits (8 symbols) of a Synchronization Burst (Sync Burst). The Sync Burst definition straddles both the Physical Layer and the Data Link Layer.\n\nOnly LSF and BERT Sync Bursts may immediately follow the Preamble, and each requires a different Preamble symbol pattern as shown in Table~\\ref{tab:frame_specific_sync_bursts}.\n\nDuring a Transmission, only one LSF Sync Burst may be present, and if present, it shall immediately follow the Preamble.\n\nBERT Sync Bursts, if present, may only follow the Preamble or other BERT frames.\n\nMultiple Stream or Packet Sync Bursts may be present during a Transmission, depending on the mode.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={lccr},\n\t\t}\n\t\t\\hline\n\t\tFrame Type & Preamble & Sync Burst Bytes & Sync Burst Symbols \\\\\n\t\t\\hline\n\t\tLSF & +3, -3 & \\texttt{0x55F7} & +3, +3, +3, +3, -3, -3, +3, -3 \\\\\n\t\tBERT & -3, +3 & \\texttt{0xDF55} & -3, +3, -3, -3, +3, +3, +3, +3 \\\\\n\t\tStream & None & \\texttt{0xFF5D} & -3, -3, -3, -3, +3, +3, -3, +3 \\\\\n\t\tPacket & None & \\texttt{0x75FF} & +3, -3, +3, +3, -3, -3, -3, -3 \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Frame Specific Sync Bursts}\n\t\\label{tab:frame_specific_sync_bursts}\n\\end{table}\n\n\\section{Link Setup}\n\n\\subsection{Link Setup Data}\n\nThe Link Setup Data (LSD) is a data structure that is common to both Stream and Packet Mode and contains information needed to establish a link. This data is a fundamental part of both RF data streams and and any kind of internet protocol packets.\n\n\\begin{table}[H] \\label{lsd}\n\t\\centering\n\t\\begin{tblr}{lcl}\n\t\t\\hline\n\t\tField & Length & Description \\\\\n\t\t\\hline\n\t\tDST & 48 bits & An encoded destination \\\\\n\t\tSRC & 48 bits & An encoded source \\\\\n\t\tTYPE & 16 bits & Specifies all characteristic of the payload \\\\\n\t\tMETA & 112 bits & Meta data \\\\\n\t\t\\hline[2pt]\n\t\\end{tblr}\n\t\\caption{Link Setup Data Contents}\n\t\\label{tab:lsd_contents}\n\\end{table}\n\nTotal: 28 bytes, 224 Type 1 bits\n\n\\begin{itemize}\n\t\\item DST and SRC and typically encoded radio amateur callsigns or special identifiers.\n\t\\item TYPE specifies all the characteristics of the payload.\n\t\\item META data is suitable for cryptographic metadata like IVs or single-use numbers, or non-crypto metadata like the sender's GNSS position.\n\\end{itemize}\n\n\\subsection{Link Setup Frame}\n\nThe link Setup Frame (LSF) is an LSD followed immediately by a 16 bit cyclic redundancy check (CRC). The LSF is the first data frame in a Stream Mode or Packet Mode transmission.\n\n\\begin{table}[H] \\label{lsf}\n\t\\centering\n\t\\begin{tblr}{lcl}\n\t\t\\hline\n\t\tField & Length & Description \\\\\n\t\t\\hline\n\t\tLSD & 224 bits & Shown in Table~\\ref{tab:lsd_contents} \\\\\n\t\tCRC & 16 bits & CRC for the link setup data \\\\\n\t\t\\hline[2pt]\n\t\\end{tblr}\n\t\\caption{Link Setup Frame Contents}\n\\end{table}\n\nTotal: 30 bytes, 240 Type 1 bits\n\nThe CRC can be used to validate the integrity of the contained LSD and is described below.\n\n\\section{CRC} \\label{crc}\n\nM17 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.\n\nAs M17's native bit order is most significant bit first, neither the input nor the output of the CRC algorithm gets reflected.\n\nThe 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.\n\nThe test vectors in the Table~\\ref{tab:crc_test_vectors} are calculated by feeding the given message to the CRC algorithm.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{ll}\n\t\t\\hline\n\t\tMessage & CRC Output \\\\\n\t\t\\hline\n\t\t(empty string) & \\texttt{0xFFFF} \\\\\n\t\tASCII string ``A'' & \\texttt{0x206E} \\\\\n\t\tASCII string ``123456789'' & \\texttt{0x772B} \\\\\n\t\tBytes \\texttt{0x00} to \\texttt{0xFF} & \\texttt{0x1C31} \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{CRC Test Vectors}\n\t\\label{tab:crc_test_vectors}\n\\end{table}\n\n\\section{LSF Contents ECC/FEC}\n\nThe 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.\n\nType 3 bits are computed by $P_1$ puncturing the Type 2 bits, resulting in 368 Type 3 bits.\n\nInterleaving the Type 3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer. Interleaving is described in \\autoref{interleaving}.\n\nWithin 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).\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\tikzstyle{sub} = [draw,rectangle,fill=black!20]\n\t\t\\node (dl) [sub] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (dll) [rectangle,inner ysep=0cm] {Data Link Layer};\n\t\t\t\t\\node (cont) [rectangle,draw,fill=white,yshift=-1cm] {Contents};\n\t\t\t\t\\node (add) [rectangle,draw,below of=cont,fill=white] {add 4 flush bits};\n\t\t\t\t\\node (conv) [rectangle,draw,below of=add,fill=white,yshift=1cm] {convolutional encoder};\n\t\t\t\t\\node (p1) [rectangle,draw,below of=conv,fill=white] {$P_1$ puncturer};\n\t\t\t\t\\node (int) [rectangle,draw,below of=p1,fill=white] {interleaver};\n\t\t\t\t\\draw [-latex](cont) -- node [midway,fill=black!20] {240 Type 1 bits} (add);\n\t\t\t\t\\draw [-latex](add) -- (conv);\n\t\t\t\t\\draw [-latex](conv) -- node [midway,fill=black!20] {488 Type 2 bits} (p1);\n\t\t\t\t\\draw [-latex](p1) -- node [midway,fill=black!20] {368 Type 3 bits} (int);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\node (pl) [sub,below of=dl,yshift=-6cm] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (pll) [rectangle,inner ysep=0cm] {Physical Layer};\n\t\t\t\t\\node (rand) [rectangle,draw,below of=pll,fill=white,yshift=1cm] {randomizer};\n\t\t\t\t\\node (pre) [rectangle,draw,below of=rand,fill=white,yshift=1cm] {prepend LSF Sync Burst};\n\t\t\t\t\\node (con) [rectangle,draw,below of=pre,fill=white] {Physical Layer Continues...};\n\t\t\t\t\\draw [-latex](rand) -- (pre);\n\t\t\t\t\\draw [-latex](pre) -- node [midway,fill=black!20] {384-bit Frame} (con);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\draw [-latex](dl) -- node [midway,fill=white] {368 Type 4 bits} (pl);\n\t\\end{tikzpicture}\n\t\\caption{LSF Construction}\n\\end{figure}\n\nDetails of the convolutional encoder are in \\autoref{convolutional_encoder}.\n\n\\section{Stream Mode}\n\nIn Stream Mode, an \\emph{indefinite} amount of data is sent continuously\nwithout breaks in the physical layer. Stream Mode shall always start\nwith an LSF that has the LSF TYPE Packet/Stream indicator bit set to 1\n(Stream Mode). Other valid LSF TYPE parameters are selected per\napplication.\n\nFollowing the LSF, one or more Stream Frames may be sent.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\t\tcolspec={|c|X[c]|X[c]|X[c]|X[c]|[dashed]c|[dashed]X[c]|X[c]|c|},\n\t\t\trows={m},\n\t\t\thlines,\n\t\t}\n\t\tPREAMBLE & LSF SYNC BURST & LSF FRAME & STREAM SYNC BURST & STREAM FRAME & ••• & STREAM SYNC BURST & STREAM FRAME & EoT \\\\\n\t\\end{tblr}\n\t\\caption{Stream Mode}\n\\end{table}\n\n\\subsection{Stream Frames}\n\nStream 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.\n\n\\paragraph{Link Information Channel (LICH)}\n\nThe LICH allows for late listening and independent decoding to check destination address if the LSF for the current transmission was missed.\n\nEach 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.\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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]\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 & \\Block{3-8}{40-bit chunk of full LSF Contents (Type 1 bits)} \\\\\n\t\t\\ldots &  \\\\\n\t\t4 & \\\\\n\t\t5 & \\multicolumn{3}{c}{LICH\\_CNT} & \\multicolumn{5}{c}{\\textit{Reserved}} \\\\\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{Link Information Channel Layout}\n\\end{table}\n\nTotal: 48 bits\n\nThe 40-bit chunks start from the beginning of the LSF.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={ll},\n\t\t}\n\t\t\\hline\n\t\tLICH\\_CNT & LSF bits \\\\\n\t\t\\hline\n\t\t0 & 0:39 \\\\\n\t\t1 & 40:79 \\\\\n\t\t2 & 80:119 \\\\\n\t\t3 & 120:159 \\\\\n\t\t4 & 160:199 \\\\\n\t\t5 & 200:239 \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{LICH\\_CNT and LSF Bits}\n\\end{table}\n\n\\paragraph{LICH Contents ECC/FEC}\n\nThe 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.\n\n\\paragraph{Stream Contents}\n\nThe LSD META field can change during a transmission and this will affect bits 112:239 of the LSF, resulting in changes in the LICH channel with LICH\\_CNT 2 through 5. In addition, the stream frames also contain the stream contents that has two fields that will change with every frame.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={lll},\n\t\t}\n\t\t\\hline\n\t\tField & Length & Description \\\\\n\t\t\\hline\n\t\tFN & 16 bits & Frame Number \\\\\n\t\tSTREAM & 128 bits & Stream data, can contain arbitrary data \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Stream Contents}\n\\end{table}\n\nTotal: 144 Type 1 bits\n\nThe 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.\n\nStream 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.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={llXX},\n\t\t}\n\t\t\\hline\n\t\tMode & Codec 2 rate & Frame t + 0 & Frame t + 1... \\\\\n\t\t\\hline\n\t\tVoice & 3200 & 128 bits encoded speech & 128 bits encoded speech \\\\\n\t\tVoice + Data & 1600 & 64 bits encoded speech + 64 bits arbitrary data & 64 bits encoded speech + 64 bits arbitrary data \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{STREAM Payload Examples}\n\\end{table}\n\n\\paragraph{Stream Contents ECC/FEC}\n\nThe 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.\n\nThese bits are $P_2$ punctured to generate 272 Type 3 bits that are fed into the Frame Combiner.\n\n\\paragraph{Frame Combiner}\n\nThe 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.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{lrl}\n\t\t\\hline\n\t\tField & Length & Description \\\\\n\t\t\\hline\n\t\tLICH & 96 bits & ECC/FEC LICH Contents Type 2 bits \\\\\n\t\tSTREAM & 272 bits & ECC/FEC STREAM Contents Type 3 bits \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{LICH and Stream Combined}\n\\end{table}\n\nTotal: 368 Type 2/3 bits\n\nInterleaving the Combined Type 2/3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer.\n\nWithin 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).\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\tikzstyle{sub} = [draw,rectangle,fill=black!20]\n\t\t\\node (dl) [sub] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (dl) [rectangle,fill=black!20] {Data Link Layer};\n\t\t\t\t\\node (ch128) [rectangle,draw,below of=dl,fill=white,yshift=1.5cm,xshift=3cm] {chunk 128 bits};\n\t\t\t\t\\node (pp) [rectangle,draw,below of=ch128,fill=white,yshift=1cm] {prepend frame number};\n\t\t\t\t\\node (add) [rectangle,draw,below of=pp,fill=white] {add 4 flush bits};\n\t\t\t\t\\node (conv) [rectangle,draw,below of=add,fill=white,yshift=1cm] {convolutional encoder};\n\t\t\t\t\\node (p2) [rectangle,draw,below of=conv,fill=white] {$P_2$ puncturer};\n\t\t\t\t\\node (fc) [rectangle,draw,below of=p2,fill=white,xshift=-3cm] {Frame Combiner};\n\t\t\t\t\\node (lc) [rectangle,draw,below of=dl,fill=white,yshift=-1cm,xshift=-3cm] {LSF Contents};\n\t\t\t\t\\node (ch40) [rectangle,draw,below of=lc,fill=white,yshift=1cm] {chunk 40 bits};\n\t\t\t\t\\node (al) [rectangle,draw,below of=ch40,fill=white] {add LICH counter};\n\t\t\t\t\\node (gl) [rectangle,draw,below of=al,fill=white,yshift=1cm] {Golay (24, 12)};\n\t\t\t\t\\node (il) [rectangle,draw,below of=fc,fill=white] {interleaver};\n\t\t\t\t\\draw [-latex](ch128) -- (pp);\n\t\t\t\t\\draw [-latex](pp) -- node [midway,fill=black!20] {144 Type 1 bits} (add);\n\t\t\t\t\\draw [-latex](add) -- (conv);\n\t\t\t\t\\draw [-latex](conv) -- node [midway,fill=black!20] {296 Type 2 bits} (p2);\n\t\t\t\t\\draw [-latex](p2) -- node [midway,fill=black!20] {272 Type 3 bits} (fc);\n\t\t\t\t\\draw [-latex](lc) -- (ch40);\n\t\t\t\t\\draw [-latex](ch40) -- node [midway,fill=black!20] {40 Type 1 bits} (al);\n\t\t\t\t\\draw [-latex](al) -- (gl);\n\t\t\t\t\\draw [-latex](gl) -- node [midway,fill=black!20] {96 Type 2 bits} (fc);\n\t\t\t\t\\draw [-latex](fc) -- node [midway,fill=black!20] {96 Type 2 bits + 272 Type 3 bits = 368 Type 2/3 bits} (il);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\node (al) [sub,above of=dl,yshift=6cm] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (ap) [rectangle,fill=black!20] {Application Layer};\n\t\t\t\t\\node (sd) [rectangle,draw,below of=ap,fill=white,yshift=1.5cm] {Stream Data};\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\draw [-latex](al) -- node [midway,fill=white] {Continuous data} (dl);\n\t\t\\node (pl) [sub,below of=dl,yshift=-8cm] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (phy) [rectangle,fill=black!20] {Physical Layer};\n\t\t\t\t\\node (rand) [rectangle,draw,below of=phy,fill=white,yshift=1.5cm] {randomizer};\n\t\t\t\t\\node (pps) [rectangle,draw,below of=rand,fill=white,yshift=1cm] {prepend Stream Sync Burst};\n\t\t\t\t\\node (plc) [rectangle,draw,below of=pps,fill=white] {Physical Layer Continues...};\n\t\t\t\t\\draw [-latex](rand) -- (pps);\n\t\t\t\t\\draw [-latex](pps) -- node [midway,fill=black!20] {384-bit Frame} (plc);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\draw [-latex](dl) -- node [midway,fill=white] {368 Type 4 bits} (pl);\n\t\\end{tikzpicture}\n\t\\caption{Stream Frame Construction}\n\\end{figure}\n\n\\subsection{Stream Superframes}\n\nStream 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.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{NiceTabular}{cc|c|c|}\n\t\\cline{3-4}\n\t& & PREAMBLE & $\\geq$ 40 ms \\\\ \\cline{3-4}\n\t& \\Block{2-1}{LINK SETUP} & LSF\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & LSF & \\\\ \\cline{3-4}\n\t\\Block{12-1}{SUPERFRAME 1} & \\Block{2-1}{FRAME 0} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\Block{2-1}{FRAME 1} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\Block{2-1}{FRAME 2} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\Block{2-1}{FRAME 3} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\Block{2-1}{FRAME 4} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\Block{2-1}{FRAME 5} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\Block{2-1}{FRAME 6} & FRAME\\_SYNC & \\Block{2-1}{40 ms} \\\\ \\cline{3-3}\n\t& & FRAME\\_DATA & \\\\ \\cline{3-4}\n\t& \\ldots & \\ldots & \\ldots \\\\ \\cline{3-4}\n\t\\CodeAfter\n\t\t\\SubMatrix{\\{}{4-2}{15-2}{.}\n\t\\end{NiceTabular}\n\t\\caption{Stream Superframes}\n\t\\label{fig:m17stream}\n\\end{figure}\n\n\\section{Packet Mode}\n\nIn 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 ranges from 25 to 825 (33*25) bytes in 25 byte increments.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={ll},\n\t\t}\n\t\t\\hline\n\t\tBytes & Meaning \\\\\n\t\t\\hline\n\t\t0..n-1 & Application Packet Data \\\\\n\t\tn..n+1 & CRC \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Single Packet}\n\\end{table}\n\nn is the number of bytes of the Application Packet Data. The CRC calculation used here is described in Section \\ref{crc}.\n\nPacket 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.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\t\tcolspec={|c|X[c]|X[c]|X[c]|X[c]|[dashed]c|[dashed]X[c]|X[c]|c|},\n\t\t\trows={m},\n\t\t\thlines,\n\t\t}\n\t\tPREAMBLE & LSF Sync Burst & LSF Frame & Packet Sync Burst & Packet Frame & ••• & Packet Sync Burst & Packet Frame & EoT \\\\\n\t\\end{tblr}\n\t\\caption{Packet Mode}\n\\end{table}\n\n\\subsection{Packet Frames} \\label{packet_frames}\n\nPacket Frames contain Packet Contents after ECC/FEC is applied.\n\n\\paragraph{Packet Contents}\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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]\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 & \\Block{3-8}{200-bit chunk of Single Packet} \\\\\n\t\t\\ldots &  \\\\\n\t\t24 & \\\\\n\t\t25 &\n\t\t\t\\parbox{3em}{\\centering End of Frame} &\n\t\t\t\\multicolumn{5}{c}{Packet Frame/Byte Counter} &\n\t\t\t\\Block[fill=gray]{1-2}{} & \\\\\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{Packet Layout}\n\\end{table}\n\nTotal: 206 Type 1 bits\n\nThe 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.\n\nData 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 null bytes (after the terminating CRC) to reach 25 bytes total.\n\nThe 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.\n\nWhen 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.\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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]\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 &\n\t\t\t0 &\n\t\t\t\\multicolumn{5}{c}{Frame number, 0..31} &\n\t\t\t\\Block[fill=gray]{1-2}{} & \\\\\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{Packet Metadata Field with EOF = 0}\n\\end{table}\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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]\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 &\n\t\t\t1 &\n\t\t\t\\multicolumn{5}{c}{Number of bytes in frame, 1..25} &\n\t\t\t\\Block[fill=gray]{1-2}{} & \\\\\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{Packet Metadata Field with EOF = 1}\n\\end{table}\n\n\\paragraph{Packet Contents ECC/FEC}\n\nThe 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 420 Type 2 bits.\n\nThese bits are $P_3$ punctured to generate 368 Type 3 bits.\n\nInterleaving the Type 3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer.\n\nWithin 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).\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\tikzstyle{sub} = [draw,rectangle,fill=black!20]\n\t\t\\node (dl) [sub] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (dll) [rectangle,fill=black!20] {Data Link Layer};\n\t\t\t\t\\node (ch200) [rectangle,draw,below of=dl,fill=white,yshift=1.5cm] {chunk 200 bits};\n\t\t\t\t\\node (addm) [rectangle,draw,below of=ch200,fill=white,yshift=1cm] {add metadata};\n\t\t\t\t\\node (add4) [rectangle,draw,below of=addm,fill=white] {add 4 flush bits};\n\t\t\t\t\\node (conv) [rectangle,draw,below of=add4,fill=white,yshift=1cm] {convolutional encoder};\n\t\t\t\t\\node (p3) [rectangle,draw,below of=conv,fill=white] {$P_3$ puncturer};\n\t\t\t\t\\node (int) [rectangle,draw,below of=p3,fill=white] {interleaver};\n\t\t\t\t\\draw [-latex](ch200) -- (addm);\n\t\t\t\t\\draw [-latex](addm) -- node [midway,fill=black!20] {206 Type 1 bits} (add4);\n\t\t\t\t\\draw [-latex](add4) -- (conv);\n\t\t\t\t\\draw [-latex](conv) -- node [midway,fill=black!20] {420 Type 2 bits} (p3);\n\t\t\t\t\\draw [-latex](p3) -- node [midway,fill=black!20] {368 Type 3 bits} (int);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\node (al) [sub,above of=dl,yshift=4cm] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (ap) [rectangle,fill=black!20] {Application Layer};\n\t\t\t\t\\node (sd) [rectangle,draw,below of=ap,fill=white,yshift=1.5cm] {Packet Data};\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\draw [-latex](al) -- (dl);\n\t\t\\node (pl) [sub,below of=dl,yshift=-6cm] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (phy) [rectangle,fill=black!20] {Physical Layer};\n\t\t\t\t\\node (rand) [rectangle,draw,below of=phy,fill=white,yshift=1.5cm] {randomizer};\n\t\t\t\t\\node (pps) [rectangle,draw,below of=rand,fill=white,yshift=1cm] {prepend Stream Sync Burst};\n\t\t\t\t\\node (plc) [rectangle,draw,below of=pps,fill=white] {Physical Layer Continues...};\n\t\t\t\t\\draw [-latex](rand) -- (pps);\n\t\t\t\t\\draw [-latex](pps) -- node [midway,fill=black!20] {384-bit Frame} (plc);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\draw [-latex](dl) -- node [midway,fill=white] {368 Type 4 bits} (pl);\n\t\\end{tikzpicture};\n\t\\caption{Packet Frame Construction}\n\\end{figure}\n\n\\subsection{Packet Superframes}\n\nA Packet Superframe consists of at least 1 and up to the 33 Packet Frames to reconstruct the original Single Packet.\n\n\\subsection{Net Throughput}\n\nPacket Mode achieves a base throughput of 5 kbps, and a net throughput of over 4.5 kbps can be achieved for large payloads.\n\nBelow is a graph of the net throughput in bits/second \\textit{vs.} payload size in bytes.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics[scale=0.7]{img/pm_thruput.png}\n\t\\caption{Packet Mode Net Throughput}\n\\end{figure}\n\n\\section{BERT Mode}\n\nBERT mode is a standardized, interoperable mode for bit error rate testing. The preamble is sent, followed by an indefinite sequence of BERT frames. Notably, an LSF is not sent in BERT mode.\n\nThe primary purpose of defining a bit error rate testing standard for M17 is to enhance interoperability testing across M17 hardware and software implementations, and to aid in the configuration and tuning of ad hoc communications equipment common in amateur radio.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\t\tcolspec={|c|X[c]|X[c]|[dashed]c|[dashed]X[c]|X[c]|c|},\n\t\t\trows={m},\n\t\t\thlines,\n\t\t}\n\t\tPREAMBLE & BERT Sync Burst & BERT Frame  & ••• & BERT Sync Burst & BERT Frame & EoT \\\\\n\t\\end{tblr}\n\t\\caption{Packet Mode}\n\\end{table}\n\n\\subsection{BERT Frames}\n\nBERT Frames contain BERT Contents after ECC/FEC is applied.\n\n\\paragraph{BERT Contents}\n\nThe BERT Contents consists of 197 bits from a \\href{https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence}{PRBS9} generator. This is 24 bytes and 5 bits of data. The next BERT Contents starts with the 198th bit from the PRBS9 generator. The same generator is used for each subsequent BERT Contents without being reset. The number of bits pulled from the generator, 197, is a prime number. This will produce a reasonably large number of unique frames even with a PRBS generator with a relatively short period.\n\nSee \\autoref{bert_details} for BERT generation and reception details.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{ll}\n\t\t\\hline\n\t\tBits & Meaning \\\\\n\t\t\\hline\n\t\t0-196 & BERT PRBS9 Payload \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{BERT Contents}\n\\end{table}\n\nTotal: 197 Type 1 bits\n\n\\paragraph{BERT Contents ECC/FEC}\n\nThe 197 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. 201 bits total are encoded resulting in 402 Type 2 bits.\n\nThese bits are $P_2$ punctured to generate 368 Type 3 bits.\n\nInterleaving the Type 3 bits produces 368 Type 4 bits that are ready to be passed to the Physical Layer.\n\nThis provides the same error ECC/FEC used for Stream Frames.\n\nWithin the Physical Layer, the 368 Type 4 bits are randomized and combined with the 16-bit BERT Sync Burst, which results in a complete frame of 384 bits (384 bits / 9600bps = 40 ms).\n\n\\begin{figure}[H]\n\t\\centering\n\t\\begin{tikzpicture}[node distance=2cm]\n\t\t\\tikzstyle{sub} = [draw,rectangle,fill=black!20]\n\t\t\\node (dl) [sub] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (dll) [rectangle,fill=black!20] {Data Link Layer};\n\t\t\t\t\\node (bp) [rectangle,draw,below of=dl,fill=white,yshift=1.5cm] {BERT PRBS9 Data};\n\t\t\t\t\\node (ch197) [rectangle,draw,below of=bp,fill=white,yshift=1cm] {chunk 197 bits};\n\t\t\t\t\\node (add4) [rectangle,draw,below of=addm,fill=white] {add 4 flush bits};\n\t\t\t\t\\node (conv) [rectangle,draw,below of=add4,fill=white,yshift=1cm] {convolutional encoder};\n\t\t\t\t\\node (p2) [rectangle,draw,below of=conv,fill=white] {$P_2$ puncturer};\n\t\t\t\t\\node (int) [rectangle,draw,below of=p2,fill=white] {interleaver};\n\t\t\t\t\\draw [-latex](bp) -- (ch197);\n\t\t\t\t\\draw [-latex](ch197) -- node [midway,fill=black!20] {197 Type 1 bits} (add4);\n\t\t\t\t\\draw [-latex](add4) -- (conv);\n\t\t\t\t\\draw [-latex](conv) -- node [midway,fill=black!20] {402 Type 2 bits} (p2);\n\t\t\t\t\\draw [-latex](p2) -- node [midway,fill=black!20] {368 Type 3 bits} (int);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\node (pl) [sub,below of=dl,yshift=-6cm] {\n\t\t\t\\begin{tikzpicture}\n\t\t\t\t\\node (phy) [rectangle,fill=black!20] {Physical Layer};\n\t\t\t\t\\node (rand) [rectangle,draw,below of=phy,fill=white,yshift=1.5cm] {randomizer};\n\t\t\t\t\\node (ppb) [rectangle,draw,below of=rand,fill=white,yshift=1cm] {prepend BERT Sync Burst};\n\t\t\t\t\\node (plc) [rectangle,draw,below of=pps,fill=white] {Physical Layer Continues...};\n\t\t\t\t\\draw [-latex](rand) -- (ppb);\n\t\t\t\t\\draw [-latex](ppb) -- node [midway,fill=black!20] {384-bit Frame} (plc);\n\t\t\t\\end{tikzpicture}\n\t\t};\n\t\t\\draw [-latex](dl) -- node [midway,fill=white] {368 Type 4 bits} (pl);\n\t\\end{tikzpicture}\n\t\\caption{BERT Frame Construction}\n\\end{figure}\n\n\\chapter{Application Layer}\n\nStream mode is primarily for an audio stream containing low bit rate speech encoded using the open source \\href{http://rowetel.com/codec2.html}{Codec 2} codec. One of two different Codec 2 rates can be used in M17, and so Stream mode can be used in a voice-only mode using the higher bit rate codec, and voice+data mode using a lower bit rate codec which leave room for a parallel data stream, and a data only stream mode where arbitrarily large data objects can be streamed. Stream mode is intended to be used over the air by amateur radio operators worldwide. Implementation details for M17 clients, repeaters, and gateways ensure that an M17 Amateur Radio Voice Application is legal under all licensing regimes.\n\nPacket mode is a one-shot method to send a small data packet over the air. It is intended primarily for text messaging, but other small binary objects can also be sent.\n\nBoth Stream and Packet mode begins with an Link Setup Frame, LSF.\n\n\\section{LSF}\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{lrl}\n\t\t\\hline\n\t\tField & Length & Description \\\\\n\t\t\\hline\n\t\tDST & 48 bits & Destination address \\\\\n\t\tSRC & 48 bits & Source address \\\\\n\t\tTYPE & 16 bits & Information about the incoming data stream \\\\\n\t\tMETA & 112 bits & Metadata field \\\\\n\t\tCRC & 16 bits & Detailed in Section \\ref{crc} \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Link Setup Frame Contents}\n\\end{table}\n\n\\subsection{Address fields}\n\nDestination (DST) and source (SRC) addresses may be encoded amateur radio callsigns, or special identifiers. See Address Encoding \\autoref{address_encoding} for details on how up to 9 characters of text can be encoded into the 6-byte address value.\n\nThe source address is always the callsign of the station transmitting, be it a client, repeater, or gateway. This is not a problem for a client, but for a repeater/gateway this raises issues about identifying the original source of a transmission. Having a repeater/gateway always use its own callsign for the source field does ensure that there are no issues with licensing authorities. To retain identification of the original source for a voice stream, an extended callsign data field will be encoded in the LSF META field.\n\nThe destination address used by a client may simply be a callsign or reflector designation for a point to point contact, or may be a special identifier. Special identifiers are 6-byte addresses than can't be encoded in the standard way. For an explanation, see the Address Encoding \\autoref{address_encoding}.\n\n\\subsection{TYPE}\n\nThe 2-byte 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.\n\n\\subsection{META}\n\nThe 14-byte META field can and will contain a variety of data. In Stream mode, the META data will change as the stream evolves. The first meta field is available in the LSF frame but subsequent data/voice frames will potentially carry different META data in each superframe that follows. In Packet mode, one META field is available in the LSF frame. Different META data is described later in this chapter.\n\n\\subsection{CRC}\n\nThe last 2 bytes of the 30-byte LSF is a 16-bit CRC as described in Section \\ref{crc}.\n\n\\section{Stream Mode}\n\n\\subsection{TYPE Field}\n\nThe TYPE field contains all information need to properly interpret the stream frames.\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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}|}\n\t\t\\hline\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 &\n\t\t\t\\multicolumn{4}{c}{\\textit{Reserved}} &\n\t\t\t\\parbox{3em}{\\centering Signed Stream} &\n\t\t\t\\multicolumn{3}{c}{Channel Access Number\\ldots} \\\\\n\t\t\\hline\n\t\t1 &\n\t\t\t\\ldots &\n\t\t\t\\multicolumn{2}{c}{\\parbox{6em}{\\centering Encryption Subtype}} &\n\t\t\t\\multicolumn{2}{c}{\\parbox{6em}{\\centering Encryption Type}} &\n\t\t\t\\multicolumn{2}{c}{\\parbox{6em}{\\centering Data Type}} &\n\t\t\t\\parbox{3em}{\\centering Packet/ Stream} \\\\\n\t\t\\hline\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{Stream LSF TYPE Layout}\n\\end{table}\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={ll},\n\t\t}\n\t\t\\hline\n\t\tValue & Mode \\\\\n\t\t\\hline\n\t\t0 & Packet mode \\\\\n\t\t1 & Stream mode \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Packet/Stream Indicator}\n\\end{table}\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={ll},\n\t\t}\n\t\t\\hline\n\t\tValue & Content \\\\\n\t\t\\hline\n\t\t$00_2$ & Reserved \\\\\n\t\t$01_2$ & Data \\\\\n\t\t$10_2$ & Voice \\\\\n\t\t$11_2$ & Voice+Data \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Data Type}\n\\end{table}\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={ll},\n\t\t}\n\t\t\\hline\n\t\tValue & Encryption \\\\\n\t\t\\hline\n\t\t$00_2$ & None \\\\\n\t\t$01_2$ & Scrambler \\\\\n\t\t$10_2$ & AES \\\\\n\t\t$11_2$ & Other/reserved \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Encryption Type}\n\\end{table}\n\nFor the encryption subtype, meaning of values depends on encryption type.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={lll},\n\t\t}\n\t\t\\hline\n\t\tValue & Scrambler & AES \\\\\n\t\t\\hline\n\t\t$00_2$ & 8-bit & 128-bit \\\\\n\t\t$01_2$ & 16-bit & 192-bit \\\\\n\t\t$10_2$ & 24-bit & 256-bit \\\\\n\t\t$11_2$ & reserved & reserved \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Key Lengths for Encryption Subtypes}\n\\end{table}\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{ll}\n\t\t\\hline\n\t\tPacket/Stream & 1 = Stream Mode \\\\\n\t\t\\hline\n\t\tData Type & $10_2$ = Voice only (3200 bps) \\\\\n\t\t\\hline\n\t\tEncryption Type & $00_2$ = None \\\\\n\t\t& $01_2$ = Scrambling \\\\\n\t\t& $10_2$ = AES \\\\\n\t\t\\hline\n\t\tEncryption Subtype & Depends on Encryption Type \\\\\n\t\t\\hline\n\t\tChannel Access Number (CAN) & 0..15 \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Voice LSF TYPE Definition}\n\\end{table}\n\nThis application requires Stream Mode.\n\nThe Voice only Data type indicator specifies voice data encoded at 3200 bps using Codec 2.\n\n\\subsection{Encryption Types}\n\nEncryption is \\textbf{optional}. The use of it may be restricted within\nsome radio services and countries, and should only be used if legally\npermissible.\n\n\\paragraph{Null Encryption}\n\nEncryption type = $00_2$\n\nWhen no encryption is used, the 14-byte (112-bit) META field of the LSF and corresponding LICH of the stream can be used for transmitting relatively small amounts of extended data without affecting the bandwidth available for the audio. The full 14 bytes of META extended data is potentially decodable every six stream frames, at a 240 ms update rate. The extended data is transmitted in a simple round robin manner, with the only exception being GPS data which should be transmitted as soon as possible after the GPS data is received from its source.\n\nThe \"Encryption subtype\" bits in the Stream Type field indicate what extended data is stored in the META field.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{ll}\n\t\t\\hline\n\t\tEncryption subtype bits & LSF META data contents \\\\\n\t\t\\hline\n\t\t$00_2$ & Text Data \\\\\n\t\t$01_2$ & GNSS Position Data \\\\\n\t\t$10_2$ & Extended Callsign Data \\\\\n\t\t$11_2$ & Reserved \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Null Encryption Subtype Bits}\n\\end{table}\n\n\\subparagraph{Text Data}\n\nEncryption subtype = $00_2$\n\nThe first byte of the Text Data is a Control Byte. To maintain backward compatibility, a Control Byte of \\texttt{0x00} indicates that no Text Data is included.\n\nUp to four Text Data blocks compose a complete message with a maximum length of 52 bytes. Each block may contain up to 13 bytes of UTF-8 encoded text, and is padded with space characters to fill any unused space at the end of the last used Text Data block.\n\nThe Control Byte is split into two 4-bit fields. The most significant four bits are a bit map of the message length indicating how many Text Data blocks are required for a complete message. There is one bit per used Text Data block, with $0001_2$ used for one block, $0011_2$ for the two, $0111_2$ for three, and $1111_2$ for four.\n\nThe least significant four bits indicate which of the Text Data blocks this text corresponds to. It is $0001_2$ for the first, $0010_2$ for the second, $0100_2$ for the third, and $1000_2$ for the fourth. Any received Control Byte is OR-ed together by the receiving station, and once the most significant and least significant four bits are the same, a complete message has been received.\n\nIt is up to the receiver to decide how to display this message. It may choose to wait for all of the Text Data to be received, or display the parts as they are received. It is not expected that the data in the text field changes during the course of a transmission.\n\nIf there is no data to be transferred, the Control Byte should be set to zero.\n\n\\subparagraph{GNSS Data}\n\nEncryption subtype = $01_2$\n\nUnlike Text and Extended Callsign Data, GNSS data is expected to be dynamic during the course of a transmission and to be transmitted quickly after the GNSS data becomes available. To stop the LSF/LICH data stream from being overrun with GNSS data relative to other data types, a throttle on the amount of GNSS data transmitted is needed. It is recommended that GNSS data be sent at an update rate no faster than once every five seconds.\n\nThe GNSS data fits within one 14-byte META field, which equates to six audio frames, and takes 240ms to transmit. This is a simple format of the GNSS data which does not require too much work to convert into, and provides enough flexibility for most cases. This has been tested on-air and successfully gated to APRS-IS, showing a location very close to the position reported by the GPS receiver.\n\nThe GNSS data includes eight numeric values using from $3$ bits to $24$ bits. The two largest $24$ bit values are signed, two's complement values. The other six are unsigned values. All numeric fields are in order from most significant to least significant bit. There is also one $4$ bit validity field that used to indicate which numeric fields are valid.\n\nGNSS Position Data uses the 112 bit (14 byte) META field as follows:\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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}{5em}|}\n\t\t\\hline\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 &\n\t\t\t\\multicolumn{4}{c}{\\parbox{12em}{\\centering Data Source}} &\n\t\t\t\\multicolumn{4}{c}{\\parbox{14em}{\\centering Station Type}} \\\\\n\t\t\\hline\n\t\t1 &\n\t\t\t\\multicolumn{4}{c}{\\parbox{12em}{\\centering Validity}} &\n\t\t\t\\multicolumn{3}{c}{\\parbox{9em}{\\centering Radius}} &\n\t\t\t\\parbox{5em}{\\centering Bearing\\ldots} \\\\\n\t\t\\hline\n\t\t2 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t3 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{23em}{\\centering Latitude\\ldots}} \\\\\n\t\t\\hline\n\t\t4 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\hline\n\t\t5 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t6 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{23em}{\\centering Longitude\\ldots}} \\\\\n\t\t\\hline\n\t\t7 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\hline\n\t\t8 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t9 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering Altitude\\ldots}} \\\\\n\t\t\\hline\n\t\t10 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t11 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering Speed\\ldots}} \\\\\n\t\t\\hline\n\t\t12 &\n\t\t\t\\multicolumn{4}{c}{\\parbox{12em}{\\centering \\ldots}} &\n\t\t\t\\multicolumn{4}{c}{\\parbox{14em}{\\centering \\textit{Reserved}\\ldots}} \\\\\n\t\t\\hline\n\t\t13 &\n\t\t\t\\multicolumn{8}{c}{\\parbox{26em}{\\centering \\ldots}} \\\\\n\t\t\\Hline[tikz=very thick]\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{GNSS Data Layout}\n\\end{table}\n\nThe first byte contains two $4$ bit numeric fields. The first is the \\textbf{Data Source} where: $0$ is an M17 client, $1$ is OpenRTX and $15$ is \"other\", while values $2..14$ are reserved. The second $4$ bit field is \\textbf{Station Type}, where $0$ is a fixed station, $1$ is a mobile station, $2$ is a handheld and $15$ is \"other\", values $3..14$ are reserved.\n\nThe second byte starts with a $4$ bit \\textbf{Validity} field. Bit $1000_2$ is set if the latitude/longitude is valid. Bit $0100_2$ is set if the \\textbf{Altitude} data is valid. Bit $0010_2$ is set if the velocity data is valid. Velocity data includes both \\textbf{Bearing} and \\textbf{Speed} data. Finally, bit $0001_2$ is set if the \\textbf{Radius} data is valid. If any of these validity bits are set to zero, all the corresponding GNSS data fields should be zeroed-out by the transmitter and regarded as invalid and ignored by the receiver.\n\nThe next three bits of the second byte is the numeric \\textbf{Radius} field. This radius is an estimate of lateral position uncertainty and is based on the horizontal dilution of precision (HDOP) value provided by the GNSS module. HDOP measure is based on the number of received satellites and their geometric position relative to the receiver.\n\\begin{quote}\n\t\\textbf{NOTE} The HDOP value (and therefore radius) is only a coarse estimate and in some cases might not reflect the actual uncertainty metric.\n\\end{quote}\n\nThe last bit of the second byte is the most significant bit of the $9$ bit \\textbf{Bearing} numeric field. This bit is combined with the third byte and contains the bearing value. This is the heading direction for the velocity data in degrees and should never contain a value greater than 359. Zero is due north and 90 is due east, \\textit{etc}.\n\nThe $24$ bit, two's complement \\textbf{Latitude} and \\textbf{Longitude} are encoded into the next six bytes. The encoded values range from $+2^{23}-1$ to $-(2^{23}-1)$. Note that the largest negative two's complement value, $-2^{23}$ is never used.\n\nThe \\textbf{Latitude} is specified in the fourth through sixth bytes. The value is the binary fraction of $90$ degrees, where the value $0$ represents zero degrees latitude, \\textit{i.e.}, the equator, and $\\pm8388607$ ($\\pm2^{23}-1$) represents $\\pm90$ degrees, \\textit{i.e.}, the poles. A positive value is north and negative is south. This results in a resolution of approximately 39 milliseconds of arc ($\\sim$1.2m).\n\nThe $24$ \\textbf{Longitude} follows in the seventh through ninth bytes. The value is the binary fraction of $180$ degrees, where the value $0$ represents zero degrees longitude, \\textit{i.e.}, the prime meridian, and $\\pm8388607$ ($\\pm2^{23}-1$) represents $\\pm180$ degrees. A positive value is east and a negative value is west. This results in a resolution of approximately 77 milliseconds of arc ($\\sim$2.4m at the equator).\n\nA $16$ bit numeric \\textbf{Altitude} field is in the tenth and eleventh bytes and decodes in $0.5$ meter steps, offset by $500$ meters. A value of $0$ is an altitude of $-500.0$ meters, while the largest value of $65535$ is an altitude of $31767.5$ meters.\n\nA $12$ bit \\textbf{Speed} numeric field is in the twelfth byte and the $4$ most significant bits of the thirteen byte. The decoded values range from 0.0 to 2047.5 km/h in 0.5 km/h steps.\n\nFinally, the remaining $4$ bits of the thirteenth byte and the fourteenth byte are reserved and should be set to zero.\n\n\\subparagraph{Extended Callsign Data}\n\nEncryption subtype = $10_2$\n\nThis is only transmitted from repeaters/gateways and not from clients, who only receive and display this data. These fields should not appear over M17 Internet links as they should only be used over the air from a repeater/gateway.\n\nThe META field is split into two callsign fields. The first is always present, and the second is optional. The callsign data is encoded using the standard M17 callsign Address Encoding which takes six bytes to encode a nine character callsign. Any unused space in the META field contains \\texttt{0x00} bytes. The first callsign field starts at offset zero in the META field, and the second callsign if present starts immediately after the first. There are two unused bytes at the end of the META field.\n\nThe use of these two callsign fields is as follows:\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={lll},\n\t\t}\n\t\t\\hline\n\t\tSource & Callsign Field 1 & Callsign Field 2 \\\\\n\t\t\\hline\n\t\tLocally Repeated RF & Originator & Unused \\\\\n\t\tECHO Reply & Originator & Unused \\\\\n\t\tReflector Traffic & Originator & Reflector Name \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Extended Callsign Data Encoding}\n\\end{table}\n\nThe extended callsign data is not used under any other circumstances than the above currently.\n\nIt is not expected that the data in the extra callsign fields change during the course of a transmission.\n\n\\paragraph{Scrambling}\n\nEncryption type = $01_2$\n\nScrambling is an encryption by bit inversion using a bitwise exclusive-or (XOR) operation between the bit sequence of data and a pseudorandom bit sequence.\n\nPseudorandom bit sequence is generated using a Fibonacci-topology Linear-Feedback Shift Register (LFSR). Three different LFSR sizes are available: 8, 16 and 24-bit. Each shift register has an associated polynomial. The polynomials are listed in Table~\\ref{tab:scrambling}. The LFSR is initialized with a seed value of the same length as the shift register. The seed value acts as an encryption key for the scrambler algorithm. See Figures~\\ref{fig:lfsr8}, \\ref{fig:lfsr16}, and \\ref{fig:lfsr24} for block diagrams of the algorithm.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={llXX},\n\t\t}\n\t\t\\hline\n\t\tEncryption subtype & LFSR polynomial & Seed length & Sequence period \\\\\n\t\t\\hline\n\t\t$00_2$ & $x^8 + x^6 + x^5 + x^4 + 1$ & 8 bits & 255 \\\\\n\t\t$01_2$ & $x^{16} + x^{15} + x^{13} + x^4 + 1$ & 16 bits & 65,535 \\\\\n\t\t$10_2$ & $x^{24} + x^{23} + x^{22} + x^{17} + 1$ & 24 bits &\n\t\t16,777,215 \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Scrambling Subtypes}\n\t\\label{tab:scrambling}\n\\end{table}\n\n\\begin{figure}[H]\n\t\\centering\n\t\\scalebox{0.5}{\\includegraphics{img/LFSR_8}}\n\t\\caption{8-bit LFSR Taps}\n\t\\label{fig:lfsr8}\n\\end{figure}\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics{img/LFSR_16}\n\t\\caption{16-bit LFSR Taps}\n\t\\label{fig:lfsr16}\n\\end{figure}\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics{img/LFSR_24}\n\t\\caption{24-bit LFSR Taps}\n\t\\label{fig:lfsr24}\n\\end{figure}\n\n\\paragraph{Advanced Encryption Standard (AES)}\n\nEncryption type = $10_2$\n\nThis method uses AES block cipher in counter mode (AES-CTR), with a 112-bit nonce that should never be used for more than one stream (transmission) and a 16-bit counter.\n\nKey length is defined by the encryption subtype field.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={ll},\n\t\t}\n\t\t\\hline\n\t\tEncryption subtype & Key length \\\\\n\t\t\\hline\n\t\t$00_2$ & 128 bits \\\\\n\t\t$01_2$ & 192 bits \\\\\n\t\t$10_2$ & 256 bits \\\\\n\t\t$11_2$ & reserved \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{AES Key Lengths}\n\\end{table}\n\nThe 112-bit nonce value is stored in the META field. The FN (Frame Number) value is then used to fill out the remaining 16 bits of the counter, totalling to 128 bits, and always starts from 0 (zero) in a new voice stream.\n\n\\begin{quote}\n\t\\textbf{NOTE} The effective capacity of the frame counter is 15 bits, as its most significant bit is used for transmission end signalling. At 25 frames per second and $2^{15}$ frames, the transmission can last up to $2^{15}$ frames / 25 frames per second = 1310 seconds, or almost 22 minutes, without rolling over the counter.\n\\end{quote}\n\nThe random part of the nonce value should be generated with a hardware random number generator or any other cryptographically secure method of generating random values.\nTo prevent replay attacks, a 32-bit timestamp is included in the cryptographic nonce field. The structure of the 128-bit counter is shown in Table~\\ref{tab:aes_counter}. The timestamp represents the number of seconds since 2020-01-01T00:00:00Z (midnight UTC, January 1, 2020).\n\n\\paragraph{128 bit counter structure}\n\nFN field sets the most significant 16 bits of the counter, with the 32-bit least significant part holding the timestamp. The remaining 80-bit portion is filled with random data, re-generated per transmission.\n\n\\begin{table}[h]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={lcl},\n\t\t}\n\t\t\\hline\n\t\tField & Length & Description \\\\\n\t\t\\hline\n\t\tTimestamp & 32 bits & Seconds since 2020-01-01T00:00:00Z \\\\\n\t\tRandom Data & 80 bits & Random data \\\\\n\t\tFrame Number & 16 bits & Incrementing Frame Number \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{AES Counter Contents}\n\t\\label{tab:aes_counter}\n\\end{table}\n\n\\begin{quote}\n\t\\textbf{WARNING} In CTR mode, AES encryption is malleable. That is, an attacker can change the contents of the encrypted message without decrypting it. This means that recipients of AES-encrypted data must not trust that the data is authentic. Users who require that received messages are proven to be exactly as-sent by the sender should use an appropriate digital signature algorithm, as described below.\n\\end{quote}\n\n\\subsection{Channel Access Number}\n\nThe Channel Access Number (CAN) is a four bit code that may be used to filter received audio, text, and GNSS data. A receiver may optionally allow reception from sources only if their transmitted CAN value matches the receiver's own specified CAN value.\n\n\\subsection{Stream Frames}\n\nStream Frames will contain chunked LSF contents (in the LICH field). The Stream Contents will include the incrementing 16-bit Frame Number, and 128 bits of data (unencrypted or encrypted).\n\n\\subsection{Digital Signatures}\nM17 protocol provides a stream authentication method through Elliptic Curve Digital Signature Algorithm (ECDSA). The curve used is $secp256r1$. Signature availability is signalled with a specific bit in the TYPE field. Signature use reduces the maximum length of the stream by 4 frames.\n\n\\subsubsection{Message Digest Algorithm for Voice Streams}\nAt the beginning of the transmission, a $digest$ byte array of size 16 is initialized with zeros. After every stream frame (starting at frame 0) an exclusive or (XOR) operation is performed over the contents of the $digest$ array and the frame's payload. The $digest$ array is then rotated left by 1 byte. The result shall be retained in the array.\n\n\\begin{align*}\n\tdigest :=& digest \\oplus payload \\\\\n\tdigest :=& rol(digest, 8)\n\\end{align*}\n\nThis process is repeated until there is no more data to transmit. In case there is any encryption enabled, the $payload$ input shall be the encrypted stream. This ensures the possibility of verification, even if the encryption details are not known to the receiving parties. Frame Numbers of the frames carrying the signature should follow a succession of $\\{7FFC_{16}, 7FFD_{16}, 7FFE_{16}, FFFF_{16}\\}$.\n\\begin{quote}\n\t\\textbf{NOTE} The Frame Number's most significant bit of the last speech payload stream shall not be set, since it is not the last frame to be transmitted.\n\\end{quote}\n\n\\subsubsection{Signature Generation and Transmission}\nAt the transmitter-side, the stream digest is signed with a 256-bit private key. The resulting 512-bit signature is split into 4 chunks and sent as additional payload at the end of the transmission. To keep the reassembled LSF data consistent, the LICH counter shall advance normally. The most significant bit of the Frame Number (signalling end of transmission) shall be set only in the last frame carrying the signature.\n\n\\subsubsection{Signature Verification}\nAt the receiver-side, the 512-bit signature is retrieved from the last 4 frames' contents, if the appropriate TYPE bit is set. The signature is then checked using a 512-bit public key.\n\\begin{quote}\n\t\\textbf{NOTE} The verification process will work if and only if all the data is received successfully (without transmission errors or dropped frames).\n\\end{quote}\n\n\\section{Packet Mode}\n\n\\subsection{Packet Mode LSF TYPE}\n\nThe TYPE field only defines the stream/packet bit, called ``P/S'' in Table~\\ref{tab:packet_lsf_type} and the Channel Access Number (CAN) bits. All other bits are reserved.\n\n\\begin{table}[H]\n\t\\centering\n\t\\small\n\t\\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}|}\n\t\t\\hline\n\t\t\\diagbox{Byte}{Bit} & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\\\n\t\t\\Hline[tikz=very thick]\n\t\t0 &\n\t\t\t\\multicolumn{5}{c}{\\textit{Reserved}} &\n\t\t\t\\multicolumn{3}{c}{Channel Access Number\\ldots} \\\\\n\t\t\\hline\n\t\t1 &\n\t\t\t\\ldots &\n\t\t\t\\multicolumn{6}{c}{\\textit{Reserved}} &\n\t\t\t\\parbox{3em}{\\centering P/S} \\\\\n\t\t\\hline\n\t\\end{NiceTabular}\n\t\\normalsize\n\t\\caption{Packet LSF TYPE Layout}\n\t\\label{tab:packet_lsf_type}\n\\end{table}\n\n\\subsection{Packet Data}\n\nA single packet of up to 823 bytes of data may be sent in one transmission.\n\nPackets are sent using Packet Mode.\n\nPackets are composed of a 1..n byte data type specifier and up to $823-n$ bytes of payload data. The data type specifier is a variable-length encoding using the same format as UTF-8. The data type specifier must be between $0$ and $2^{21}-1$ which will occupy between 1 and 4 bytes when encoded. Values from 0 to 127 are identical to their encoded form.\n\nThe data type specifier can also be used as a protocol specifier. Table~\\ref{tab:reserved_packet_protocols} lists the reserved protocol identifiers.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{ll}\n\t\t\\hline\n\t\tIdentifier & Protocol \\\\\n\t\t\\hline\n\t\t\\texttt{0x00} & RAW \\\\\n\t\t\\texttt{0x01} & AX.25 \\\\\n\t\t\\texttt{0x02} & APRS \\\\\n\t\t\\texttt{0x03} & 6LoWPAN \\\\\n\t\t\\texttt{0x04} & IPv4 \\\\\n\t\t\\texttt{0x05} & SMS (null-terminated, UTF-8 encoded string) \\\\\n\t\t\\texttt{0x06} & Winlink \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Reserved Packet Protocol Identifiers}\n\t\\label{tab:reserved_packet_protocols}\n\\end{table}\n\nThe data type specifier is used to compute the CRC, along with the payload.\n\n\\appendix\n\n\\chapter{Address Encoding} \\label{address_encoding}\n\n\\section{The M17 alphabet}\n\nM17 uses a 48-bit (6-byte) address to represent the characters that define a source and destination.\nM17 uses a 40-character alphabet. Encoded, up to nine characters can be used to encode a source or destination address that will still fit in a 48-bit address field.\nThese nine characters will usually, but not necessarily be an amateur radio callsign.\n\nIn nearly all circumstances, the source address will decode to an amateur callsign.\nBut frequently, the destination address will not decode to an amateur radio callsign.\nTypically it will be a unit command, like \\texttt{ECHO}, or \\texttt{UNLINK}, or the module of a reflector, like \\texttt{M17-M17 C}.\n\nIn order to define how encoding and decoding are done, here are 40 characters used in M17 ordered by their value:\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{cclcl}\n\t\t\\hline\n\t\tValue & Character & Name & ASCII & Note \\\\\n\t\t\\hline\n\t\t0 & '\\texttt{~}' & Space  & \\texttt{0x20} & Also, any invalid character \\\\\n\t\t1 - 26 & '\\texttt{A}' - '\\texttt{Z}' & Letter & \\texttt{0x41} - \\texttt{0x5A} & Uppercase \\\\\n\t\t27 - 36 & '\\texttt{0}' - '\\texttt{9}' & Digit & \\texttt{0x30} - \\texttt{0x39} & Decimal \\\\\n\t\t37 & '\\texttt{-}' & Hyphen & \\texttt{0x2D} & Dash \\\\\n\t\t38 & '\\texttt{/}' & Slash & \\texttt{0x3F} & Forward slash & \\\\\n\t\t39 & '\\texttt{.}' & Dot & \\texttt{0x3E} & Period \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Callsign Alphabet}\n\\end{table}\n\n\\section{Callsign Encoding}\n\nHere are some facts and rules about the encoding an address from a callsign:\n\n\\begin{itemize}\n\t\\item\n\t\tA callsign is encoded backwards, from the last character to the first character. This means that the first character of the callsign is in the least significant bits of the address, while the last character is encode into the most significant bits of the address.\n\t\\item\n\t\tSince the space character has a value of zero, trailing spaces will not affect the encoded value. For example the calculated address of \\texttt{'ABC'} is the same as \\texttt{'ABC~'}, or \\texttt{'ABC~~~~~~'}. A callsign containing just one or more space characters encodes to an address of zero, and this address is reserved.\n\t\\item\n\t\tIf an uncoded address represents an amateur radio callsign it should be left-justified. That means that the first character will always be a digit or letter.\n\t\\item\n\t\tOver 262 trillion address can be encoded from \\texttt{0x1} (\\texttt{A}) to \\texttt{0xEE6B27FFFFFF} (\\texttt{.........}) and only a fraction of these callsign actually look like an amateur radio callsign. Those encodable base-40 text strings that don't look like an amateur radio callsign can be used by applications for triggering events and features that their programs offer.\n\t\\item\n\t\tUsing this scheme, there are over 19 trillion 48-bit addresses that can't be encoded by nine characters from the above table. Only one of these non-encodable addresses ($2^{48}-1$) has a specified use.\n\t\\item\n\t\tAfter the base-40 value is calculated, the final 6-byte address is the big endian encoded representation of the base-40 value. This is also called network byte order.\n\\end{itemize}\n\nAs an example, the address of \\texttt{AB1CD} would be calculated as:\n\n('\\texttt{A}': $1$) + (`\\texttt{B}': $2 \\times 40$) + ('\\texttt{1}': $28 \\times 40^2$) + ('\\texttt{C}': $3 \\times 40^3$) + ('\\texttt{D}': $4 \\times 40^4$)\n\nor, after refactoring and reordering:\n\n$( ( ( ( 4 ) \\times 40 + 3 ) \\times 40 + 28 ) \\times 40 + 2 ) \\times 40 + 1$\n\nproducing the resulting address:\n\n\\texttt{0x9fdd51} (base-16), \\texttt{10476881} (base-10).\n\n\\section{Encoded Addresses}\n\nBecause $40^{9}$ is less than $2^{48}$, there are some 48-bit addresses that can't be accessed. Here is a map of the address space:\n\n\\begin{table}[H]\n\t\\centering{}\n\t\\begin{tblr}{Q[c,m]Q[c,m]Q[c,m]Q[l,m]}\n\t\t\\hline\n\t\tAddress Range & Category & Number of Addresses & Remarks \\\\\n\t\t\\hline\n\t\t\\texttt{0x000000000000} & Reserved & \\texttt{1} & For future use \\\\\n\t\t\\hline\n\t\t{\\texttt{0x000000000001} \\\\ \\texttt{0xEE6B27FFFFFF}} & Standard & \\textasciitilde{}262 trillion & \"\\texttt{A}\" to \"\\texttt{.........}\" \\\\\n\t\t\\hline\n\t\t{\\texttt{0xEE6B28000000} \\\\ \\texttt{0xFFFFFFFFFFFE}} & Extended & \\textasciitilde{}19 trillion & for application use \\\\\n\t\t\\hline\n\t\t\\texttt{0xFFFFFFFFFFFF} & BROADCAST & \\texttt{1} & valid only for a destination \\\\\n\t\t\\hline[2pt]\n\t\\end{tblr}\n\t\\caption{Address Space}\n\\end{table}\n\nThe BROADCAST address should only be used as a destination address. It means that the M17 stream or packet is intended for any capable M17 receivers.\n\nThe Reserved addresses can be used by applications for their own purposes and encoding/decoding algorithms for these addresses are left to the developer.\n\nFor Standard addresses, the following encoding and decoding examples written in C will not treat the BROADCAST address. This is an implementation detail left to the developers.\n\n\\pagebreak\n\n\\section{Encoder Example}\n\n\\begin{lstlisting}[language=C,numbers=none]\nvoid Encode(const char *callsign, uint8_t *pUChar)\n{\n\tuint64_t address = 0;\t// the calculate address in host byte order\n\n\tif (pUChar && callsign && *callsign) // make sure we can return a non-zero address\n\t{\n\t\tconst char *p = callsign;\n\n\t\t// find the last char, but don't select more than 9 characters\n\t\twhile (*p++ && (p-callsign < 9)) ;\n\n\t\t// process each char from the end to the beginning\n\t\tfor (p--; p>=callsign; p--)\n\t\t{\n\t\t\tunsigned val = 0; // the default value of the character\n\t\t\tif      ('A' <= *p && *p <= 'Z') val = *p - 'A' + 1;\n\t\t\telse if ('0' <= *p && *p <= '9') val = *p - '0' + 27;\n\t\t\telse if ('-' == *p)              val = 37;\n\t\t\telse if ('/' == *p)              val = 38;\n\t\t\telse if ('.' == *p)              val = 39;\n\t\t\telse if ('a' <= *p && *p <= 'z') val = *p - 'a' + 1;\n\n\t\t\taddress = 40u * address + val; // increment and add\n\t\t}\n\t}\n\n\tfor (int i=5; i>=0; i--) // put it in network byte order\n\t{\n\t\tpUChar[i] = address & 0xffu;\n\t\taddress /= 0x100u;\n\t}\n}\n\\end{lstlisting}\n\n\\pagebreak\n\n\\section{Decoder Example}\n\n\\begin{lstlisting}[language=C,numbers=none]\nchar *Decode(const uint8_t* pUChar)\n{\n\tstatic char cs[10];\t  // this is the return value\n\tmemset(cs, NULL, 10); // initialize it to nothing\n\n\tif (NULL == pUChar) // nothing in, nothing out\n\t\treturn cs;\n\n\t// calculate the address in host byte order\n\tuint64_t address = 0;\n\tfor (int i=0; i<6; i++)\n\t\taddress = address * 0x100u + pUChar[i];\n\n\tif (address >= 0xee6b28000000u) // is it in the undecodable range?\n\t\treturn cs; // practical applications will do something here\n\n\t// the M17 alphabet, ordered by value\n\tconst char *m17chars = \" ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-/.\";\n\n\tunsigned i = 0; // index for the current character\n\n\twhile (address)\n\t{\n\t\t// the current character is the address modulus 40\n\t\tcs[i++] = m17chars[address % 40u];\n\t\taddress /= 40u; // keep dividing the address until there's nothing left\n\t}\n\n\treturn cs;\n}\n\\end{lstlisting}\n\nFor an example of how to encode and decode BROADCAST, or how to use part of the Extended address space,\nsee \\href{https://github.com/M17-Project/libm17}{https://github.com/M17-Project/libm17}.\n\n\\chapter{Randomizer Sequence}\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={lXlX},\n\t\t}\n\t\t\\hline\n\t\tSeq. number & Value & Seq. number & Value \\\\\n\t\t\\hline\n\t\t00 & \\texttt{0xD6} & 23 & \\texttt{0x6E} \\\\\n\t\t01 & \\texttt{0xB5} & 24 & \\texttt{0x68} \\\\\n\t\t02 & \\texttt{0xE2} & 25 & \\texttt{0x2F} \\\\\n\t\t03 & \\texttt{0x30} & 26 & \\texttt{0x35} \\\\\n\t\t04 & \\texttt{0x82} & 27 & \\texttt{0xDA} \\\\\n\t\t05 & \\texttt{0xFF} & 28 & \\texttt{0x14} \\\\\n\t\t06 & \\texttt{0x84} & 29 & \\texttt{0xEA} \\\\\n\t\t07 & \\texttt{0x62} & 30 & \\texttt{0xCD} \\\\\n\t\t08 & \\texttt{0xBA} & 31 & \\texttt{0x76} \\\\\n\t\t09 & \\texttt{0x4E} & 32 & \\texttt{0x19} \\\\\n\t\t10 & \\texttt{0x96} & 33 & \\texttt{0x8D} \\\\\n\t\t11 & \\texttt{0x90} & 34 & \\texttt{0xD5} \\\\\n\t\t12 & \\texttt{0xD8} & 35 & \\texttt{0x80} \\\\\n\t\t13 & \\texttt{0x98} & 36 & \\texttt{0xD1} \\\\\n\t\t14 & \\texttt{0xDD} & 37 & \\texttt{0x33} \\\\\n\t\t15 & \\texttt{0x5D} & 38 & \\texttt{0x87} \\\\\n\t\t16 & \\texttt{0x0C} & 39 & \\texttt{0x13} \\\\\n\t\t17 & \\texttt{0xC8} & 40 & \\texttt{0x57} \\\\\n\t\t18 & \\texttt{0x52} & 41 & \\texttt{0x18} \\\\\n\t\t19 & \\texttt{0x43} & 42 & \\texttt{0x2D} \\\\\n\t\t20 & \\texttt{0x91} & 43 & \\texttt{0x29} \\\\\n\t\t21 & \\texttt{0x1D} & 44 & \\texttt{0x78} \\\\\n\t\t22 & \\texttt{0xF8} & 45 & \\texttt{0xC3} \\\\\n\t\t\\hline[2px]\n\t\\end{tblr}\n\t\\caption{Randomizer Values}\n\t\\label{tab:randomizer}\n\\end{table}\n\n\\chapter{Convolutional Encoder} \\label{convolutional_encoder}\n\nThe convolutional code shall encode the input bit sequence after\nappending 4 tail bits at the end of the sequence. Rate of the coder is\nR=½ with constraint length K=5. The encoder diagram and generating\npolynomials are shown below.\n\n\\begin{align*}\n\tG_1(D) =& 1 + D^3 + D^4 \\\\\n\tG_2(D) =& 1+ D + D^2 + D^4\n\\end{align*}\n\nThe output from the encoder must be read alternately.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics{img/convolutional}\n\t\\caption{Convolutional Encoder}\n\t\\label{fig:convolutional}\n\\end{figure}\n\n\\chapter{Golay Encoder}\n\nThe extended Golay(24,12) encoder uses generating polynomial \\emph{g(x)} given below to generate the 11 check bits. The check bits and an additional parity bit are appended to the 12 bit data, resulting in a 24 bit codeword. The resulting code is systematic, meaning that the input data (message) is embedded in the codeword.\n\n$g(x) = x^{11} + x^{10} + x^6 + x^5 + x^4 + x^2 + 1$\n\nThis is equivalent to \\texttt{0xC75} in hexadecimal notation. Both the generating matrix $G$ and parity check matrix $H$ are shown below.\n\n\\begin{align}\n\tG = [I_{12} \\mid P] = \\left[\n\t\\begin{array}{c|c}\n\t\tI_{12}\n\t\t&\n\t\t\\begin{matrix}\n\t\t\t1&1&0&0&0&1&1&1&0&1&0&1 \\\\\n\t\t\t0&1&1&0&0&0&1&1&1&0&1&1 \\\\\n\t\t\t1&1&1&1&0&1&1&0&1&0&0&0 \\\\\n\t\t\t0&1&1&1&1&0&1&1&0&1&0&0 \\\\\n\t\t\t0&0&1&1&1&1&0&1&1&0&1&0 \\\\\n\t\t\t1&1&0&1&1&0&0&1&1&0&0&1 \\\\\n\t\t\t0&1&1&0&1&1&0&0&1&1&0&1 \\\\\n\t\t\t0&0&1&1&0&1&1&0&0&1&1&1 \\\\\n\t\t\t1&1&0&1&1&1&0&0&0&1&1&0 \\\\\n\t\t\t1&0&1&0&1&0&0&1&0&1&1&1 \\\\\n\t\t\t1&0&0&1&0&0&1&1&1&1&1&0 \\\\\n\t\t\t1&0&0&0&1&1&1&0&1&0&1&1\n\t\t\\end{matrix}\n\t\\end{array}\n\t\\right]\n\\end{align}\n\\begin{align}\n\tH = [P^T \\mid I_{12}] = \\left[\n\t\\begin{array}{c|c}\n\t\t\\begin{matrix}\n\t\t\t1&0&1&0&0&1&0&0&1&1&1&1 \\\\\n\t\t\t1&1&1&1&0&1&1&0&1&0&0&0 \\\\\n\t\t\t0&1&1&1&1&0&1&1&0&1&0&0 \\\\\n\t\t\t0&0&1&1&1&1&0&1&1&0&1&0 \\\\\n\t\t\t0&0&0&1&1&1&1&0&1&1&0&1 \\\\\n\t\t\t1&0&1&0&1&0&1&1&1&0&0&1 \\\\\n\t\t\t1&1&1&1&0&0&0&1&0&0&1&1 \\\\\n\t\t\t1&1&0&1&1&1&0&0&0&1&1&0 \\\\\n\t\t\t0&1&1&0&1&1&1&0&0&0&1&1 \\\\\n\t\t\t1&0&0&1&0&0&1&1&1&1&1&0 \\\\\n\t\t\t0&1&0&0&1&0&0&1&1&1&1&1 \\\\\n\t\t\t1&1&0&0&0&1&1&1&0&1&0&1\n\t\t\\end{matrix}\n\t\t&\n\t\tI_{12}\n\t\\end{array}\n\t\\right]\n\\end{align}\n\nThe output of the Golay encoder is shown in Table~\\ref{tab:golay_encoder_output}.\n\n\\begin{table}[H]\n\t\\centering\n\t\\begin{tblr}{\n\t\tcolspec={llll},\n\t\t}\n\t\t\\hline\n\t\tField & Data & Check bits & Parity \\\\\n\t\t\\hline\n\t\tPosition & 23..12 & 11..1 & 0 (LSB) \\\\\n\t\tLength & 12 & 11 & 1 \\\\\n\t\t\\hline\n\t\\end{tblr}\n\t\\caption{Golay Encoder Output}\n\t\\label{tab:golay_encoder_output}\n\\end{table}\n\nFour of these 24-bit blocks are used to reconstruct the LSF.\n\nSample MATLAB code snippet for generating $G$ and $H$ matrices is shown below.\n\n\\begin{lstlisting}[language=Matlab]\n\tP = hex2poly('0xC75');\n\t[H,G] = cyclgen(23, P);\n\n\tG_P = G(1:12, 1:11);\n\tI_K = eye(12);\n\tG = [I_K G_P P.'];\n\tH = [transpose([G_P P.']) I_K];\n\\end{lstlisting}\n\n\\chapter{Code Puncturing} \\label{puncturing}\n\nRemoving some of the bits from the convolutional coder's output is\ncalled code puncturing. The nominal coding rate of the encoder used in\nM17 is ½. This means the encoder outputs two bits for every bit of the\ninput data stream. To get other (higher) coding rates, a puncturing\nscheme has to be used.\n\nTwo different puncturing schemes are used in M17 stream mode:\n\n\\begin{enumerate}\n\t\\def\\labelenumi{\\arabic{enumi}.}\n\t\\item\n\t$P_1$ leaving 46 from 61 encoded bits\n\t\\item\n\t$P_2$ leaving 11 from 12 encoded bits\n\\end{enumerate}\n\nScheme $P_1$ is used for the \\emph{link setup frame}, taking 488 bits of encoded data and selecting 368 bits. The $gcd(368, 488)$ is 8 which, when used to divide, leaves 46 and 61 bits. However, a full puncture pattern requires the puncturing matrix entries count to be divisible by the number of encoding polynomials. For this case a partial puncture matrix is used. It has 61 entries with 46 of them being ones and shall be used 8 times, repeatedly. The construction of the partial puncturing pattern $P_1$ is as follows:\n\n\\begin{align}\n\tM = & \\begin{bmatrix}\n\t\t1 & 0 & 1 & 1\n\t\\end{bmatrix} \\\\\n\tP_{1} = & \\begin{bmatrix}\n\t\t1 & M_{1} & \\cdots & M_{15}\n\t\\end{bmatrix}\n\\end{align}\n\nIn which $M$ is a standard 2/3 rate puncture matrix and is used 15 times, along with a leading $1$ to form $P_1$, an array of length 61.\n\nThe first pass of the partial puncturer discards $G_1$ bits only, second pass discards $G_2$, third - $G_1$ again, and so on. This ensures that both bits are punctured out evenly.\n\nScheme $P_2$ is for frames (excluding LICH chunks, which are coded differently). This takes 296 encoded bits and selects 272 of them. Every 12th bit is being punctured out, leaving 272 bits. The full matrix shall have 12 entries with 11 being ones.\n\nThe puncturing scheme $P_2$ is defined by its partial puncturing matrix:\n\n\\begin{align}\n\tP_2 = & \\begin{bmatrix}\n\t\t1 & 1 & 1 & 1 & 1 & 1 \\\\\n\t\t1 & 1 & 1 & 1 & 1 & 0\n\t\\end{bmatrix}\n\\end{align}\n\nThe linearized representations are:\n\n\\begin{verbatim}\n\tP1 = [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,\n\t      1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1,\n\t      0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1]\n\n\tP2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]\n\\end{verbatim}\n\nOne additional puncturing scheme $P_3$ is used in the Packet Mode. The puncturing scheme is defined by its puncturing matrix:\n\n\\begin{align}\n\tP_3 = & \\begin{bmatrix}\n\t\t1 & 1 & 1 & 1 \\\\\n\t\t1 & 1 & 1 & 0\n\t\\end{bmatrix}\n\\end{align}\n\nThe linearized representation is:\n\n\\begin{verbatim}\n\tP3 = [1, 1, 1, 1, 1, 1, 1, 0]\n\\end{verbatim}\n\n\\chapter{Interleaving} \\label{interleaving}\n\nFor interleaving a Quadratic Permutation Polynomial (QPP) is used. The polynomial\n\n$\\pi(x)=(45x+92x^2)\\mod 368$\n\nis used for a 368 bit interleaving pattern QPP.\n\n\\begin{longtable}[]{@{}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1196}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1304}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1196}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1304}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1196}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1304}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1196}}\n\t\t>{\\raggedleft\\arraybackslash}p{(\\columnwidth - 14\\tabcolsep) * \\real{0.1304}}@{}}\n\t\\toprule\n\t\\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\tinput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\toutput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\tinput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\toutput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\tinput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\toutput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\tinput index\n\t\\end{minipage} & \\begin{minipage}[b]{\\linewidth}\\raggedleft\n\t\toutput index\n\t\\end{minipage} \\\\\n\t\\midrule\n\t\\endhead\n\t0 & 0 & 92 & 92 & 184 & 184 & 276 & 276 \\\\\n\t1 & 137 & 93 & 229 & 185 & 321 & 277 & 45 \\\\\n\t2 & 90 & 94 & 182 & 186 & 274 & 278 & 366 \\\\\n\t3 & 227 & 95 & 319 & 187 & 43 & 279 & 135 \\\\\n\t4 & 180 & 96 & 272 & 188 & 364 & 280 & 88 \\\\\n\t5 & 317 & 97 & 41 & 189 & 133 & 281 & 225 \\\\\n\t6 & 270 & 98 & 362 & 190 & 86 & 282 & 178 \\\\\n\t7 & 39 & 99 & 131 & 191 & 223 & 283 & 315 \\\\\n\t8 & 360 & 100 & 84 & 192 & 176 & 284 & 268 \\\\\n\t9 & 129 & 101 & 221 & 193 & 313 & 285 & 37 \\\\\n\t10 & 82 & 102 & 174 & 194 & 266 & 286 & 358 \\\\\n\t11 & 219 & 103 & 311 & 195 & 35 & 287 & 127 \\\\\n\t12 & 172 & 104 & 264 & 196 & 356 & 288 & 80 \\\\\n\t13 & 309 & 105 & 33 & 197 & 125 & 289 & 217 \\\\\n\t14 & 262 & 106 & 354 & 198 & 78 & 290 & 170 \\\\\n\t15 & 31 & 107 & 123 & 199 & 215 & 291 & 307 \\\\\n\t16 & 352 & 108 & 76 & 200 & 168 & 292 & 260 \\\\\n\t17 & 121 & 109 & 213 & 201 & 305 & 293 & 29 \\\\\n\t18 & 74 & 110 & 166 & 202 & 258 & 294 & 350 \\\\\n\t19 & 211 & 111 & 303 & 203 & 27 & 295 & 119 \\\\\n\t20 & 164 & 112 & 256 & 204 & 348 & 296 & 72 \\\\\n\t21 & 301 & 113 & 25 & 205 & 117 & 297 & 209 \\\\\n\t22 & 254 & 114 & 346 & 206 & 70 & 298 & 162 \\\\\n\t23 & 23 & 115 & 115 & 207 & 207 & 299 & 299 \\\\\n\t24 & 344 & 116 & 68 & 208 & 160 & 300 & 252 \\\\\n\t25 & 113 & 117 & 205 & 209 & 297 & 301 & 21 \\\\\n\t26 & 66 & 118 & 158 & 210 & 250 & 302 & 342 \\\\\n\t27 & 203 & 119 & 295 & 211 & 19 & 303 & 111 \\\\\n\t28 & 156 & 120 & 248 & 212 & 340 & 304 & 64 \\\\\n\t29 & 293 & 121 & 17 & 213 & 109 & 305 & 201 \\\\\n\t30 & 246 & 122 & 338 & 214 & 62 & 306 & 154 \\\\\n\t31 & 15 & 123 & 107 & 215 & 199 & 307 & 291 \\\\\n\t32 & 336 & 124 & 60 & 216 & 152 & 308 & 244 \\\\\n\t33 & 105 & 125 & 197 & 217 & 289 & 309 & 13 \\\\\n\t34 & 58 & 126 & 150 & 218 & 242 & 310 & 334 \\\\\n\t35 & 195 & 127 & 287 & 219 & 11 & 311 & 103 \\\\\n\t36 & 148 & 128 & 240 & 220 & 332 & 312 & 56 \\\\\n\t37 & 285 & 129 & 9 & 221 & 101 & 313 & 193 \\\\\n\t38 & 238 & 130 & 330 & 222 & 54 & 314 & 146 \\\\\n\t39 & 7 & 131 & 99 & 223 & 191 & 315 & 283 \\\\\n\t40 & 328 & 132 & 52 & 224 & 144 & 316 & 236 \\\\\n\t41 & 97 & 133 & 189 & 225 & 281 & 317 & 5 \\\\\n\t42 & 50 & 134 & 142 & 226 & 234 & 318 & 326 \\\\\n\t43 & 187 & 135 & 279 & 227 & 3 & 319 & 95 \\\\\n\t44 & 140 & 136 & 232 & 228 & 324 & 320 & 48 \\\\\n\t45 & 277 & 137 & 1 & 229 & 93 & 321 & 185 \\\\\n\t46 & 230 & 138 & 322 & 230 & 46 & 322 & 138 \\\\\n\t47 & 367 & 139 & 91 & 231 & 183 & 323 & 275 \\\\\n\t48 & 320 & 140 & 44 & 232 & 136 & 324 & 228 \\\\\n\t49 & 89 & 141 & 181 & 233 & 273 & 325 & 365 \\\\\n\t50 & 42 & 142 & 134 & 234 & 226 & 326 & 318 \\\\\n\t51 & 179 & 143 & 271 & 235 & 363 & 327 & 87 \\\\\n\t52 & 132 & 144 & 224 & 236 & 316 & 328 & 40 \\\\\n\t53 & 269 & 145 & 361 & 237 & 85 & 329 & 177 \\\\\n\t54 & 222 & 146 & 314 & 238 & 38 & 330 & 130 \\\\\n\t55 & 359 & 147 & 83 & 239 & 175 & 331 & 267 \\\\\n\t56 & 312 & 148 & 36 & 240 & 128 & 332 & 220 \\\\\n\t57 & 81 & 149 & 173 & 241 & 265 & 333 & 357 \\\\\n\t58 & 34 & 150 & 126 & 242 & 218 & 334 & 310 \\\\\n\t59 & 171 & 151 & 263 & 243 & 355 & 335 & 79 \\\\\n\t60 & 124 & 152 & 216 & 244 & 308 & 336 & 32 \\\\\n\t61 & 261 & 153 & 353 & 245 & 77 & 337 & 169 \\\\\n\t62 & 214 & 154 & 306 & 246 & 30 & 338 & 122 \\\\\n\t63 & 351 & 155 & 75 & 247 & 167 & 339 & 259 \\\\\n\t64 & 304 & 156 & 28 & 248 & 120 & 340 & 212 \\\\\n\t65 & 73 & 157 & 165 & 249 & 257 & 341 & 349 \\\\\n\t66 & 26 & 158 & 118 & 250 & 210 & 342 & 302 \\\\\n\t67 & 163 & 159 & 255 & 251 & 347 & 343 & 71 \\\\\n\t68 & 116 & 160 & 208 & 252 & 300 & 344 & 24 \\\\\n\t69 & 253 & 161 & 345 & 253 & 69 & 345 & 161 \\\\\n\t70 & 206 & 162 & 298 & 254 & 22 & 346 & 114 \\\\\n\t71 & 343 & 163 & 67 & 255 & 159 & 347 & 251 \\\\\n\t72 & 296 & 164 & 20 & 256 & 112 & 348 & 204 \\\\\n\t73 & 65 & 165 & 157 & 257 & 249 & 349 & 341 \\\\\n\t74 & 18 & 166 & 110 & 258 & 202 & 350 & 294 \\\\\n\t75 & 155 & 167 & 247 & 259 & 339 & 351 & 63 \\\\\n\t76 & 108 & 168 & 200 & 260 & 292 & 352 & 16 \\\\\n\t77 & 245 & 169 & 337 & 261 & 61 & 353 & 153 \\\\\n\t78 & 198 & 170 & 290 & 262 & 14 & 354 & 106 \\\\\n\t79 & 335 & 171 & 59 & 263 & 151 & 355 & 243 \\\\\n\t80 & 288 & 172 & 12 & 264 & 104 & 356 & 196 \\\\\n\t81 & 57 & 173 & 149 & 265 & 241 & 357 & 333 \\\\\n\t82 & 10 & 174 & 102 & 266 & 194 & 358 & 286 \\\\\n\t83 & 147 & 175 & 239 & 267 & 331 & 359 & 55 \\\\\n\t84 & 100 & 176 & 192 & 268 & 284 & 360 & 8 \\\\\n\t85 & 237 & 177 & 329 & 269 & 53 & 361 & 145 \\\\\n\t86 & 190 & 178 & 282 & 270 & 6 & 362 & 98 \\\\\n\t87 & 327 & 179 & 51 & 271 & 143 & 363 & 235 \\\\\n\t88 & 280 & 180 & 4 & 272 & 96 & 364 & 188 \\\\\n\t89 & 49 & 181 & 141 & 273 & 233 & 365 & 325 \\\\\n\t90 & 2 & 182 & 94 & 274 & 186 & 366 & 278 \\\\\n\t91 & 139 & 183 & 231 & 275 & 323 & 367 & 47 \\\\\n\t\\bottomrule\n\\end{longtable}\n\n\\section{References}\n\n\\begin{itemize}\n\t\\item\n\t\\href{https://arxiv.org/abs/1103.3794}{Trifina Lucian, Tarniceriu \tDaniela, Munteanu Valeriu. ``Improved QPP Interleavers for LTE \tStandard.'' ISSCS 2011 - International Symposium on Signals, Circuits \tand Systems (2011)}\n\\end{itemize}\n\n\\chapter{BERT Details} \\label{bert_details}\n\n\\section{PRBS Generation}\n\nThe PRBS uses the ITU standard PRBS9 polynomial: $x^{9}+x^{5}+1$\n\nThis is the traditional form for a linear feedback shift register (LFSR)\nused to generate a pseudorandom binary sequence.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics[width=0.7\\linewidth]{img/m17-traditional-lfsr}\n\t\\caption{Traditional LFSR}\n\t\\label{fig:m17-traditional-lfsr}\n\\end{figure}\n\nHowever, the M17 LFSR is a slightly different. The M17 PRBS9 uses the generated bit as the output bit rather than the high-bit before the shift.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics[width=0.7\\linewidth]{img/m17-prbs9}\n\t\\caption{M17 LFSR}\n\t\\label{fig:m17-prbs9}\n\\end{figure}\n\nThis will result in the same sequence, just shifted by nine bits.\n\n${M17\\_PRBS}_{n} = {PRBS9}_{n + 8}$\n\nThe reason for this is that it allows for easier synchronization. This is equivalent to a multiplicative scrambler (a self-synchronizing scrambler) fed with a stream of 0s.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics[width=0.7\\linewidth]{img/m17-equivalent-scrambler}\n\t\\caption{M17 PRBS9 Generator}\n\t\\label{fig:m17-equivalent-scrambler}\n\\end{figure}\n\n\\begin{lstlisting}[language=C]\n\tclass PRBS9 {\n\t\tstatic constexpr uint16_t MASK = 0x1FF;\n\t\tstatic constexpr uint8_t TAP_1 = 8;       // Bit 9\n\t\tstatic constexpr uint8_t TAP_2 = 4;       // Bit 5\n\n\t\tuint16_t state = 1;\n\n\t\tpublic:\n\t\tbool generate()\n\t\t{\n\t\t\tbool result = ((state >> TAP_1) ^ (state >> TAP_2)) & 1;\n\t\t\tstate = ((state << 1) | result) & MASK;\n\t\t\treturn result;\n\t\t}\n\t\t...\n\t};\n\\end{lstlisting}\n\nThe PRBS9 SHOULD be initialized with a state of 1.\n\n\\section{PRBS Receiver}\n\nThe receiver detects the frame is a BERT Frame based on the Sync Burst received. If the PRBS9 generator is reset at this point, the sender and receiver should be synchronized at the start. This, however, is not common nor is it required. PRBS generators can be self-synchronizing.\n\n\\subsection{Synchronization}\n\nThe receiver will synchronize the PRBS by first XORing the received bit with the LFSR taps. If the result of the XOR is a 1, it is an error (the expected feedback bit and the input do not match) and the sync count is reset. The received bit is then also shifted into the LFSR state register. Once a sequence of eighteen (18) consecutive good bits are recovered (twice the length of the LFSR), the stream is considered synchronized.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics[width=0.7\\linewidth]{img/m17-prbs9-sync}\n\t\\caption{M17 PRBS9 Synchronization}\n\t\\label{fig:m17-prbs9-sync}\n\\end{figure}\n\nDuring synchronization, bits received and bit errors are not counted\ntowards the overall bit error rate.\n\n\\begin{lstlisting}[language=C,float=!htb]\n\tclass PRBS9 {\n\t\t...\n\t\tstatic constexpr uint8_t LOCK_COUNT = 18;   // 18 consecutive good bits.\n\t\t...\n\t\t// PRBS Synchronizer. Returns 0 if the bit matches the PRBS, otherwise 1.\n\t\t// When synchronizing the LFSR used in the PRBS, a single bad input bit\n\t\t// will result in 3 error bits being emitted, one for each tap in the LFSR.\n\t\tbool synchronize(bool bit)\n\t\t{\n\t\t\tbool result = (bit ^ (state >> TAP_1) ^ (state >> TAP_2)) & 1;\n\t\t\tstate = ((state << 1) | bit) & MASK;\n\t\t\tif (result) {\n\t\t\t\tsync_count = 0; // error\n\t\t\t} else {\n\t\t\t\tif (++sync_count == LOCK_COUNT) {\n\t\t\t\t\tsynced = true;\n\t\t\t\t\t...\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\t...\n\t};\n\\end{lstlisting}\n\n\\subsection{Counting Bit Errors}\n\nAfter synchronization, BERT mode switches to error-counting mode, where the received bits are compared to a free-running PRBS9 generator. Each bit that does not match the output of the free-running LFSR is counted as a bit error.\n\n\\begin{figure}[H]\n\t\\centering\n\t\\includegraphics[width=0.7\\linewidth]{img/m17-prbs9-validation}\n\t\\caption{M17 PRBS9 Validation}\n\t\\label{fig:m17-prbs9-validation}\n\\end{figure}\n\n\\begin{lstlisting}[language=C]\n\tclass PRBS9 {\n\t\t...\n\t\t// PRBS validator.  Returns 0 if the bit matches the PRBS, otherwise 1.\n\t\t// The results are only valid when sync() returns true;\n\t\tbool validate(bool bit)\n\t\t{\n\t\t\tbool result;\n\t\t\tif (!synced) {\n\t\t\t\tresult = synchronize(bit);\n\t\t\t} else {\n\t\t\t\t// PRBS is now free-running.\n\t\t\t\tresult = bit ^ generate();\n\t\t\t\tcount_errors(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\t...\n\t};\n\\end{lstlisting}\n\n\\subsection{Resynchronization}\n\nThe receiver must keep track of the number of bit errors over a period of 128 bits. If more than 18 bit errors occur, the synchronization process starts anew. This is necessary in the case of missed frames or other serious synchronization issues.\n\nBits received and errors which occur during resynchronization are not counted towards the bit error rate.\n\n\\section{References}\n\n\\begin{itemize}\n\t\\item\n\t\\href{http://www.itu.int/rec/T-REC-O.150-199210-S}{ITU O.150 : Digital \ttest patterns for performance measurements on digital transmission \tequipment}\n\t\\item\n\t\\href{http://www.pldworld.com/_hdl/5/-thorsten-gaertner.de/vhdl/PRBS.pdf}{PRBS\n\t(according ITU-T O.150) and Bit-Sequence Tester : VHDL-Modules}\n\\end{itemize}\n\n\\chapter{GNU Free Documentation License}\n\\phantomsection  % so hyperref creates bookmarks\n%\\addcontentsline{toc}{chapter}{GNU Free Documentation License}\n%\\label{label_fdl}\n\n\\begin{center}\n\n\tVersion 1.3, 3 November 2008\n\n\n\tCopyright \\copyright{} 2000, 2001, 2002, 2007, 2008  Free Software Foundation, Inc.\n\n\t\\bigskip\n\n\t\\texttt{<https://fsf.org/>}\n\n\t\\bigskip\n\n\tEveryone is permitted to copy and distribute verbatim copies\n\tof this license document, but changing it is not allowed.\n\\end{center}\n\n\n\\begin{center}\n\t{\\bf\\large Preamble}\n\\end{center}\n\nThe purpose of this License is to make a manual, textbook, or other\nfunctional and useful document ``free'' in the sense of freedom: to\nassure everyone the effective freedom to copy and redistribute it,\nwith or without modifying it, either commercially or noncommercially.\nSecondarily, this License preserves for the author and publisher a way\nto get credit for their work, while not being considered responsible\nfor modifications made by others.\n\nThis License is a kind of ``copyleft'', which means that derivative\nworks of the document must themselves be free in the same sense.  It\ncomplements the GNU General Public License, which is a copyleft\nlicense designed for free software.\n\nWe have designed this License in order to use it for manuals for free\nsoftware, because free software needs free documentation: a free\nprogram should come with manuals providing the same freedoms that the\nsoftware does.  But this License is not limited to software manuals;\nit can be used for any textual work, regardless of subject matter or\nwhether it is published as a printed book.  We recommend this License\nprincipally for works whose purpose is instruction or reference.\n\n\n\\begin{center}\n\t{\\Large\\bf 1. APPLICABILITY AND DEFINITIONS\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{1. APPLICABILITY AND DEFINITIONS}\n\\end{center}\n\nThis License applies to any manual or other work, in any medium, that\ncontains a notice placed by the copyright holder saying it can be\ndistributed under the terms of this License.  Such a notice grants a\nworld-wide, royalty-free license, unlimited in duration, to use that\nwork under the conditions stated herein.  The ``\\textbf{Document}'', below,\nrefers to any such manual or work.  Any member of the public is a\nlicensee, and is addressed as ``\\textbf{you}''.  You accept the license if you\ncopy, modify or distribute the work in a way requiring permission\nunder copyright law.\n\nA ``\\textbf{Modified Version}'' of the Document means any work containing the\nDocument or a portion of it, either copied verbatim, or with\nmodifications and/or translated into another language.\n\nA ``\\textbf{Secondary Section}'' is a named appendix or a front-matter section of\nthe Document that deals exclusively with the relationship of the\npublishers or authors of the Document to the Document's overall subject\n(or to related matters) and contains nothing that could fall directly\nwithin that overall subject.  (Thus, if the Document is in part a\ntextbook of mathematics, a Secondary Section may not explain any\nmathematics.)  The relationship could be a matter of historical\nconnection with the subject or with related matters, or of legal,\ncommercial, philosophical, ethical or political position regarding\nthem.\n\nThe ``\\textbf{Invariant Sections}'' are certain Secondary Sections whose titles\nare designated, as being those of Invariant Sections, in the notice\nthat says that the Document is released under this License.  If a\nsection does not fit the above definition of Secondary then it is not\nallowed to be designated as Invariant.  The Document may contain zero\nInvariant Sections.  If the Document does not identify any Invariant\nSections then there are none.\n\nThe ``\\textbf{Cover Texts}'' are certain short passages of text that are listed,\nas Front-Cover Texts or Back-Cover Texts, in the notice that says that\nthe Document is released under this License.  A Front-Cover Text may\nbe at most 5 words, and a Back-Cover Text may be at most 25 words.\n\nA ``\\textbf{Transparent}'' copy of the Document means a machine-readable copy,\nrepresented in a format whose specification is available to the\ngeneral public, that is suitable for revising the document\nstraightforwardly with generic text editors or (for images composed of\npixels) generic paint programs or (for drawings) some widely available\ndrawing editor, and that is suitable for input to text formatters or\nfor automatic translation to a variety of formats suitable for input\nto text formatters.  A copy made in an otherwise Transparent file\nformat whose markup, or absence of markup, has been arranged to thwart\nor discourage subsequent modification by readers is not Transparent.\nAn image format is not Transparent if used for any substantial amount\nof text.  A copy that is not ``Transparent'' is called ``\\textbf{Opaque}''.\n\nExamples of suitable formats for Transparent copies include plain\nASCII without markup, Texinfo input format, LaTeX input format, SGML\nor XML using a publicly available DTD, and standard-conforming simple\nHTML, PostScript or PDF designed for human modification.  Examples of\ntransparent image formats include PNG, XCF and JPG.  Opaque formats\ninclude proprietary formats that can be read and edited only by\nproprietary word processors, SGML or XML for which the DTD and/or\nprocessing tools are not generally available, and the\nmachine-generated HTML, PostScript or PDF produced by some word\nprocessors for output purposes only.\n\nThe ``\\textbf{Title Page}'' means, for a printed book, the title page itself,\nplus such following pages as are needed to hold, legibly, the material\nthis License requires to appear in the title page.  For works in\nformats which do not have any title page as such, ``Title Page'' means\nthe text near the most prominent appearance of the work's title,\npreceding the beginning of the body of the text.\n\nThe ``\\textbf{publisher}'' means any person or entity that distributes\ncopies of the Document to the public.\n\nA section ``\\textbf{Entitled XYZ}'' means a named subunit of the Document whose\ntitle either is precisely XYZ or contains XYZ in parentheses following\ntext that translates XYZ in another language.  (Here XYZ stands for a\nspecific section name mentioned below, such as ``\\textbf{Acknowledgements}'',\n``\\textbf{Dedications}'', ``\\textbf{Endorsements}'', or ``\\textbf{History}''.)\nTo ``\\textbf{Preserve the Title}''\nof such a section when you modify the Document means that it remains a\nsection ``Entitled XYZ'' according to this definition.\n\nThe Document may include Warranty Disclaimers next to the notice which\nstates that this License applies to the Document.  These Warranty\nDisclaimers are considered to be included by reference in this\nLicense, but only as regards disclaiming warranties: any other\nimplication that these Warranty Disclaimers may have is void and has\nno effect on the meaning of this License.\n\n\n\\begin{center}\n\t{\\Large\\bf 2. VERBATIM COPYING\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{2. VERBATIM COPYING}\n\\end{center}\n\nYou may copy and distribute the Document in any medium, either\ncommercially or noncommercially, provided that this License, the\ncopyright notices, and the license notice saying this License applies\nto the Document are reproduced in all copies, and that you add no other\nconditions whatsoever to those of this License.  You may not use\ntechnical measures to obstruct or control the reading or further\ncopying of the copies you make or distribute.  However, you may accept\ncompensation in exchange for copies.  If you distribute a large enough\nnumber of copies you must also follow the conditions in section~3.\n\nYou may also lend copies, under the same conditions stated above, and\nyou may publicly display copies.\n\n\n\\begin{center}\n\t{\\Large\\bf 3. COPYING IN QUANTITY\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{3. COPYING IN QUANTITY}\n\\end{center}\n\n\nIf you publish printed copies (or copies in media that commonly have\nprinted covers) of the Document, numbering more than 100, and the\nDocument's license notice requires Cover Texts, you must enclose the\ncopies in covers that carry, clearly and legibly, all these Cover\nTexts: Front-Cover Texts on the front cover, and Back-Cover Texts on\nthe back cover.  Both covers must also clearly and legibly identify\nyou as the publisher of these copies.  The front cover must present\nthe full title with all words of the title equally prominent and\nvisible.  You may add other material on the covers in addition.\nCopying with changes limited to the covers, as long as they preserve\nthe title of the Document and satisfy these conditions, can be treated\nas verbatim copying in other respects.\n\nIf the required texts for either cover are too voluminous to fit\nlegibly, you should put the first ones listed (as many as fit\nreasonably) on the actual cover, and continue the rest onto adjacent\npages.\n\nIf you publish or distribute Opaque copies of the Document numbering\nmore than 100, you must either include a machine-readable Transparent\ncopy along with each Opaque copy, or state in or with each Opaque copy\na computer-network location from which the general network-using\npublic has access to download using public-standard network protocols\na complete Transparent copy of the Document, free of added material.\nIf you use the latter option, you must take reasonably prudent steps,\nwhen you begin distribution of Opaque copies in quantity, to ensure\nthat this Transparent copy will remain thus accessible at the stated\nlocation until at least one year after the last time you distribute an\nOpaque copy (directly or through your agents or retailers) of that\nedition to the public.\n\nIt is requested, but not required, that you contact the authors of the\nDocument well before redistributing any large number of copies, to give\nthem a chance to provide you with an updated version of the Document.\n\n\n\\begin{center}\n\t{\\Large\\bf 4. MODIFICATIONS\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{4. MODIFICATIONS}\n\\end{center}\n\nYou may copy and distribute a Modified Version of the Document under\nthe conditions of sections 2 and 3 above, provided that you release\nthe Modified Version under precisely this License, with the Modified\nVersion filling the role of the Document, thus licensing distribution\nand modification of the Modified Version to whoever possesses a copy\nof it.  In addition, you must do these things in the Modified Version:\n\n\\begin{itemize}\n\t\\item[A.]\n\tUse in the Title Page (and on the covers, if any) a title distinct\n\tfrom that of the Document, and from those of previous versions\n\t(which should, if there were any, be listed in the History section\n\tof the Document).  You may use the same title as a previous version\n\tif the original publisher of that version gives permission.\n\n\t\\item[B.]\n\tList on the Title Page, as authors, one or more persons or entities\n\tresponsible for authorship of the modifications in the Modified\n\tVersion, together with at least five of the principal authors of the\n\tDocument (all of its principal authors, if it has fewer than five),\n\tunless they release you from this requirement.\n\n\t\\item[C.]\n\tState on the Title page the name of the publisher of the\n\tModified Version, as the publisher.\n\n\t\\item[D.]\n\tPreserve all the copyright notices of the Document.\n\n\t\\item[E.]\n\tAdd an appropriate copyright notice for your modifications\n\tadjacent to the other copyright notices.\n\n\t\\item[F.]\n\tInclude, immediately after the copyright notices, a license notice\n\tgiving the public permission to use the Modified Version under the\n\tterms of this License, in the form shown in the Addendum below.\n\n\t\\item[G.]\n\tPreserve in that license notice the full lists of Invariant Sections\n\tand required Cover Texts given in the Document's license notice.\n\n\t\\item[H.]\n\tInclude an unaltered copy of this License.\n\n\t\\item[I.]\n\tPreserve the section Entitled ``History'', Preserve its Title, and add\n\tto it an item stating at least the title, year, new authors, and\n\tpublisher of the Modified Version as given on the Title Page.  If\n\tthere is no section Entitled ``History'' in the Document, create one\n\tstating the title, year, authors, and publisher of the Document as\n\tgiven on its Title Page, then add an item describing the Modified\n\tVersion as stated in the previous sentence.\n\n\t\\item[J.]\n\tPreserve the network location, if any, given in the Document for\n\tpublic access to a Transparent copy of the Document, and likewise\n\tthe network locations given in the Document for previous versions\n\tit was based on.  These may be placed in the ``History'' section.\n\tYou may omit a network location for a work that was published at\n\tleast four years before the Document itself, or if the original\n\tpublisher of the version it refers to gives permission.\n\n\t\\item[K.]\n\tFor any section Entitled ``Acknowledgements'' or ``Dedications'',\n\tPreserve the Title of the section, and preserve in the section all\n\tthe substance and tone of each of the contributor acknowledgements\n\tand/or dedications given therein.\n\n\t\\item[L.]\n\tPreserve all the Invariant Sections of the Document,\n\tunaltered in their text and in their titles.  Section numbers\n\tor the equivalent are not considered part of the section titles.\n\n\t\\item[M.]\n\tDelete any section Entitled ``Endorsements''.  Such a section\n\tmay not be included in the Modified Version.\n\n\t\\item[N.]\n\tDo not retitle any existing section to be Entitled ``Endorsements''\n\tor to conflict in title with any Invariant Section.\n\n\t\\item[O.]\n\tPreserve any Warranty Disclaimers.\n\\end{itemize}\n\nIf the Modified Version includes new front-matter sections or\nappendices that qualify as Secondary Sections and contain no material\ncopied from the Document, you may at your option designate some or all\nof these sections as invariant.  To do this, add their titles to the\nlist of Invariant Sections in the Modified Version's license notice.\nThese titles must be distinct from any other section titles.\n\nYou may add a section Entitled ``Endorsements'', provided it contains\nnothing but endorsements of your Modified Version by various\nparties---for example, statements of peer review or that the text has\nbeen approved by an organization as the authoritative definition of a\nstandard.\n\nYou may add a passage of up to five words as a Front-Cover Text, and a\npassage of up to 25 words as a Back-Cover Text, to the end of the list\nof Cover Texts in the Modified Version.  Only one passage of\nFront-Cover Text and one of Back-Cover Text may be added by (or\nthrough arrangements made by) any one entity.  If the Document already\nincludes a cover text for the same cover, previously added by you or\nby arrangement made by the same entity you are acting on behalf of,\nyou may not add another; but you may replace the old one, on explicit\npermission from the previous publisher that added the old one.\n\nThe author(s) and publisher(s) of the Document do not by this License\ngive permission to use their names for publicity for or to assert or\nimply endorsement of any Modified Version.\n\n\n\\begin{center}\n\t{\\Large\\bf 5. COMBINING DOCUMENTS\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{5. COMBINING DOCUMENTS}\n\\end{center}\n\n\nYou may combine the Document with other documents released under this\nLicense, under the terms defined in section~4 above for modified\nversions, provided that you include in the combination all of the\nInvariant Sections of all of the original documents, unmodified, and\nlist them all as Invariant Sections of your combined work in its\nlicense notice, and that you preserve all their Warranty Disclaimers.\n\nThe combined work need only contain one copy of this License, and\nmultiple identical Invariant Sections may be replaced with a single\ncopy.  If there are multiple Invariant Sections with the same name but\ndifferent contents, make the title of each such section unique by\nadding at the end of it, in parentheses, the name of the original\nauthor or publisher of that section if known, or else a unique number.\nMake the same adjustment to the section titles in the list of\nInvariant Sections in the license notice of the combined work.\n\nIn the combination, you must combine any sections Entitled ``History''\nin the various original documents, forming one section Entitled\n``History''; likewise combine any sections Entitled ``Acknowledgements'',\nand any sections Entitled ``Dedications''.  You must delete all sections\nEntitled ``Endorsements''.\n\n\\begin{center}\n\t{\\Large\\bf 6. COLLECTIONS OF DOCUMENTS\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{6. COLLECTIONS OF DOCUMENTS}\n\\end{center}\n\nYou may make a collection consisting of the Document and other documents\nreleased under this License, and replace the individual copies of this\nLicense in the various documents with a single copy that is included in\nthe collection, provided that you follow the rules of this License for\nverbatim copying of each of the documents in all other respects.\n\nYou may extract a single document from such a collection, and distribute\nit individually under this License, provided you insert a copy of this\nLicense into the extracted document, and follow this License in all\nother respects regarding verbatim copying of that document.\n\n\n\\begin{center}\n\t{\\Large\\bf 7. AGGREGATION WITH INDEPENDENT WORKS\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{7. AGGREGATION WITH INDEPENDENT WORKS}\n\\end{center}\n\n\nA compilation of the Document or its derivatives with other separate\nand independent documents or works, in or on a volume of a storage or\ndistribution medium, is called an ``aggregate'' if the copyright\nresulting from the compilation is not used to limit the legal rights\nof the compilation's users beyond what the individual works permit.\nWhen the Document is included in an aggregate, this License does not\napply to the other works in the aggregate which are not themselves\nderivative works of the Document.\n\nIf the Cover Text requirement of section~3 is applicable to these\ncopies of the Document, then if the Document is less than one half of\nthe entire aggregate, the Document's Cover Texts may be placed on\ncovers that bracket the Document within the aggregate, or the\nelectronic equivalent of covers if the Document is in electronic form.\nOtherwise they must appear on printed covers that bracket the whole\naggregate.\n\n\n\\begin{center}\n\t{\\Large\\bf 8. TRANSLATION\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{8. TRANSLATION}\n\\end{center}\n\n\nTranslation is considered a kind of modification, so you may\ndistribute translations of the Document under the terms of section~4.\nReplacing Invariant Sections with translations requires special\npermission from their copyright holders, but you may include\ntranslations of some or all Invariant Sections in addition to the\noriginal versions of these Invariant Sections.  You may include a\ntranslation of this License, and all the license notices in the\nDocument, and any Warranty Disclaimers, provided that you also include\nthe original English version of this License and the original versions\nof those notices and disclaimers.  In case of a disagreement between\nthe translation and the original version of this License or a notice\nor disclaimer, the original version will prevail.\n\nIf a section in the Document is Entitled ``Acknowledgements'',\n``Dedications'', or ``History'', the requirement (section~4) to Preserve\nits Title (section~1) will typically require changing the actual\ntitle.\n\n\n\\begin{center}\n\t{\\Large\\bf 9. TERMINATION\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{9. TERMINATION}\n\\end{center}\n\n\nYou may not copy, modify, sublicense, or distribute the Document\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense, or distribute it is void, and\nwill automatically terminate your rights under this License.\n\nHowever, if you cease all violation of this License, then your license\nfrom a particular copyright holder is reinstated (a) provisionally,\nunless and until the copyright holder explicitly and finally\nterminates your license, and (b) permanently, if the copyright holder\nfails to notify you of the violation by some reasonable means prior to\n60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\nTermination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, receipt of a copy of some or all of the same material does\nnot give you any rights to use it.\n\n\n\\begin{center}\n\t{\\Large\\bf 10. FUTURE REVISIONS OF THIS LICENSE\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{10. FUTURE REVISIONS OF THIS LICENSE}\n\\end{center}\n\n\nThe Free Software Foundation may publish new, revised versions\nof the GNU Free Documentation License from time to time.  Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.  See\n\\texttt{https://www.gnu.org/licenses/}.\n\nEach version of the License is given a distinguishing version number.\nIf the Document specifies that a particular numbered version of this\nLicense ``or any later version'' applies to it, you have the option of\nfollowing the terms and conditions either of that specified version or\nof any later version that has been published (not as a draft) by the\nFree Software Foundation.  If the Document does not specify a version\nnumber of this License, you may choose any version ever published (not\nas a draft) by the Free Software Foundation.  If the Document\nspecifies that a proxy can decide which future versions of this\nLicense can be used, that proxy's public statement of acceptance of a\nversion permanently authorizes you to choose that version for the\nDocument.\n\n\n\\begin{center}\n\t{\\Large\\bf 11. RELICENSING\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{11. RELICENSING}\n\\end{center}\n\n\n``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any\nWorld Wide Web server that publishes copyrightable works and also\nprovides prominent facilities for anybody to edit those works.  A\npublic wiki that anybody can edit is an example of such a server.  A\n``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the\nsite means any set of copyrightable works thus published on the MMC\nsite.\n\n``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0\nlicense published by Creative Commons Corporation, a not-for-profit\ncorporation with a principal place of business in San Francisco,\nCalifornia, as well as future copyleft versions of that license\npublished by that same organization.\n\n``Incorporate'' means to publish or republish a Document, in whole or\nin part, as part of another Document.\n\nAn MMC is ``eligible for relicensing'' if it is licensed under this\nLicense, and if all works that were first published under this License\nsomewhere other than this MMC, and subsequently incorporated in whole\nor in part into the MMC, (1) had no cover texts or invariant sections,\nand (2) were thus incorporated prior to November 1, 2008.\n\nThe operator of an MMC Site may republish an MMC contained in the site\nunder CC-BY-SA on the same site at any time before August 1, 2009,\nprovided the MMC is eligible for relicensing.\n\n\n\\begin{center}\n\t{\\Large\\bf ADDENDUM: How to use this License for your documents\\par}\n\t\\phantomsection\n\t\\addcontentsline{toc}{section}{ADDENDUM: How to use this License for your documents}\n\\end{center}\n\nTo use this License in a document you have written, include a copy of\nthe License in the document and put the following copyright and\nlicense notices just after the title page:\n\n\\bigskip\n\\begin{quote}\n\tCopyright \\copyright{}  YEAR  YOUR NAME.\n\tPermission is granted to copy, distribute and/or modify this document\n\tunder the terms of the GNU Free Documentation License, Version 1.3\n\tor any later version published by the Free Software Foundation;\n\twith no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.\n\tA copy of the license is included in the section entitled ``GNU\n\tFree Documentation License''.\n\\end{quote}\n\\bigskip\n\nIf you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,\nreplace the ``with \\dots\\ Texts.''\\ line with this:\n\n\\bigskip\n\\begin{quote}\n\twith the Invariant Sections being LIST THEIR TITLES, with the\n\tFront-Cover Texts being LIST, and with the Back-Cover Texts being LIST.\n\\end{quote}\n\\bigskip\n\nIf you have Invariant Sections without Cover Texts, or some other\ncombination of the three, merge those two alternatives to suit the\nsituation.\n\nIf your document contains nontrivial examples of program code, we\nrecommend releasing these examples in parallel under your choice of\nfree software license, such as the GNU General Public License,\nto permit their use in free software.\n\n\\chapter{GNU General Public License, version 2}\n\n\\begin{center}\n\t{\\parindent 0in\n\n\t\tCopyright \\copyright\\ 1989, 1991 Free Software Foundation, Inc.\n\n\t\t\\bigskip\n\n\t\t51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\n\n\t\t\\bigskip\n\n\t\tEveryone is permitted to copy and distribute verbatim copies\n\t\tof this license document, but changing it is not allowed.\n\t}\n\\end{center}\n\n\\begin{center}\n\t{\\bf\\large Preamble}\n\\end{center}\n\n\nThe licenses for most software are designed to take away your freedom to\nshare and change it.  By contrast, the GNU General Public License is\nintended to guarantee your freedom to share and change free software---to\nmake sure the software is free for all its users.  This General Public\nLicense applies to most of the Free Software Foundation's software and to\nany other program whose authors commit to using it.  (Some other Free\nSoftware Foundation software is covered by the GNU Library General Public\nLicense instead.)  You can apply it to your programs, too.\n\nWhen we speak of free software, we are referring to freedom, not price.\nOur General Public Licenses are designed to make sure that you have the\nfreedom to distribute copies of free software (and charge for this service\nif you wish), that you receive source code or can get it if you want it,\nthat you can change the software or use pieces of it in new free programs;\nand that you know you can do these things.\n\nTo protect your rights, we need to make restrictions that forbid anyone to\ndeny you these rights or to ask you to surrender the rights.  These\nrestrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\nFor example, if you distribute copies of such a program, whether gratis or\nfor a fee, you must give the recipients all the rights that you have.  You\nmust make sure that they, too, receive or can get the source code.  And\nyou must show them these terms so they know their rights.\n\nWe protect your rights with two steps: (1) copyright the software, and (2)\noffer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\nAlso, for each author's protection and ours, we want to make certain that\neveryone understands that there is no warranty for this free software.  If\nthe software is modified by someone else and passed on, we want its\nrecipients to know that what they have is not the original, so that any\nproblems introduced by others will not reflect on the original authors'\nreputations.\n\nFinally, any free program is threatened constantly by software patents.\nWe wish to avoid the danger that redistributors of a free program will\nindividually obtain patent licenses, in effect making the program\nproprietary.  To prevent this, we have made it clear that any patent must\nbe licensed for everyone's free use or not licensed at all.\n\nThe precise terms and conditions for copying, distribution and\nmodification follow.\n\n\\begin{center}\n\t{\\Large \\sc Terms and Conditions For Copying, Distribution and\n\t\tModification}\n\\end{center}\n\n\n%\\renewcommand{\\theenumi}{\\alpha{enumi}}\n\\begin{enumerate}\n\n\t\\addtocounter{enumi}{-1}\n\n\t\\item\n\n\tThis License applies to any program or other work which contains a notice\n\tplaced by the copyright holder saying it may be distributed under the\n\tterms of this General Public License.  The ``Program'', below, refers to\n\tany such program or work, and a ``work based on the Program'' means either\n\tthe Program or any derivative work under copyright law: that is to say, a\n\twork containing the Program or a portion of it, either verbatim or with\n\tmodifications and/or translated into another language.  (Hereinafter,\n\ttranslation is included without limitation in the term ``modification''.)\n\tEach licensee is addressed as ``you''.\n\n\tActivities other than copying, distribution and modification are not\n\tcovered by this License; they are outside its scope.  The act of\n\trunning the Program is not restricted, and the output from the Program\n\tis covered only if its contents constitute a work based on the\n\tProgram (independent of having been made by running the Program).\n\tWhether that is true depends on what the Program does.\n\n\t\\item You may copy and distribute verbatim copies of the Program's source\n\tcode as you receive it, in any medium, provided that you conspicuously\n\tand appropriately publish on each copy an appropriate copyright notice\n\tand disclaimer of warranty; keep intact all the notices that refer to\n\tthis License and to the absence of any warranty; and give any other\n\trecipients of the Program a copy of this License along with the Program.\n\n\tYou may charge a fee for the physical act of transferring a copy, and you\n\tmay at your option offer warranty protection in exchange for a fee.\n\n\t\\item\n\n\tYou may modify your copy or copies of the Program or any portion\n\tof it, thus forming a work based on the Program, and copy and\n\tdistribute such modifications or work under the terms of Section 1\n\tabove, provided that you also meet all of these conditions:\n\n\t\\begin{enumerate}\n\n\t\t\\item\n\n\t\tYou must cause the modified files to carry prominent notices stating that\n\t\tyou changed the files and the date of any change.\n\n\t\t\\item\n\n\t\tYou must cause any work that you distribute or publish, that in\n\t\twhole or in part contains or is derived from the Program or any\n\t\tpart thereof, to be licensed as a whole at no charge to all third\n\t\tparties under the terms of this License.\n\n\t\t\\item\n\t\tIf the modified program normally reads commands interactively\n\t\twhen run, you must cause it, when started running for such\n\t\tinteractive use in the most ordinary way, to print or display an\n\t\tannouncement including an appropriate copyright notice and a\n\t\tnotice that there is no warranty (or else, saying that you provide\n\t\ta warranty) and that users may redistribute the program under\n\t\tthese conditions, and telling the user how to view a copy of this\n\t\tLicense.  (Exception: if the Program itself is interactive but\n\t\tdoes not normally print such an announcement, your work based on\n\t\tthe Program is not required to print an announcement.)\n\n\t\\end{enumerate}\n\n\n\tThese requirements apply to the modified work as a whole.  If\n\tidentifiable sections of that work are not derived from the Program,\n\tand can be reasonably considered independent and separate works in\n\tthemselves, then this License, and its terms, do not apply to those\n\tsections when you distribute them as separate works.  But when you\n\tdistribute the same sections as part of a whole which is a work based\n\ton the Program, the distribution of the whole must be on the terms of\n\tthis License, whose permissions for other licensees extend to the\n\tentire whole, and thus to each and every part regardless of who wrote it.\n\n\tThus, it is not the intent of this section to claim rights or contest\n\tyour rights to work written entirely by you; rather, the intent is to\n\texercise the right to control the distribution of derivative or\n\tcollective works based on the Program.\n\n\tIn addition, mere aggregation of another work not based on the Program\n\twith the Program (or with a work based on the Program) on a volume of\n\ta storage or distribution medium does not bring the other work under\n\tthe scope of this License.\n\n\t\\item\n\tYou may copy and distribute the Program (or a work based on it,\n\tunder Section 2) in object code or executable form under the terms of\n\tSections 1 and 2 above provided that you also do one of the following:\n\n\t\\begin{enumerate}\n\n\t\t\\item\n\n\t\tAccompany it with the complete corresponding machine-readable\n\t\tsource code, which must be distributed under the terms of Sections\n\t\t1 and 2 above on a medium customarily used for software interchange; or,\n\n\t\t\\item\n\n\t\tAccompany it with a written offer, valid for at least three\n\t\tyears, to give any third party, for a charge no more than your\n\t\tcost of physically performing source distribution, a complete\n\t\tmachine-readable copy of the corresponding source code, to be\n\t\tdistributed under the terms of Sections 1 and 2 above on a medium\n\t\tcustomarily used for software interchange; or,\n\n\t\t\\item\n\n\t\tAccompany it with the information you received as to the offer\n\t\tto distribute corresponding source code.  (This alternative is\n\t\tallowed only for noncommercial distribution and only if you\n\t\treceived the program in object code or executable form with such\n\t\tan offer, in accord with Subsection b above.)\n\n\t\\end{enumerate}\n\n\n\tThe source code for a work means the preferred form of the work for\n\tmaking modifications to it.  For an executable work, complete source\n\tcode means all the source code for all modules it contains, plus any\n\tassociated interface definition files, plus the scripts used to\n\tcontrol compilation and installation of the executable.  However, as a\n\tspecial exception, the source code distributed need not include\n\tanything that is normally distributed (in either source or binary\n\tform) with the major components (compiler, kernel, and so on) of the\n\toperating system on which the executable runs, unless that component\n\titself accompanies the executable.\n\n\tIf distribution of executable or object code is made by offering\n\taccess to copy from a designated place, then offering equivalent\n\taccess to copy the source code from the same place counts as\n\tdistribution of the source code, even though third parties are not\n\tcompelled to copy the source along with the object code.\n\n\t\\item\n\tYou may not copy, modify, sublicense, or distribute the Program\n\texcept as expressly provided under this License.  Any attempt\n\totherwise to copy, modify, sublicense or distribute the Program is\n\tvoid, and will automatically terminate your rights under this License.\n\tHowever, parties who have received copies, or rights, from you under\n\tthis License will not have their licenses terminated so long as such\n\tparties remain in full compliance.\n\n\t\\item\n\tYou are not required to accept this License, since you have not\n\tsigned it.  However, nothing else grants you permission to modify or\n\tdistribute the Program or its derivative works.  These actions are\n\tprohibited by law if you do not accept this License.  Therefore, by\n\tmodifying or distributing the Program (or any work based on the\n\tProgram), you indicate your acceptance of this License to do so, and\n\tall its terms and conditions for copying, distributing or modifying\n\tthe Program or works based on it.\n\n\t\\item\n\tEach time you redistribute the Program (or any work based on the\n\tProgram), the recipient automatically receives a license from the\n\toriginal licensor to copy, distribute or modify the Program subject to\n\tthese terms and conditions.  You may not impose any further\n\trestrictions on the recipients' exercise of the rights granted herein.\n\tYou are not responsible for enforcing compliance by third parties to\n\tthis License.\n\n\t\\item\n\tIf, as a consequence of a court judgment or allegation of patent\n\tinfringement or for any other reason (not limited to patent issues),\n\tconditions are imposed on you (whether by court order, agreement or\n\totherwise) that contradict the conditions of this License, they do not\n\texcuse you from the conditions of this License.  If you cannot\n\tdistribute so as to satisfy simultaneously your obligations under this\n\tLicense and any other pertinent obligations, then as a consequence you\n\tmay not distribute the Program at all.  For example, if a patent\n\tlicense would not permit royalty-free redistribution of the Program by\n\tall those who receive copies directly or indirectly through you, then\n\tthe only way you could satisfy both it and this License would be to\n\trefrain entirely from distribution of the Program.\n\n\tIf any portion of this section is held invalid or unenforceable under\n\tany particular circumstance, the balance of the section is intended to\n\tapply and the section as a whole is intended to apply in other\n\tcircumstances.\n\n\tIt is not the purpose of this section to induce you to infringe any\n\tpatents or other property right claims or to contest validity of any\n\tsuch claims; this section has the sole purpose of protecting the\n\tintegrity of the free software distribution system, which is\n\timplemented by public license practices.  Many people have made\n\tgenerous contributions to the wide range of software distributed\n\tthrough that system in reliance on consistent application of that\n\tsystem; it is up to the author/donor to decide if he or she is willing\n\tto distribute software through any other system and a licensee cannot\n\timpose that choice.\n\n\tThis section is intended to make thoroughly clear what is believed to\n\tbe a consequence of the rest of this License.\n\n\t\\item\n\tIf the distribution and/or use of the Program is restricted in\n\tcertain countries either by patents or by copyrighted interfaces, the\n\toriginal copyright holder who places the Program under this License\n\tmay add an explicit geographical distribution limitation excluding\n\tthose countries, so that distribution is permitted only in or among\n\tcountries not thus excluded.  In such case, this License incorporates\n\tthe limitation as if written in the body of this License.\n\n\t\\item\n\tThe Free Software Foundation may publish revised and/or new versions\n\tof the General Public License from time to time.  Such new versions will\n\tbe similar in spirit to the present version, but may differ in detail to\n\taddress new problems or concerns.\n\n\tEach version is given a distinguishing version number.  If the Program\n\tspecifies a version number of this License which applies to it and ``any\n\tlater version'', you have the option of following the terms and conditions\n\teither of that version or of any later version published by the Free\n\tSoftware Foundation.  If the Program does not specify a version number of\n\tthis License, you may choose any version ever published by the Free Software\n\tFoundation.\n\n\t\\item\n\tIf you wish to incorporate parts of the Program into other free\n\tprograms whose distribution conditions are different, write to the author\n\tto ask for permission.  For software which is copyrighted by the Free\n\tSoftware Foundation, write to the Free Software Foundation; we sometimes\n\tmake exceptions for this.  Our decision will be guided by the two goals\n\tof preserving the free status of all derivatives of our free software and\n\tof promoting the sharing and reuse of software generally.\n\n\t\\begin{center}\n\t\t{\\Large\\sc\n\t\t\tNo Warranty\n\t\t}\n\t\\end{center}\n\n\t\\item\n\t{\\sc Because the program is licensed free of charge, there is no warranty\n\t\tfor the program, to the extent permitted by applicable law.  Except when\n\t\totherwise stated in writing the copyright holders and/or other parties\n\t\tprovide the program ``as is'' without warranty of any kind, either expressed\n\t\tor implied, including, but not limited to, the implied warranties of\n\t\tmerchantability and fitness for a particular purpose.  The entire risk as\n\t\tto the quality and performance of the program is with you.  Should the\n\t\tprogram prove defective, you assume the cost of all necessary servicing,\n\t\trepair or correction.}\n\n\t\\item\n\t{\\sc In no event unless required by applicable law or agreed to in writing\n\t\twill any copyright holder, or any other party who may modify and/or\n\t\tredistribute the program as permitted above, be liable to you for damages,\n\t\tincluding any general, special, incidental or consequential damages arising\n\t\tout of the use or inability to use the program (including but not limited\n\t\tto loss of data or data being rendered inaccurate or losses sustained by\n\t\tyou or third parties or a failure of the program to operate with any other\n\t\tprograms), even if such holder or other party has been advised of the\n\t\tpossibility of such damages.}\n\n\\end{enumerate}\n\n\n\\begin{center}\n\t{\\Large\\sc End of Terms and Conditions}\n\\end{center}\n\n\n\\end{document}\n"
  },
  {
    "path": "README.md",
    "content": "# M17_spec\n\n[M17 Project](http://m17project.org/) is a modern, digital radio protocol built by hams, for hams.\nThis repository contains the specification describing it exhaustively, from top to bottom. It is still a work in progress, meaning that this repository is meant to be updated now and then. After a few years of development, almost all of the changes are just to supplement the specification with new functions or improve the document.\n\nThe specification can be conveniently browsed [here](https://spec.m17project.org/).\n\nIf you need a pdf file suitable for printing and binding, see the comment at the first line of the `M17_spec.tex` file.\n"
  }
]