A packet encoded by the PHY consists of the following blocks:
. Preamble: a fixed symbol sequence that the receiver can use to determine the start time, frequency and phase offset of the following data.
. PHY header: contains information about the packet length and modulation/coding scheme.
. Data symbols: encoded and modulated data.
==== Preamble
The preamble is a fixed 63-bit sequence generated from a linear feedback shift register with 6 bits and the generator polynomial stem:[x^6 + x^5 + 1].
The generated sequence is: `111000101111001010001100001000001111110101011001101110110100100`.
This sequence is modulated using BPSK.
The preamble is prefixed to each transmitted packet, even inside a burst.
==== PHY Header
The PHY header describes how the following data symbols should be interpreted. It consists of the following fields:
. Modulation/code combination ID (MODCOD): 4 bit
. Number of data symbols: 12 bit
. CRC16 of the raw layer 2 packet data: 16 bit
. CRC8 of the previous 32 header bits: 8 bit
Therefore the PHY header has as size of 40 bit, including CRC.
For additional protection, the header in encoded using a [8,4] Hamming code, which can reliably correct single-bit errors and detect double-bit errors in every block of four bits.
The encoded data is always modulated using QPSK.
===== Modulation/code combinations
The following table lists all supported combinations of modulation and forward error correction.
The first data symbol follows directly after the last symbol of the PHY header. The data is encoded and modulated using the scheme defined in the PHY header’s MODCOD field. The number of symbols resulting from the encoding and modulation process is stored in the PHY header as well.
=== Burst Transmission
Burst transmission allows the transmitter to send multiple packets in quick succession.
. One or more packets as defined in <<phy_packet_format>>
. Ramp-down sequence
The ramp-up, ramp-down and idle sequences consist of alternating +1/-1 BPSK symbols.
During ramp-up, their amplitude stem:[A_u(k)] is scaled up across stem:[L_u] symbols, following the curve stem:[A_u(k) = sin(π/2 * k / L_u)]. Ramp-down follows a similar sinusoidal for stem:[L_d] symbols: stem:[A_d(k) = cos(π/2 * k / L_d)]. The purpose of these sequences is to avoid splatter while turning on and off the transmitted signal.
During the pre-packet idle sequence, the alternating BPSK symbols are continued with constant amplitude 1.0. This sequence may help synchronizers acquire the signal better (especially the gain and timing regulation can benefit), but is not needed if they are fast enough. If and how this part is used is still to be determined.
Each packet in a burst includes a preamble. Packets are directly concatenated, i.e. after the last data symbol follows the first preamble symbol.
This system uses Root Raised Cosine (RRC) filters with a roll-off factor of stem:[alpha=0.2]. Therefore the bandwidth is 1.2 times the symbol rate.
The filter is applied to the whole symbol sequence of the burst. The same filter must be applied at the receiver to minimize inter-symbol interference.
The Hamnet70 link layer is designed to ensure reliable communication between a central station (digipeater) and several clients, while making efficient use of the available airtime. To accomplish this, it uses several technologies, including variable-length addressing and Go-Back-N retransmission.
=== Node Addresses
Node addresses use the https://github.com/arngll/arnce-spec/blob/main/n6drc-arnce.md#introduction[HAM-64 address format]. This format allows to encode callsigns of up to 12 characters in a number of 16, 32, 48 or 64 bits. Additionally, it allows to replace the full version of an address with a temporary short address with only 16 bits that is used during a connection. Multicast and broadcast addresses are also specified.
=== Link Layer Header
Each layer 2 packet contains a header that identifies how the message should be interpreted. It is of variable length and composed as follows:
[cols="2,1,5", options="header"]
.Link layer header layout
|===
| Field | Length | Description
| Message type
| 3 bit
| The type of the message. See below for a list of values.
| TX request
| 1 bit
| After this message, the burst ends and the destination may transmit.
| Source address length
| 2 bit
| Length of the source address.
| Destination address length
| 2 bit
| Length of the destination address.
| TX sequence number
| 4 bit
| Sequence number of the currently transmitted packet.
| RX sequence number
| 4 bit
| Sequence number of the packet expected next.
| Source address
| 16, 32, 48 or 64 bit
| HAM-64 address identifying the sending station.
| Destination address length
| 16, 32, 48 or 64 bit
| HAM-64 address identifying the target station.
|===
The total Link Layer Header length is therefore at least 6 byte and at most 18 byte.
[cols="1,2,5", options="header"]
.Message types
|===
| Value | Name | Description
| `000`
| Data frame
| A regular data packet.
| `100`
| Connection management
| Includes functions such as establishing (or denying) new connections or closing open connections.
| _other_
| _reserved_
| All values not explicitly listed are reserved and shall be ignored by receivers.
|===
The length of the source and destination addresses is encoded as follows: `00` = 16 bit, `01` = 32 bit, `10` = 48 bit, `11` = 64 bit.